assertThat(repo.isExternal()).isFalse();
RulesDefinition.Repository repo = context.repository("external_eslint"); assertThat(repo.rules()).hasSize(2); assertThat(repo.isExternal()).isTrue();
@Test public void test_external_repositories() { GoRulesDefinition rulesDefinition = new GoRulesDefinition(true); RulesDefinition.Context context = new RulesDefinition.Context(); rulesDefinition.define(context); RulesDefinition.Repository golintRepository = context.repository("external_golint"); RulesDefinition.Repository govetRepository = context.repository("external_govet"); assertThat(context.repositories()).hasSize(3); assertThat(golintRepository.name()).isEqualTo("Golint"); assertThat(govetRepository.name()).isEqualTo("go vet"); assertThat(golintRepository.language()).isEqualTo("go"); assertThat(govetRepository.language()).isEqualTo("go"); assertThat(golintRepository.isExternal()).isEqualTo(true); assertThat(govetRepository.isExternal()).isEqualTo(true); assertThat(golintRepository.rules().size()).isEqualTo(18); assertThat(ExternalKeyUtils.GO_LINT_KEYS.size()).isEqualTo(18); assertThat(govetRepository.rules().size()).isEqualTo(21); assertThat(ExternalKeyUtils.GO_VET_KEYS.size()).isEqualTo(21); List<String> govetKeysWithoutDefinition = ExternalKeyUtils.GO_VET_KEYS.stream() .map(x -> x.key) .filter(key -> govetRepository.rule(key) == null) .collect(Collectors.toList()); assertThat(govetKeysWithoutDefinition).isEmpty(); List<String> golintKeysWithoutDefinition = ExternalKeyUtils.GO_LINT_KEYS.stream() .map(x -> x.key) .filter(key -> golintRepository.rule(key) == null) .collect(Collectors.toList()); assertThat(golintKeysWithoutDefinition).isEmpty(); }
.setType(RuleType.valueOf(ruleDef.type().name())) .setScope(toDtoScope(ruleDef.scope())) .setIsExternal(ruleDef.repository().isExternal()) .setCreatedAt(system2.now()) .setUpdatedAt(system2.now());
.setType(RuleType.valueOf(ruleDef.type().name())) .setScope(toDtoScope(ruleDef.scope())) .setIsExternal(ruleDef.repository().isExternal()) .setIsAdHoc(false) .setCreatedAt(system2.now())