@Test public void testDefineWithNonExistingRules() { MyRulesDefinition rulesDefinition = new MyRulesDefinition("no-rules"); RulesDefinition.Context context = new RulesDefinition.Context(); rulesDefinition.define(context); RulesDefinition.Repository repository = context.repository(AnsibleCheckRepository.REPOSITORY_KEY); assertTrue(repository.rules().isEmpty()); assertTrue(logTester.logs(LoggerLevel.INFO).contains("No Ansible Lint rules found")); }
@Override public void define(RulesDefinition.Context context) { RulesDefinition.NewRepository repository = context.createRepository(AnsibleCheckRepository.REPOSITORY_KEY, YamlLanguage.KEY).setName(AnsibleCheckRepository.REPOSITORY_NAME); RuleMetadataLoader metadataLoader = new RuleMetadataLoader(getRuleDefinitionPath()); List<String> keys = new ArrayList<>(); getRuleKeys().forEach(keys::add); metadataLoader.addRulesByRuleKey(repository, keys); repository.done(); }
AbstractAnsibleRulesDefinition implements RulesDefinition { @Override public void define(RulesDefinition.Context context) { RulesDefinition.NewRepository repository = context.createRepository(AnsibleCheckRepository.REPOSITORY_KEY, YamlLanguage.KEY).setName(AnsibleCheckRepository.REPOSITORY_NAME); RuleMetadataLoader metadataLoader = new RuleMetadataLoader(getRuleDefinitionPath()); List<String> keys = new ArrayList<>(); getRuleKeys().forEach(keys::add); metadataLoader.addRulesByRuleKey(repository, keys); repository.done(); } }
AbstractAnsibleRulesDefinition implements RulesDefinition { @Override public void define(RulesDefinition.Context context) { RulesDefinition.NewRepository repository = context.createRepository(AnsibleCheckRepository.REPOSITORY_KEY, YamlLanguage.KEY).setName(AnsibleCheckRepository.REPOSITORY_NAME); RuleMetadataLoader metadataLoader = new RuleMetadataLoader(getRuleDefinitionPath()); List<String> keys = new ArrayList<>(); getRuleKeys().forEach(keys::add); metadataLoader.addRulesByRuleKey(repository, keys); repository.done(); }  }
AbstractAnsibleRulesDefinition implements RulesDefinition { @Override public void define(RulesDefinition.Context context) { RulesDefinition.NewRepository repository = context.createRepository(AnsibleCheckRepository.REPOSITORY_KEY, YamlLanguage.KEY).setName(AnsibleCheckRepository.REPOSITORY_NAME); RuleMetadataLoader metadataLoader = new RuleMetadataLoader(getRuleDefinitionPath()); List<String> keys = new ArrayList<>(); getRuleKeys().forEach(keys::add); metadataLoader.addRulesByRuleKey(repository, keys); repository.done(); }  @Override void define(RulesDefinition.Context context); }
AbstractAnsibleRulesDefinition implements RulesDefinition { @Override public void define(RulesDefinition.Context context) { RulesDefinition.NewRepository repository = context.createRepository(AnsibleCheckRepository.REPOSITORY_KEY, YamlLanguage.KEY).setName(AnsibleCheckRepository.REPOSITORY_NAME); RuleMetadataLoader metadataLoader = new RuleMetadataLoader(getRuleDefinitionPath()); List<String> keys = new ArrayList<>(); getRuleKeys().forEach(keys::add); metadataLoader.addRulesByRuleKey(repository, keys); repository.done(); }  @Override void define(RulesDefinition.Context context);  }