Code Analysis and Visualization Tools (Open source and Freeware)

These are the code analysis tools, I found very useful in practice. These tools help you in quickly analysing projects and get a quick impression about the quality of code.

1. Source Monitor from Campwood Software (Freeware)

SourceMonitor is an indispensible tool in my code analysis toolbox. SourceMonitor can

  • Collects metrics in a fast, single pass through source files
  • Measures metrics for source code written in C++, C, C#, VB.NET, Java, Delphi, Visual Basic (VB6) or HTML.
  • Includes method and function level metrics for C++, C, C#, VB.NET, Java, and Delphi.
  • Saves metrics in checkpoints for comparison during project lifecycle
  • Displays and prints metrics in tables and charts.
  • A standard Windows GUI or command line execution using XML command files. Hence can be adding the build files.
  • Exports metrics to XML or CSV (comma-separated-value) files

Its a good idea to analyze the project source everyday by making the SourceMonitor analysis part of project daily build.

Here are two links on integrating SourceMonitor with CruiseControl. You can use these as reference to get some ideas on how to integrate SourceMonitor in your project builds.

2. Thinking Craftsman Toolkit - TC Toolkit (Open source)

Simple tools to quickly analyze/visualize codebase.

  • Code Duplication Detector (CDD)
  • Visualize metrics generated by SourceMonitor, JavaNCSS
  • Tag cloud visualization of classnames/function names et

Check the Sample Results of TC Toolkit and more details Here

License : New BSD License

3. JDepend (Open source)

JDepend traverses Java class file directories and generates design quality metrics for each Java package. JDepend allows you to automatically measure the quality of a design in terms of its extensibility, reusability, and maintainability to manage package dependencies effectively.

JDepend generates following design quality metrics

  1. Number of Classes and Interfaces
  2. Afferent Couplings (Ca)
  3. Efferent Couplings (Ce)
  4. Abstractness (A)
  5. Instability (I)
  6. Distance from the Main Sequence (D)
  7. Package Dependency Cycles

Treemap code from TC Toolkit can be used to analyse the JDepend dependency metrics also.

4. RevSnowflakeJoin (Open source)

Reverse Snowflake Joins (abbreviated as revj) is a tool to understand SQL and document SQL queries. This is especially good for maintaining big queries written by somebody else. "Big SQL" can be as many as 20 tables, joined by multiple fields.

Revj converts various joins used in the sql query into a 'graph' and then converts that graph into an image using the Graphviz toolkit. This way we can easily see the structure of the various joins.

You will need Graphviz and PyParsing for this tool.

5. Linguine Maps (Open source)

Linguine Maps is an open-source Java library that conducts programmatic visualization of various text files. It generateseasy-to-understand entity-relation diagrams. With a diagram from them. These diagrams will help you to quickly get familiar with new schema, object-relational mappings, or DTDs

Given below are some examples