Tuesday, 1 November 2016

.net - FxCop custom rule for nested If

I am trying to get following metrics report for .Net assemblies
1. Boolean expression
2. Nested If
3. Method Parameters
3. Nested try
4. Missing switch default
5. Class fan-out complexity



Basically, I want to generate toxicity report for these complexities. I see that Sonar could generate same for java applications. But I don't see anything available with .Net using FxCop or nDepend. I tried creating custom rules, but not able to get it done with any of tool.
Is it possible to create custom rules with FxCop and get analysis report, and then create complexity measure from it?
I have generated nested try rule with FxCop. But nested If seems difficult, because IL generate lot of goto statements which makes difficult to identify if "If" statements are nested or parallel placed. Same with Boolean complexity because of stack push-pop operations.



I think sonar make use of checkstyle for java to generate these reports. Is it source code based analyser? or also works with IL? Do I need to work with styleCop to get it worked?




Any help will be appreciated.

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...