@Test public void testMapLinearDefault() { FoundMatch match = new FoundMatch(); match.sqlRules = new SqlRules(); match.rule = new Rule(); match.rule.setRemediationFunction("LINEAR"); match.rule.setDebtRemediationFunctionCoefficient("1h 10min"); SqlIssue issue = IssuesProvider.mapToSqlIssue(match); Assert.assertEquals(70, issue.getDebtRemediationEffort()); }
protected static SqlIssue mapToSqlIssue(FoundMatch m) { SqlIssue e = new SqlIssue(); e.repo = m.sqlRules.getRepoKey(); e.line = m.getLine(); try { if (StringUtils.equalsIgnoreCase("LINEAR", m.rule.getRemediationFunction()) && !StringUtils.isBlank(m.rule.getDebtRemediationFunctionCoefficient())) { e.debtRemediationEffort = org.sonar.api.utils.Duration .decode(m.rule.getDebtRemediationFunctionCoefficient(), 8).toMinutes(); } } catch (Exception p) { } e.description = m.rule.getDescription(); e.ruleType = m.rule.getRuleType(); e.key = m.rule.getKey(); e.severity = m.rule.getSeverity(); e.isAdhoc = m.sqlRules.isIsAdhoc(); e.message = m.rule.getRuleImplementation().getRuleViolationMessage(); e.name = m.rule.getName(); e.isExternal = m.sqlRules.getIsExternal(); return e; }
IssuesProvider { protected static SqlIssue mapToSqlIssue(FoundMatch m) { SqlIssue e = new SqlIssue(); e.repo = m.sqlRules.getRepoKey(); e.line = m.getLine(); try { if (StringUtils.equalsIgnoreCase("LINEAR", m.rule.getRemediationFunction()) && !StringUtils.isBlank(m.rule.getDebtRemediationFunctionCoefficient())) { e.debtRemediationEffort = org.sonar.api.utils.Duration .decode(m.rule.getDebtRemediationFunctionCoefficient(), 8).toMinutes(); } } catch (Exception p) { } e.description = m.rule.getDescription(); e.ruleType = m.rule.getRuleType(); e.key = m.rule.getKey(); e.severity = m.rule.getSeverity(); e.isAdhoc = m.sqlRules.isIsAdhoc(); e.message = m.rule.getRuleImplementation().getRuleViolationMessage(); e.name = m.rule.getName(); e.isExternal = m.sqlRules.getIsExternal(); return e; } }
IssuesProvider { protected static SqlIssue mapToSqlIssue(FoundMatch m) { SqlIssue e = new SqlIssue(); e.repo = m.sqlRules.getRepoKey(); e.line = m.getLine(); try { if (StringUtils.equalsIgnoreCase("LINEAR", m.rule.getRemediationFunction()) && !StringUtils.isBlank(m.rule.getDebtRemediationFunctionCoefficient())) { e.debtRemediationEffort = org.sonar.api.utils.Duration .decode(m.rule.getDebtRemediationFunctionCoefficient(), 8).toMinutes(); } } catch (Exception p) { } e.description = m.rule.getDescription(); e.ruleType = m.rule.getRuleType(); e.key = m.rule.getKey(); e.severity = m.rule.getSeverity(); e.isAdhoc = m.sqlRules.isIsAdhoc(); e.message = m.rule.getRuleImplementation().getRuleViolationMessage(); e.name = m.rule.getName(); e.isExternal = m.sqlRules.getIsExternal(); return e; }  }
IssuesProvider { protected static SqlIssue mapToSqlIssue(FoundMatch m) { SqlIssue e = new SqlIssue(); e.repo = m.sqlRules.getRepoKey(); e.line = m.getLine(); try { if (StringUtils.equalsIgnoreCase("LINEAR", m.rule.getRemediationFunction()) && !StringUtils.isBlank(m.rule.getDebtRemediationFunctionCoefficient())) { e.debtRemediationEffort = org.sonar.api.utils.Duration .decode(m.rule.getDebtRemediationFunctionCoefficient(), 8).toMinutes(); } } catch (Exception p) { } e.description = m.rule.getDescription(); e.ruleType = m.rule.getRuleType(); e.key = m.rule.getKey(); e.severity = m.rule.getSeverity(); e.isAdhoc = m.sqlRules.isIsAdhoc(); e.message = m.rule.getRuleImplementation().getRuleViolationMessage(); e.name = m.rule.getName(); e.isExternal = m.sqlRules.getIsExternal(); return e; }  SqlIssuesList analyze(AntlrContext ctx); }
IssuesProvider { protected static SqlIssue mapToSqlIssue(FoundMatch m) { SqlIssue e = new SqlIssue(); e.repo = m.sqlRules.getRepoKey(); e.line = m.getLine(); try { if (StringUtils.equalsIgnoreCase("LINEAR", m.rule.getRemediationFunction()) && !StringUtils.isBlank(m.rule.getDebtRemediationFunctionCoefficient())) { e.debtRemediationEffort = org.sonar.api.utils.Duration .decode(m.rule.getDebtRemediationFunctionCoefficient(), 8).toMinutes(); } } catch (Exception p) { } e.description = m.rule.getDescription(); e.ruleType = m.rule.getRuleType(); e.key = m.rule.getKey(); e.severity = m.rule.getSeverity(); e.isAdhoc = m.sqlRules.isIsAdhoc(); e.message = m.rule.getRuleImplementation().getRuleViolationMessage(); e.name = m.rule.getName(); e.isExternal = m.sqlRules.getIsExternal(); return e; }  SqlIssuesList analyze(AntlrContext ctx);  }