@Test public void test_external_repositories() { TslintRulesDefinition rulesDefinition = new TslintRulesDefinition(); RulesDefinition.Context context = new RulesDefinition.Context(); rulesDefinition.define(context); RulesDefinition.Repository tslintRepository = context.repository("external_tslint_repo"); assertThat(context.repositories()).hasSize(1); assertThat(tslintRepository.name()).isEqualTo("TSLint"); assertThat(tslintRepository.language()).isEqualTo("ts"); assertThat(tslintRepository.isExternal()).isEqualTo(true); assertThat(tslintRepository.rules().size()).isGreaterThan(NUMBER_TSLINT_RULES); RulesDefinition.Rule tsLintRule = tslintRepository.rule("adjacent-overload-signatures"); assertThat(tsLintRule).isNotNull(); assertThat(tsLintRule.name()).isEqualTo("Enforces function overloads to be consecutive."); assertThat(tsLintRule.type()).isEqualTo(RuleType.CODE_SMELL); assertThat(tsLintRule.severity()).isEqualTo("MAJOR"); String adjacentOverloadSignaturesDoc = "https: assertThat(tsLintRule.htmlDescription()) .isEqualTo("See description of TSLint rule <code>adjacent-overload-signatures</code> at the <a href=\"" + adjacentOverloadSignaturesDoc + "\">TSLint website</a>."); assertThat(tsLintRule.tags()).isEmpty(); assertThat(tsLintRule.debtRemediationFunction().baseEffort()).isEqualTo("5min"); RulesDefinition.Rule sonartsRule = tslintRepository.rule("cognitive-complexity"); assertThat(sonartsRule).isNotNull(); assertThat(sonartsRule.name()).isEqualTo("Cognitive Complexity of functions should not be too high"); assertThat(sonartsRule.type()).isEqualTo(RuleType.CODE_SMELL); assertThat(sonartsRule.severity()).isEqualTo("MAJOR"); String cognitiveComplexityDoc = "https: assertThat(sonartsRule.htmlDescription()) .isEqualTo("See description of tslint-sonarts rule <code>cognitive-complexity</code> at the <a href=\"" + cognitiveComplexityDoc + "\">tslint-sonarts website</a>."); assertThat(sonartsRule.tags()).isEmpty(); assertThat(sonartsRule.debtRemediationFunction().baseEffort()).isEqualTo("5min"); }
@Override public void define(Context context) { RULE_LOADERS.forEach(ruleLoader -> ruleLoader.createExternalRuleRepository(context)); }
TslintRulesDefinition implements RulesDefinition { @Override public void define(Context context) { RULE_LOADERS.forEach(ruleLoader -> ruleLoader.createExternalRuleRepository(context)); } }
TslintRulesDefinition implements RulesDefinition { @Override public void define(Context context) { RULE_LOADERS.forEach(ruleLoader -> ruleLoader.createExternalRuleRepository(context)); }  }
TslintRulesDefinition implements RulesDefinition { @Override public void define(Context context) { RULE_LOADERS.forEach(ruleLoader -> ruleLoader.createExternalRuleRepository(context)); }  @Override void define(Context context); static RuleType ruleType(String ruleKey); }
TslintRulesDefinition implements RulesDefinition { @Override public void define(Context context) { RULE_LOADERS.forEach(ruleLoader -> ruleLoader.createExternalRuleRepository(context)); }  @Override void define(Context context); static RuleType ruleType(String ruleKey); static final String REPOSITORY_KEY; static final String LINTER_NAME; }