Ejemplo n.º 1
0
 public boolean setTechnicalDebt(DefaultIssue issue, @Nullable Duration value, IssueChangeContext context) {
   Duration oldValue = issue.debt();
   if (!Objects.equal(value, oldValue)) {
     issue.setDebt(value != null ? value : null);
     issue.setFieldChange(context, TECHNICAL_DEBT, oldValue != null ? oldValue.toMinutes() : null, value != null ? value.toMinutes() : null);
     issue.setUpdateDate(context.date());
     issue.setChanged(true);
     return true;
   }
   return false;
 }
Ejemplo n.º 2
0
 private void updateIssue(DefaultIssue issue, Rule rule, ActiveRule activeRule) {
   if (Strings.isNullOrEmpty(issue.message())) {
     issue.setMessage(rule.name());
   }
   issue.setCreationDate(project.getAnalysisDate());
   issue.setUpdateDate(project.getAnalysisDate());
   if (issue.severity() == null) {
     issue.setSeverity(activeRule.severity());
   }
   DebtRemediationFunction function = rule.debtRemediationFunction();
   if (rule.debtSubCharacteristic() != null && function != null) {
     issue.setDebt(calculateDebt(function, issue.effortToFix(), rule.key()));
   }
 }
Ejemplo n.º 3
0
 public boolean setPastTechnicalDebt(DefaultIssue issue, @Nullable Duration previousTechnicalDebt, IssueChangeContext context) {
   Duration currentTechnicalDebt = issue.debt();
   issue.setDebt(previousTechnicalDebt);
   return setTechnicalDebt(issue, currentTechnicalDebt, context);
 }