Extensions | Violation | Config Name | Default Maximum Value |
---|---|---|---|
* | Deep Nested Call | MaxNestedCall | 3 |
* | Duplicate String Literal | MaxDuplicateStrings | 3 |
* | File Too Big | MaxFileLength | 500 |
* | Method Too Big | MaxMethodLength | 50 |
* | Too Many Parameters | MaxParameters | 5 |
* | Too Much Nesting | MaxNesting | 4 |
.c | Method too Complex | MaxCyclomaticComplexity | 21 |
.cpp,.cxx,.cc,.ixx | Method too Complex | MaxCyclomaticComplexity | 21 |
.cs | Don't throw base Exception | CSharpMaxThrowBaseException | 0 |
.cs | Don't use goto | CSharpMaxGoToStatements | 0 |
.cs | Don't use lock(this) | CSharpMaxLockThis | 0 |
.cs | Method too Complex | MaxCyclomaticComplexity | 21 |
.cs | Rethrow detected | CSharpMaxRethrow | 0 |
.cs | throw new NotImplementedException detected | CSharpMaxNotImplementedException | 0 |
.go | Method too Complex | MaxCyclomaticComplexity | 21 |
.java | Method too Complex | MaxCyclomaticComplexity | 21 |
.js | Method too Complex | MaxCyclomaticComplexity | 21 |
.kt | Method too Complex | MaxCyclomaticComplexity | 21 |
.php | Method too Complex | MaxCyclomaticComplexity | 21 |
.py | Method too Complex | MaxCyclomaticComplexity | 21 |
.ts | Method too Complex | MaxCyclomaticComplexity | 21 |
//Trial Mode
QualityLogic quality = new QualityLogic();
//Licensed Mode
//QualityLogic quality = new QualityLogic("User Name from Receipt", "License Key from Receipt");
//Disable all quality checks
quality.DisableAllQualityChecks();
//Re-enable just the cyclomatic complexity
//https://en.wikipedia.org/wiki/Cyclomatic_complexity
const int cyclomaticComplexityHard = 21;
quality.Config.SetConfig("MaxCyclomaticComplexity", cyclomaticComplexityHard);
//Test using this open source project: https://github.com/GregFinzer/Compare-Net-Objects
QualityResult qualityResult =
quality.GetQualityViolationsForDirectory(@"c:\_git\Compare-Net-Objects\Compare-Net-Objects");
//Export the results to an HTML Report
string htmlReportFilePath = Path.Combine(Environment.CurrentDirectory, "QualityResult.html");
quality.ExportViolationsToHtmlReportFile(qualityResult, TemplateName.BlackAndBlue, htmlReportFilePath);