Skip to content

SourceMonitor Importer

The SourceMonitor importer turns the CSV export of SourceMonitor into a cc.json map. Every file gets SourceMonitor’s size, complexity and nesting metrics under CodeCharta’s metric names. Use it when your team already measures C, C++, C#, Delphi, HTML, Java, VB.NET or Visual Basic 6 code with SourceMonitor.

  1. In SourceMonitor, export the file metrics of your project (not the method metrics) as CSV.

  2. Import the CSV:

    Terminal window
    ccsh sourcemonitorimport sourcemonitor.csv -o sourcemonitor.cc.json
OptionDescription
FILE...one or more SourceMonitor CSV exports
-o, --output-file=<outputFile>output file; prints to stdout when omitted
-nc, --not-compressedwrite plain JSON instead of a gzip file
-h, --helpshow the help and exit
Usage: ccsh sourcemonitorimport [-h] [-nc] [-o=<outputFile>] FILE...

The File Name column gives the path of each file, with \ between folders. These columns get a CodeCharta name:

MetricSourceMonitor columnDescription
locLinesall lines, including empty lines and comments
rlocStatementsnumber of statements
classesClasses and Interfacesnumber of classes and interfaces
functions_per_classMethods per Classaverage number of methods per class
average_statements_per_functionAverage Statements per Methodaverage number of statements per method
max_function_complexityMaximum Complexity*highest cyclomatic complexity of a method in the file
average_function_complexityAverage Complexity*average cyclomatic complexity of the methods
max_block_depthMaximum Block Depthdeepest nesting of blocks
average_block_depthAverage Block Depthaverage nesting of blocks
statements_at_level_0 to _9Statements at block level 0 to 9number of statements at each nesting level

Every other numeric column keeps its name in lower case, with _ for spaces and the prefix sm_, for example sm_percent_branch_statements, sm_method_call_statements and sm_percent_lines_with_comments. The project name, checkpoint, date and the line numbers and names of the most complex method and the deepest block are left out.