Java Code Examples for org.sonar.api.server.debt.DebtRemediationFunction#Type
The following examples show how to use
org.sonar.api.server.debt.DebtRemediationFunction#Type .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TsLintRule.java From SonarTsPlugin with MIT License | 6 votes |
public TsLintRule( String key, String severity, String name, String htmlDescription, DebtRemediationFunction.Type debtRemediationFunction, String debtRemediationScalar, String debtRemediationOffset, String debtType ) { this.key = key; this.severity = severity; this.name = name; this.htmlDescription = htmlDescription; this.hasDebtRemediation = true; this.debtRemediationFunction = debtRemediationFunction; this.debtRemediationScalar = debtRemediationScalar; this.debtRemediationOffset = debtRemediationOffset; this.debtType = debtType; }
Example 2
Source File: TsRulesDefinition.java From SonarTsPlugin with MIT License | 4 votes |
public static void loadRules(InputStream stream, List<TsLintRule> rulesCollection) { Properties properties = new Properties(); try { properties.load(stream); } catch (IOException e) { LOG.error("Error while loading TsLint rules", e); } for(String propKey : properties.stringPropertyNames()) { if (propKey.contains(".")) { continue; } String ruleEnabled = properties.getProperty(propKey); if (!"true".equals(ruleEnabled)) { continue; } String ruleId = propKey; String ruleName = properties.getProperty(propKey + ".name", ruleId.replace("-", " ")); String ruleSeverity = properties.getProperty(propKey + ".severity", DEFAULT_RULE_SEVERITY); String ruleDescription = properties.getProperty(propKey + ".description", DEFAULT_RULE_DESCRIPTION); String debtRemediationFunction = properties.getProperty(propKey + ".debtFunc", null); String debtRemediationScalar = properties.getProperty(propKey + ".debtScalar", DEFAULT_RULE_DEBT_SCALAR); String debtRemediationOffset = properties.getProperty(propKey + ".debtOffset", DEFAULT_RULE_DEBT_OFFSET); String debtType = properties.getProperty(propKey + ".debtType", DEFAULT_RULE_DEBT_TYPE); TsLintRule tsRule = null; // try to apply the specified debt remediation function if (debtRemediationFunction != null) { DebtRemediationFunction.Type debtRemediationFunctionEnum = DebtRemediationFunction.Type.valueOf(debtRemediationFunction); tsRule = new TsLintRule( ruleId, ruleSeverity, ruleName, ruleDescription, debtRemediationFunctionEnum, debtRemediationScalar, debtRemediationOffset, debtType ); } // no debt remediation function specified if (tsRule == null) { tsRule = new TsLintRule( ruleId, ruleSeverity, ruleName, ruleDescription ); } rulesCollection.add(tsRule); } Collections.sort(rulesCollection, (TsLintRule r1, TsLintRule r2) -> r1.key.compareTo(r2.key)); }