views:

144

answers:

5

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 (like lint for C)?

A: 

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.

Elisha
+1  A: 

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.

João Angelo
A: 

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?

JBRWilkinson
We're looking into a solution to analyze source-code in a changeset *before* that changeset is added to a branch. This requires analysis on a source-code level, because there has been no build yet.Personally I believe FxCop gives you more information, but FxCop cannot be used in the scenario I describe above.
Sardaukar
A: 

If you are considering commercial analyzers, I've evaluated Klocwork Insight, and it is clearly source based analysis for C#.

Michael Donohue
A: 

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.

Ira Baxter