@Test public void test_external() { SolidityRulesDefinition rulesDefinition = new SolidityRulesDefinition(true); RulesDefinition.Context context = new RulesDefinition.Context(); rulesDefinition.define(context); context.createRepository(Solidity.KEY, "solidity"); RulesDefinition.Repository soliumRepository = context.repository("external_solium"); assertThat(context.repositories()).hasSize(2); assertThat(soliumRepository.isExternal()).isTrue(); assertThat(soliumRepository.name()).isEqualTo("Solium"); assertThat(soliumRepository.language()).isEqualTo("solidity"); assertThat(soliumRepository.rules()).hasSize(45); }
@Override public void define(Context context) { NewRepository repository = context .createRepository(SolidityRulesDefinition.REPO_KEY, Solidity.KEY) .setName(SolidityRulesDefinition.REPO_NAME); RuleMetadataLoader ruleMetadataLoader = new RuleMetadataLoader("org/sonar/l10n/solidity/rules/solidity", SolidityProfile.SONAR_WAY_PROFILE_PATH); ruleMetadataLoader.addRulesByAnnotatedClass(repository, CheckList.returnChecks()); repository.done(); if (externalIssuesSupported) { AbstractExternalReportSensor.createExternalRuleRepository(context, SoliumReportSensor.LINTER_ID, SoliumReportSensor.LINTER_NAME); } }
SolidityRulesDefinition implements RulesDefinition { @Override public void define(Context context) { NewRepository repository = context .createRepository(SolidityRulesDefinition.REPO_KEY, Solidity.KEY) .setName(SolidityRulesDefinition.REPO_NAME); RuleMetadataLoader ruleMetadataLoader = new RuleMetadataLoader("org/sonar/l10n/solidity/rules/solidity", SolidityProfile.SONAR_WAY_PROFILE_PATH); ruleMetadataLoader.addRulesByAnnotatedClass(repository, CheckList.returnChecks()); repository.done(); if (externalIssuesSupported) { AbstractExternalReportSensor.createExternalRuleRepository(context, SoliumReportSensor.LINTER_ID, SoliumReportSensor.LINTER_NAME); } } }
SolidityRulesDefinition implements RulesDefinition { @Override public void define(Context context) { NewRepository repository = context .createRepository(SolidityRulesDefinition.REPO_KEY, Solidity.KEY) .setName(SolidityRulesDefinition.REPO_NAME); RuleMetadataLoader ruleMetadataLoader = new RuleMetadataLoader("org/sonar/l10n/solidity/rules/solidity", SolidityProfile.SONAR_WAY_PROFILE_PATH); ruleMetadataLoader.addRulesByAnnotatedClass(repository, CheckList.returnChecks()); repository.done(); if (externalIssuesSupported) { AbstractExternalReportSensor.createExternalRuleRepository(context, SoliumReportSensor.LINTER_ID, SoliumReportSensor.LINTER_NAME); } } SolidityRulesDefinition(boolean reportExternalIssues); }
SolidityRulesDefinition implements RulesDefinition { @Override public void define(Context context) { NewRepository repository = context .createRepository(SolidityRulesDefinition.REPO_KEY, Solidity.KEY) .setName(SolidityRulesDefinition.REPO_NAME); RuleMetadataLoader ruleMetadataLoader = new RuleMetadataLoader("org/sonar/l10n/solidity/rules/solidity", SolidityProfile.SONAR_WAY_PROFILE_PATH); ruleMetadataLoader.addRulesByAnnotatedClass(repository, CheckList.returnChecks()); repository.done(); if (externalIssuesSupported) { AbstractExternalReportSensor.createExternalRuleRepository(context, SoliumReportSensor.LINTER_ID, SoliumReportSensor.LINTER_NAME); } } SolidityRulesDefinition(boolean reportExternalIssues); @Override void define(Context context); }
SolidityRulesDefinition implements RulesDefinition { @Override public void define(Context context) { NewRepository repository = context .createRepository(SolidityRulesDefinition.REPO_KEY, Solidity.KEY) .setName(SolidityRulesDefinition.REPO_NAME); RuleMetadataLoader ruleMetadataLoader = new RuleMetadataLoader("org/sonar/l10n/solidity/rules/solidity", SolidityProfile.SONAR_WAY_PROFILE_PATH); ruleMetadataLoader.addRulesByAnnotatedClass(repository, CheckList.returnChecks()); repository.done(); if (externalIssuesSupported) { AbstractExternalReportSensor.createExternalRuleRepository(context, SoliumReportSensor.LINTER_ID, SoliumReportSensor.LINTER_NAME); } } SolidityRulesDefinition(boolean reportExternalIssues); @Override void define(Context context); static final String REPO_KEY; }