如何为SQALE修复功能为线性的规则设置技术债



我试图将技术债务问题与SQALE补救功能是线性的规则相违背。我将https://github.com/SonarCommunity/sonar-css/blame/master/css-checks/src/main/java/org/sonar/css/checks/ImportNumberThreshold.java#L71替换为

CheckMessage checkMessage = new CheckMessage(this,
    "Reduce the number of @import. This sheet imports {0,number,integer} other sheets, "
      + "{1,number,integer} more than the {2,number,integer} maximum.", currentImportCount,
    currentImportCount - DEFAULT_THRESHOLD, DEFAULT_THRESHOLD);
  checkMessage.setCost(1000.0);
  getContext().log(checkMessage);

,但它没有将技术债务设置为1,000分钟。无论超过限制的导入次数是多少,每个问题的技术债务都保持10分钟。

在我的测试文件中,以下断言是绿色的:
   CheckMessagesVerifier.verify(file.getCheckMessages()).next()
  .withMessage("Reduce the number of @import. This sheet imports 32 other sheets, 1 more than the 31 maximum.")
  .withCost(Double.valueOf(1000.0))
  .noMore();

我错过了什么?

谢谢你的帮助!

您需要提供EffortToFix值。查看以下代码查看示例:https://github.com/SonarSource/sonar-java/blob/master/java-checks/src/main/java/org/sonar/java/checks/MethodComplexityCheck.java

最新更新