Patrick Smacchia [MVP C#]

Sponsors

The Lounge

Wicked Cool Jobs

News

  • NDepend v3 is fully integrated in Visual Studio, and is now available for download! Software dependencies visualization, 82 .NET software metrics, continuous rule validations, assembly version diff, declarative code queries and more ! http://ndepend.com

Advertisement

Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at imagehelp@codebetter.com
NDepend Analysis Inputs

 

I would like here to clarify from where NDepend analysis takes its inputs. Indeed, it might sounds mysterious how NDepend can infer comment metrics from assemblies for example. The trick is that the analysis is fetching data from 4 different places: .NET assemblies, .NET PDB files, C# source files and coverage files.

 

 

 

Here are some remarks:

 

  • The 2 orange rows on the left reflect the fact that PDB files location are inferred from assemblies files location, and source files are referenced from PDB files. Coverage files location cannot be inferred and must be specified.
  • A PDB file does not need to reside in the same folder as its corresponding assembly. NDepend will try first to find the PDB in the same folder and if not found, it will try to find it in any of the folders specified.
  • Not all C# source files needed to build a .NET assembly are referenced from the PDB file. Only those containing some non-abstract methods are referenced. However NDepend uses a heuristic to find the corresponding Visual Studio project file from the referenced PDB files. If the VS project file is found, NDepend can then know about all source files referenced by the project.
  • In case the server used to build the assemblies is not the same as the server that performs the NDepend analysis, there is the possibility to rebase the location of source files as explained here.
  • The bulk of data used by NDepend comes from assemblies themselves. Only the number of lines of code is computed from PDB files. The lines of code computation is explained here.
  • Source files are parsed to obtain metrics relative to comments: PercentageComment, and NbLinesOfComment.
  • NDepend computes the Cyclomatic Complexity from the IL code. If source files are available it computes also the Cyclomatic Complexity from the source code. Experience shows that IL CC is a bit larger than the Source code CC. Indeed, a C# 'if' expression yields one IL jump. A C# 'for' loop yields two different offsets targeted by a branch IL instruction while a ‘foreach’ C# loop yields three.
  • So far only C# source files can be parsed by NDepend and in the future we plan to parse also VB.NET source files. Notice that because the number of lines of code is computed from PDB files, this metric is available for all .NET languages.
  • If some PDB files and/or some source files are missing, NDepend will warn about it but won’t stop the analysis. As the bulk of data is inferred from assemblies themselves it is still useful to analyze assemblies only, especially tier assemblies not released with source code.
  • You can read the Coverage FAQ to know more about NCover and VSTS coverage XML files. Coverage metrics values are inferred from these files, including: PercentageCoverage, NbLinesOfCodeCovered and, NbLinesOfCodeNotCovered. As PDB and source files, coverage files are optional.
  • Finally, NDepend will detect and warn about any synchronization issue between assemblies, and PDB files, sources files and coverage files.

Posted Mon, Jan 26 2009 12:45 PM by Patrick Smacchia

[Advertisement]

Comments

Dew Drop - January 26, 2008 | Alvin Ashcraft's Morning Dew wrote Dew Drop - January 26, 2008 | Alvin Ashcraft's Morning Dew
on Mon, Jan 26 2009 3:26 PM

Pingback from  Dew Drop - January 26, 2008 | Alvin Ashcraft's Morning Dew

Nocturn vision » Blog Archive » Code-review with NDepend wrote Nocturn vision » Blog Archive » Code-review with NDepend
on Mon, Feb 9 2009 3:31 PM

Pingback from  Nocturn vision  » Blog Archive   » Code-review with NDepend

Patrick Smacchia [MVP C#] wrote Rambling on Cyclomatic Complexity
on Tue, Oct 6 2009 10:51 AM

Normal 0 21 false false false FR X-NONE X-NONE After the number of Lines of Code , the Cyclomatic Complexity

Thomas Jaskula wrote Introduction : A la découverte de NDepend
on Tue, Oct 6 2009 7:42 PM

Lorsqu’on fait du développement au quotidien avec le Framework.NET, il y a des outils dont on ne peut

Peter works on the web! wrote Not another NDepend review, link roundup
on Sun, Dec 20 2009 8:58 AM

Not another NDepend review, link roundup

Add a Comment

(required)  
(optional)
(required)  
Remember Me?
Devlicio.us