CodeItRight.Cmd is the command-line companion to the CodeIt.Right application. Like CodeIt.Right, CodeItRight.Cmd analyzes source code and reports violations, such as possible design, performance, and security issues. CodeItRight.Cmd can be used as a stand-alone tool or added to automated build processes.
The following are the command line parameters that are supported by SubMain.CodeItRight.Cmd.exe ; Parameter values are not case sensitive.
/Solution - (Required*) - full file name of the solution to load (*.sln file) (*) This parameter is not required if /Project parameter specified.
/Project - (Required*) - full file name of the project to load (*.csproj or *.vbproj file) (*) This parameter is not required if /Solution parameter specified.
/Out - (Required) - full name of the XML report output file.
/OutXSL - (Optional) - full name of the XSL file to override the default xsl.
/OutHtml - (Optional) – specifies the full name of the HTML report output file when the HTML format preferred over the default XML.
/CRData - (Optional) - full name of the CodeIt.Right .crdata file. When specified, CodeItRight.Cmd will use the exclusion list (violations, rules, and files) saved using the Visual Studio version of CodeIt.Right.
/Profile - (Optional) - name of the User Profile that defines active rule set for the analysis. When omitted, the built-in profile is used. The parameter value is not an absolute path but rather profile name as you see it in the dropdown in the Visual Studio toolbar. Note: CodeItRight.Cmd is looking for the profile <USER>\Documents\SubMain\CodeIt.Right {Edition} for VSxxxx\Profiles – when running CodeItRight.Cmd under a different user, be sure to copy your profiles into the corresponding folder for that user.
/severityThreshold - (Optional) - Severity Threshold value to limit the output violation set. When omitted, the lowest Severity is used - None. Accepted values (from Higher to Lower):
- CriticalError
- Error
- CriticalWarning
- Warning
- Information
- None
/ProjectConfiguration - (Optional) – specifies one of the project configurations in Visual Studio - typically Debug or Release but this also allows to use your custom configuration if you created it in your VS environment. Sample syntax for /ProjectConfiguration parameter:
/ProjectConfiguration:"Release"
/RunStyleCop - (Optional) – runs StyleCop ruleset analysis when StyleCop is integrated with CodeIt.Right. Sample syntax for /RUnStyleCop parameter:
/RunStyleCop
/DateAfter - (Optional)(v3 and newer) – analyze only files modified after the date (yyyy-MM-dd) – works only in v3 or newer. Sample syntax for /DateAfter parameter:
/DateAfter:"2012-02-16"
/UseAnalyzeList - (Optional)(v3 and newer) – analyze only files provided in <AnalyzeList /> of the .CRDATA file – works only in v3 or newer. Sample syntax for /UseAnalyzeList parameter:
/UseAnalyzeList
/Quiet - (Optional) - disables console output.
/Help - display list of command-line parameters.
Example:
SubMain.CodeItRight.Cmd.exe /Solution:"C:\MyProjects\MyProject\MyProject.sln"
/Out:"C:\MyProjects\MyProject\MyProject.CIR.Output.xml"
/CRData:"C:\MyProjects\MyProject\MyProject.crdata" /Profile:"My Profile" /severityThreshold:"Error"
Enterprise Edition Specific
The Enterprise Edition extends command line parameters to enable code metrics output and report distribution over email.
/RuleUpdate - (Optional)(EE Only) - this switch allows to propagate profile and rule changes published into Shared Folder. This is to be used in a build server Cmd only (no Visual Studio) setup.
/PropertyFilePath - (Optional)(EE Only) – allows pointing to a CodeIt.Right settings file to use one a shared location or for any reason to use the settings file alternative to the one in the user Documents folder. Sample syntax for /PropertyFilePath parameter:
/PropertyFilePath:"\\networkshare\CodeIt.Right\TeamConfiguration\CodeIt.Right.Properties.xml"
/Metrics - (Optional)(EE Only) - generates XML output for one of the three code metrics reports – "Member", "Type" and "Code". Sample syntax for /Metrics parameter:
/Metrics:"Member"
or
/Metrics:"Type"
or
/Metrics:"Code"
/SendTo - (Optional)(EE Only) - sends violation/metrics reports to list of email addresses. Sample syntax for /SendTo parameter:
/SendTo:"email1@gmail.com;email2@gmail.com"
Mail server is configured in "<Documents>\SubMain\CodeIt.Right Enterprise for VSxxxx\Properties\CodeIt.Right.Properties.xml"
<Property PropertyID="3" Name="SmtpServer" Value="mail.server.com" />
<Property PropertyID="4" Name="SmtpPort" Value="25" />
<Property PropertyID="5" Name="SmtpEnableSsl" Value="false" />
<Property PropertyID="6" Name="SmtpUserName" Value="" />
<Property PropertyID="7" Name="SmtpPassword" Value="" />
<Property PropertyID="8" Name="MailSubjectPrefix" Value="" />
<Property PropertyID="9" Name="MailFrom" Value="user@server.com" />
/mailSubject - (Optional)(EE Only) – overrides the default email subject - only applies when the SendTo parameter is specified. Sample syntax for /mailSubject parameter:
/mailSubject:"Violations report for MySolution.sln with Security Ruleset"
CodeItRight.Cmd Error Codes
Returns
- Positive code equal to the number of violations found
- 0 - No violations and no errors found
- Negative codes for internal errors:
-1 | Command Line Switch Error |
-2 | Command Line Argument Error |
-3 | Initialization Error |
-4 | Analysis Error |
-5 | Output Error |
-6 | Unknown Error |