| Author |
Message |
martincostello
Joined: 13 Sep 2011 Posts: 14 Location: London, UK
|
Posted: Tue Feb 14, 2012 6:08 pm Post subject: Code Metrics Warning In Assembly |
|
|
Hi,
We have a TFS instance which builds our software, which is where SmartAssembly gets run from for our production builds.
As part of our custom TFS Build Process Template, we run the Visual Studio Code Metrics PowerTool 10.0 to collect statistics related to Cyclomatic Complexity, Class Coupling and Maintainability. If code exceeds pre-defined thresholds, then warnings are printed to the TFS build log, with the option of failing the build if warnings are found.
When an assembly is processed with SmartAssembly injected code, the processed assembly generates the following three warnings, which all appear to come from the "ErrorReportSender" class:
'SaveObjectInformation(ObjectAndType, FieldInfo) : void' has a Cyclomatic Complexity of 35. Rewrite or refactor to reduce the Cyclomatic Complexity to 25 or less.
'GetReportData() : byte[]' has a Cyclomatic Complexity of 55. Rewrite or refactor to reduce the Cyclomatic Complexity to 25 or less.
'WriteObjects() : void' has a Cyclomatic Complexity of 35. Rewrite or refactor to reduce the Cyclomatic Complexity to 25 or less.
The arguments we pass to the tool are:
metrics.exe <binary paths> /out:<outputfilepath> /successfile /searchgac /ignoreinvalidtargets /ignoregeneratedcode
We specify the /ignoregeneratedcode argument to exclude anything we've not written ourselves, however from looking at the generated assembly using .NET Reflector, it appears that the classes etc. embedded by SmartAssembly don't use this attribute, so the static analysis is including the SmartAssembly injected code in the analysis.
Is it possible to have SmartAssembly mark all of the classes that are injected to our assemblies with this attribute so that we don't get false positives from our code metrics analysis?
Regards,
Martin |
|
| Back to top |
|
 |
martincostello
Joined: 13 Sep 2011 Posts: 14 Location: London, UK
|
Posted: Tue Feb 14, 2012 6:09 pm Post subject: |
|
|
Sorry, forgot to mention I was talking about the [System.Diagnostics.GeneratedCodeAttribute].
Regards,
Martin |
|
| Back to top |
|
 |
Brian Donahue
Joined: 23 Aug 2004 Posts: 6344 Location: Red Gate Software
|
Posted: Thu Feb 16, 2012 11:23 am Post subject: |
|
|
Hi Martin,
I have logged this issue as a feature request: SA-1396. We can let you know if it's being dealt with. _________________ Brian Donahue
Technical Support
Red Gate Software Ltd.
44 (0)870 160 0037 ext 8521
US and CAN 1-866-RED GATE ext 8521 |
|
| Back to top |
|
 |
|
|
All times are GMT + 1 Hour
|
| Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group