@Test public void foo() { SolidityRulesDefinition rulesDefinition = new SolidityRulesDefinition(false); RulesDefinition.Context context = new RulesDefinition.Context(); rulesDefinition.define(context); context.createRepository(Solidity.KEY, "solidity"); RulesDefinition.Repository repository = context.repository(SolidityRulesDefinition.REPO_KEY); assertThat(repository.name()).isEqualTo(SolidityRulesDefinition.REPO_NAME); assertThat(repository.language()).isEqualTo("solidity"); assertThat(repository.rules()).hasSize(24); List<Rule> activated = repository.rules().stream().filter(x -> x.status().name().equals("READY")).collect(Collectors.toList()); assertThat(activated).isNotEmpty(); assertThat(activated.size()).isEqualTo(24); }
@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; }