Static source code analysis for C# that operates on source code level
Current static source analysis tools for C# (or other .NET languages) usually operate on the assembly-level. They use reflection to analyse the code.
Are there tools available that operate on a source code level only (l开发者_如何学运维ike lint for C)?
IIRC, SourceMonitor works at the code level and also Microsoft StyleCop.
SourceMonitor:
The freeware program SourceMonitor lets you see inside your software source code to find out how much code you have and to identify the relative complexity of your modules.
StyleCop:
StyleCop analyzes C# source code to enforce a set of style and consistency rules. It can be run from inside of Visual Studio or integrated into an MSBuild project.
There are several tools (even R# does it), the right tool depends on the analysis you want to perform.
A dedicated tool that does it is CodeIt.Right.
Another way is to use a parser (like the one Sharp Develop uses) and perform the analysis using your own code.
Have you looked into StyleCOP? It parses your source code and raises source-level issues. Otherwise, what's the issue with running on the IL?
If you are considering commercial analyzers, I've evaluated Klocwork Insight, and it is clearly source based analysis for C#.
My company provides Metrics analysis and code duplication analysis for C#, as well as a general tool for constructing arbitrary analysis and/or transformations, directly on C# source code. The tools can operate on complete systems of files as well as individual files.
精彩评论