NewRule oneIssuePerLine = repo.createRule(OneIssuePerLineSensor.RULE_KEY).setName("One Issue Per Line")
.setHtmlDescription("Generate an issue on each line of a file. It requires the metric \"lines\".");
- oneIssuePerLine.setDebtSubCharacteristic(RulesDefinition.SubCharacteristics.MEMORY_EFFICIENCY)
+ oneIssuePerLine
.setDebtRemediationFunction(hasTag.debtRemediationFunctions().linear("1min"))
.setEffortToFixDescription("It takes about 1 minute to an experienced software craftsman to remove a line of code");
NewRule hasTag = repo.createRule(HasTagSensor.RULE_KEY).setName("Has Tag")
.setHtmlDescription("Search for a given tag in Xoo files");
- hasTag.setDebtSubCharacteristic(RulesDefinition.SubCharacteristics.READABILITY)
+ hasTag
.setDebtRemediationFunction(hasTag.debtRemediationFunctions().constantPerIssue("2min"));
hasTag.createParam("tag")
.setDefaultValue("xoo")
NewRule oneIssuePerLine = repo.createRule(OneIssuePerLineSensor.RULE_KEY).setName("One Issue Per Line")
.setHtmlDescription("Generate an issue on each line of a file. It requires the metric \"lines\".");
- oneIssuePerLine.setDebtSubCharacteristic(RulesDefinition.SubCharacteristics.MEMORY_EFFICIENCY)
+ oneIssuePerLine
.setDebtRemediationFunction(hasTag.debtRemediationFunctions().linear("1min"))
.setEffortToFixDescription("It takes about 1 minute to an experienced software craftsman to remove a line of code");
NewRule oneIssuePerFile = repo.createRule(OneIssuePerFileSensor.RULE_KEY).setName("One Issue Per File")
.setHtmlDescription("Generate an issue on each file");
- oneIssuePerFile.setDebtSubCharacteristic(RulesDefinition.SubCharacteristics.ARCHITECTURE_CHANGEABILITY)
- .setDebtRemediationFunction(hasTag.debtRemediationFunctions().linear("10min"));
+ oneIssuePerFile.setDebtRemediationFunction(hasTag.debtRemediationFunctions().linear("10min"));
NewRule oneDayDebtPerFile = repo.createRule(OneDayDebtPerFileSensor.RULE_KEY).setName("One Day Debt Per File")
.setHtmlDescription("Generate an issue on each file with a debt of one day");
- oneDayDebtPerFile.setDebtSubCharacteristic(RulesDefinition.SubCharacteristics.ARCHITECTURE_RELIABILITY)
- .setDebtRemediationFunction(hasTag.debtRemediationFunctions().linear("1d"));
+ oneDayDebtPerFile.setDebtRemediationFunction(hasTag.debtRemediationFunctions().linear("1d"));
NewRule oneIssuePerModule = repo.createRule(OneIssuePerModuleSensor.RULE_KEY).setName("One Issue Per Module")
.setHtmlDescription("Generate an issue on each module");
- oneIssuePerModule.setDebtSubCharacteristic(RulesDefinition.SubCharacteristics.API_ABUSE)
+ oneIssuePerModule
.setDebtRemediationFunction(hasTag.debtRemediationFunctions().linearWithOffset("25min", "1h"))
.setEffortToFixDescription("A certified architect will need roughly half an hour to start working on removal of modules, " +
"then it's about one hour per module.");
.addTags("bad-practice")
.setHtmlDescription("An issue is created on a file as soon as the branch coverage on this file is less than the required threshold."
+ "It gives the number of branches to be covered in order to reach the required threshold.")
- .setDebtSubCharacteristic(RulesDefinition.SubCharacteristics.UNIT_TESTABILITY)
.setDebtRemediationFunction(rule.debtRemediationFunctions().linear("5min"))
.setEffortToFixDescription("number of uncovered conditions")
.setSeverity(Severity.MAJOR);
.addTags("bad-practice")
.setHtmlDescription("An issue is created on a file as soon as the line coverage on this file is less than the required threshold. " +
"It gives the number of lines to be covered in order to reach the required threshold.")
- .setDebtSubCharacteristic(RulesDefinition.SubCharacteristics.UNIT_TESTABILITY)
.setDebtRemediationFunction(rule.debtRemediationFunctions().linear("2min"))
.setEffortToFixDescription("number of lines under the coverage threshold")
.setSeverity(Severity.MAJOR);
.addTags("convention")
.setHtmlDescription("An issue is created on a file as soon as the density of comment lines on this file is less than the required threshold. " +
"The number of comment lines to be written in order to reach the required threshold is provided by each issue message.")
- .setDebtSubCharacteristic(RulesDefinition.SubCharacteristics.UNDERSTANDABILITY)
.setDebtRemediationFunction(rule.debtRemediationFunctions().linear("2min"))
.setEffortToFixDescription("number of lines required to meet minimum density")
.setSeverity(Severity.MAJOR);
rule.setName("Source files should not have any duplicated blocks")
.addTags("pitfall")
.setHtmlDescription("An issue is created on a file as soon as there is at least one block of duplicated code on this file")
- .setDebtSubCharacteristic(RulesDefinition.SubCharacteristics.LOGIC_CHANGEABILITY)
.setDebtRemediationFunction(rule.debtRemediationFunctions().linearWithOffset("10min", "10min"))
.setEffortToFixDescription("number of duplicate blocks")
.setSeverity(Severity.MAJOR);
.addTags("bug")
.setHtmlDescription(
"Test failures or errors generally indicate that regressions have been introduced. Those tests should be handled as soon as possible to reduce the cost to fix the corresponding regressions.")
- .setDebtSubCharacteristic(RulesDefinition.SubCharacteristics.UNIT_TESTABILITY)
.setDebtRemediationFunction(rule.debtRemediationFunctions().linear("10min"))
.setEffortToFixDescription("number of failed tests")
.setSeverity(Severity.MAJOR);
rule.setName("Skipped unit tests should be either removed or fixed")
.addTags("pitfall")
.setHtmlDescription("Skipped unit tests are considered as dead code. Either they should be activated again (and updated) or they should be removed.")
- .setDebtSubCharacteristic(RulesDefinition.SubCharacteristics.UNIT_TESTABILITY)
.setDebtRemediationFunction(rule.debtRemediationFunctions().linear("10min"))
.setEffortToFixDescription("number of skipped tests")
.setSeverity(Severity.MAJOR);
.setTemplate(true)
.setInternalKey("new_internal");
rule
- .setDebtSubCharacteristic(RulesDefinition.SubCharacteristics.INTEGRATION_TESTABILITY)
.setDebtRemediationFunction(rule.debtRemediationFunctions().linearWithOffset("1h", "30min"))
.setEffortToFixDescription("Effort");
}
.setInternalKey("config1")
.setTags("tag1", "tag2", "tag3")
.setStatus(RuleStatus.BETA)
- .setDebtSubCharacteristic("MEMORY_EFFICIENCY")
.setEffortToFixDescription("squid.S115.effortToFix");
rule1.setDebtRemediationFunction(rule1.debtRemediationFunctions().linearWithOffset("5d", "10h"));
// tag2 and tag3 removed, tag4 added
.setTags("tag1", "tag4")
.setStatus(RuleStatus.READY)
- .setDebtSubCharacteristic("MEMORY_EFFICIENCY")
.setEffortToFixDescription("squid.S115.effortToFix.v2");
rule1.setDebtRemediationFunction(rule1.debtRemediationFunctions().linearWithOffset("6d", "2h"));
rule1.createParam("param1").setDescription("parameter one v2").setDefaultValue("default1 v2");