diff options
41 files changed, 161 insertions, 162 deletions
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/UpdateConflictResolverTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/UpdateConflictResolverTest.java index e1924045dc5..027a48630ef 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/UpdateConflictResolverTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/UpdateConflictResolverTest.java @@ -42,7 +42,7 @@ public class UpdateConflictResolverTest { DefaultIssue issue = new DefaultIssue() .setKey("ABCDE") .setType(CODE_SMELL) - .setRuleKey(RuleKey.of("squid", "AvoidCycles")) + .setRuleKey(RuleKey.of("java", "AvoidCycles")) .setProjectUuid("U1") .setComponentUuid("U2") .setNew(false) @@ -54,7 +54,7 @@ public class UpdateConflictResolverTest { .setKee("ABCDE") .setType(CODE_SMELL) .setRuleUuid("uuid-10") - .setRuleKey("squid", "AvoidCycles") + .setRuleKey("java", "AvoidCycles") .setProjectUuid("U1") .setComponentUuid("U2") .setLine(10) @@ -76,7 +76,7 @@ public class UpdateConflictResolverTest { public void should_keep_changes_made_by_user() { DefaultIssue issue = new DefaultIssue() .setKey("ABCDE") - .setRuleKey(RuleKey.of("squid", "AvoidCycles")) + .setRuleKey(RuleKey.of("java", "AvoidCycles")) .setComponentKey("struts:org.apache.struts.Action") .setNew(false); @@ -98,7 +98,7 @@ public class UpdateConflictResolverTest { IssueDto dbIssue = new IssueDto() .setKee("ABCDE") .setRuleUuid("uuid-10") - .setRuleKey("squid", "AvoidCycles") + .setRuleKey("java", "AvoidCycles") .setComponentUuid("100") .setComponentKey("struts:org.apache.struts.Action") .setLine(10) @@ -128,7 +128,7 @@ public class UpdateConflictResolverTest { public void severity_changed_by_user_should_be_kept() { DefaultIssue issue = new DefaultIssue() .setKey("ABCDE") - .setRuleKey(RuleKey.of("squid", "AvoidCycles")) + .setRuleKey(RuleKey.of("java", "AvoidCycles")) .setComponentKey("struts:org.apache.struts.Action") .setNew(false) .setStatus(STATUS_OPEN); diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/qualityprofile/ActiveRulesHolderImplTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/qualityprofile/ActiveRulesHolderImplTest.java index b7f59f8d85c..eda34de4e22 100644 --- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/qualityprofile/ActiveRulesHolderImplTest.java +++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/qualityprofile/ActiveRulesHolderImplTest.java @@ -35,7 +35,7 @@ public class ActiveRulesHolderImplTest { private static final long SOME_DATE = 1_000L; - static final RuleKey RULE_KEY = RuleKey.of("squid", "S001"); + static final RuleKey RULE_KEY = RuleKey.of("java", "S001"); private static final String QP_KEY = "qp1"; @@ -83,6 +83,6 @@ public class ActiveRulesHolderImplTest { new ActiveRule(RULE_KEY, Severity.MAJOR, Collections.emptyMap(), SOME_DATE, PLUGIN_KEY, QP_KEY))); }) .isInstanceOf(IllegalArgumentException.class) - .hasMessage("Active rule must not be declared multiple times: squid:S001"); + .hasMessage("Active rule must not be declared multiple times: java:S001"); } } diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/qualityprofile/ActiveRuleKey.java b/server/sonar-db-dao/src/main/java/org/sonar/db/qualityprofile/ActiveRuleKey.java index 47496728415..8a27b67b73b 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/qualityprofile/ActiveRuleKey.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/qualityprofile/ActiveRuleKey.java @@ -97,7 +97,7 @@ public class ActiveRuleKey implements Serializable, Comparable<ActiveRuleKey> { } /** - * Format is "qprofile:rule", for example "12345:squid:AvoidCycle" + * Format is "qprofile:rule", for example "12345:java:AvoidCycle" */ @Override public String toString() { diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/issue/IssueDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/issue/IssueDaoTest.java index 941a2b31b1d..dfc724861a9 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/issue/IssueDaoTest.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/issue/IssueDaoTest.java @@ -612,7 +612,7 @@ public class IssueDaoTest { IssueDto dto = new IssueDto(); dto.setComponent(new ComponentDto().setDbKey("struts:Action").setUuid("component-uuid")); dto.setProject(new ComponentDto().setDbKey("struts").setUuid("project-uuid")); - dto.setRule(RuleTesting.newRule(RuleKey.of("squid", "S001")).setUuid("uuid-200")); + dto.setRule(RuleTesting.newRule(RuleKey.of("java", "S001")).setUuid("uuid-200")); dto.setKee(key); dto.setType(2); dto.setLine(500); diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/issue/IssueDtoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/issue/IssueDtoTest.java index 58c74d9bf62..cacc799d7a2 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/issue/IssueDtoTest.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/issue/IssueDtoTest.java @@ -48,7 +48,7 @@ public class IssueDtoTest { .setKee("100") .setType(RuleType.VULNERABILITY) .setRuleUuid("rule-uuid-1") - .setRuleKey("squid", "AvoidCycle") + .setRuleKey("java", "AvoidCycle") .setLanguage("xoo") .setComponentKey("org.sonar.sample:Sample") .setComponentUuid("CDEF") @@ -72,7 +72,7 @@ public class IssueDtoTest { DefaultIssue issue = dto.toDefaultIssue(); assertThat(issue.key()).isEqualTo("100"); assertThat(issue.type()).isEqualTo(RuleType.VULNERABILITY); - assertThat(issue.ruleKey()).hasToString("squid:AvoidCycle"); + assertThat(issue.ruleKey()).hasToString("java:AvoidCycle"); assertThat(issue.language()).isEqualTo("xoo"); assertThat(issue.componentUuid()).isEqualTo("CDEF"); assertThat(issue.projectUuid()).isEqualTo("GHIJ"); @@ -100,13 +100,13 @@ public class IssueDtoTest { public void set_rule() { IssueDto dto = new IssueDto() .setKee("100") - .setRule(new RuleDto().setUuid("uuid-1").setRuleKey("AvoidCycle").setRepositoryKey("squid").setIsExternal(true)) + .setRule(new RuleDto().setUuid("uuid-1").setRuleKey("AvoidCycle").setRepositoryKey("java").setIsExternal(true)) .setLanguage("xoo"); assertThat(dto.getRuleUuid()).isEqualTo("uuid-1"); - assertThat(dto.getRuleRepo()).isEqualTo("squid"); + assertThat(dto.getRuleRepo()).isEqualTo("java"); assertThat(dto.getRule()).isEqualTo("AvoidCycle"); - assertThat(dto.getRuleKey()).hasToString("squid:AvoidCycle"); + assertThat(dto.getRuleKey()).hasToString("java:AvoidCycle"); assertThat(dto.getLanguage()).isEqualTo("xoo"); assertThat(dto.isExternal()).isTrue(); } diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/qualityprofile/ActiveRuleKeyTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/qualityprofile/ActiveRuleKeyTest.java index 809d2331c46..b217e50e712 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/qualityprofile/ActiveRuleKeyTest.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/qualityprofile/ActiveRuleKeyTest.java @@ -40,12 +40,12 @@ public class ActiveRuleKeyTest { @Test public void rule_key_can_contain_colons() { - RuleKey ruleKey = RuleKey.of("squid", "Key:With:Some::Colons"); + RuleKey ruleKey = RuleKey.of("java", "Key:With:Some::Colons"); QProfileDto profile = newQualityProfileDto(); ActiveRuleKey key = ActiveRuleKey.of(profile, ruleKey); assertThat(key.getRuleProfileUuid()).isEqualTo(profile.getRulesProfileUuid()); assertThat(key.getRuleKey()).isSameAs(ruleKey); - assertThat(key.toString()).isEqualTo(profile.getRulesProfileUuid() + ":squid:Key:With:Some::Colons"); + assertThat(key.toString()).isEqualTo(profile.getRulesProfileUuid() + ":java:Key:With:Some::Colons"); } @Test diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/rule/RuleDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/rule/RuleDaoTest.java index bea1f12db93..0405c7eaa55 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/rule/RuleDaoTest.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/rule/RuleDaoTest.java @@ -451,7 +451,7 @@ public class RuleDaoTest { .setDefRemediationFunction(DebtRemediationFunction.Type.LINEAR_OFFSET.toString()) .setDefRemediationGapMultiplier("5d") .setDefRemediationBaseEffort("10h") - .setGapDescription("squid.S115.effortToFix") + .setGapDescription("java.S115.effortToFix") .setSystemTags(newHashSet("systag1", "systag2")) .setSecurityStandards(newHashSet("owaspTop10:a1", "cwe:123")) .setType(RuleType.BUG) @@ -477,7 +477,7 @@ public class RuleDaoTest { assertThat(ruleDto.getDefRemediationFunction()).isEqualTo("LINEAR_OFFSET"); assertThat(ruleDto.getDefRemediationGapMultiplier()).isEqualTo("5d"); assertThat(ruleDto.getDefRemediationBaseEffort()).isEqualTo("10h"); - assertThat(ruleDto.getGapDescription()).isEqualTo("squid.S115.effortToFix"); + assertThat(ruleDto.getGapDescription()).isEqualTo("java.S115.effortToFix"); assertThat(ruleDto.getSystemTags()).containsOnly("systag1", "systag2"); assertThat(ruleDto.getSecurityStandards()).containsOnly("owaspTop10:a1", "cwe:123"); assertThat(ruleDto.getScope()).isEqualTo(Scope.ALL); @@ -511,7 +511,7 @@ public class RuleDaoTest { .setDefRemediationFunction(DebtRemediationFunction.Type.LINEAR_OFFSET.toString()) .setDefRemediationGapMultiplier("5d") .setDefRemediationBaseEffort("10h") - .setGapDescription("squid.S115.effortToFix") + .setGapDescription("java.S115.effortToFix") .setSystemTags(newHashSet("systag1", "systag2")) .setSecurityStandards(newHashSet("owaspTop10:a1", "cwe:123")) .setScope(Scope.ALL) @@ -536,7 +536,7 @@ public class RuleDaoTest { assertThat(ruleDto.getDefRemediationFunction()).isEqualTo("LINEAR_OFFSET"); assertThat(ruleDto.getDefRemediationGapMultiplier()).isEqualTo("5d"); assertThat(ruleDto.getDefRemediationBaseEffort()).isEqualTo("10h"); - assertThat(ruleDto.getGapDescription()).isEqualTo("squid.S115.effortToFix"); + assertThat(ruleDto.getGapDescription()).isEqualTo("java.S115.effortToFix"); assertThat(ruleDto.getSystemTags()).containsOnly("systag1", "systag2"); assertThat(ruleDto.getSecurityStandards()).containsOnly("owaspTop10:a1", "cwe:123"); assertThat(ruleDto.getScope()).isEqualTo(Scope.ALL); diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/rule/RuleRepositoryDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/rule/RuleRepositoryDaoTest.java index a71d67502d1..b75e26632cc 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/rule/RuleRepositoryDaoTest.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/rule/RuleRepositoryDaoTest.java @@ -126,24 +126,24 @@ public class RuleRepositoryDaoTest { public void selectByLanguage() { DbSession dbSession = dbTester.getSession(); RuleRepositoryDto dto1 = new RuleRepositoryDto("findbugs", "java", "Findbugs"); - RuleRepositoryDto dto2 = new RuleRepositoryDto("squid", "java", "Java"); + RuleRepositoryDto dto2 = new RuleRepositoryDto("java", "java", "Java"); RuleRepositoryDto dto3 = new RuleRepositoryDto("cobol-lint", "cobol", "Cobol Lint"); underTest.insert(dbSession, asList(dto1, dto2, dto3)); assertThat(underTest.selectByLanguage(dbSession, "java")).extracting(RuleRepositoryDto::getKey) // ordered by key - .containsExactly("findbugs", "squid"); + .containsExactly("findbugs", "java"); } @Test public void selectAllKeys() { DbSession dbSession = dbTester.getSession(); RuleRepositoryDto dto1 = new RuleRepositoryDto("findbugs", "java", "Findbugs"); - RuleRepositoryDto dto2 = new RuleRepositoryDto("squid", "java", "Java"); + RuleRepositoryDto dto2 = new RuleRepositoryDto("java", "java", "Java"); RuleRepositoryDto dto3 = new RuleRepositoryDto("cobol-lint", "cobol", "Cobol Lint"); underTest.insert(dbSession, asList(dto1, dto2, dto3)); - assertThat(underTest.selectAllKeys(dbSession)).containsOnly("findbugs", "squid", "cobol-lint"); + assertThat(underTest.selectAllKeys(dbSession)).containsOnly("findbugs", "java", "cobol-lint"); } @Test diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/issue/workflow/IssueWorkflowTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/issue/workflow/IssueWorkflowTest.java index 5b544e53d35..02a9af9f1c1 100644 --- a/server/sonar-server-common/src/test/java/org/sonar/server/issue/workflow/IssueWorkflowTest.java +++ b/server/sonar-server-common/src/test/java/org/sonar/server/issue/workflow/IssueWorkflowTest.java @@ -397,7 +397,7 @@ public class IssueWorkflowTest { DefaultIssue issue = new DefaultIssue() .setKey("ABCDE") .setStatus(STATUS_OPEN) - .setRuleKey(RuleKey.of("squid", "AvoidCycle")) + .setRuleKey(RuleKey.of("java", "AvoidCycle")) .setAssigneeUuid("morgan"); underTest.start(); @@ -415,7 +415,7 @@ public class IssueWorkflowTest { DefaultIssue issue = new DefaultIssue() .setKey("ABCDE") .setStatus(STATUS_OPEN) - .setRuleKey(RuleKey.of("squid", "AvoidCycle")) + .setRuleKey(RuleKey.of("java", "AvoidCycle")) .setAssigneeUuid("morgan"); underTest.start(); diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/rule/index/RuleIndexDefinitionTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/rule/index/RuleIndexDefinitionTest.java index 1a9ddfb6ce8..aaf5e15f183 100644 --- a/server/sonar-server-common/src/test/java/org/sonar/server/rule/index/RuleIndexDefinitionTest.java +++ b/server/sonar-server-common/src/test/java/org/sonar/server/rule/index/RuleIndexDefinitionTest.java @@ -96,8 +96,8 @@ public class RuleIndexDefinitionTest { tester.putDocuments(TYPE_RULE, new RuleDoc(ImmutableMap.of( FIELD_RULE_UUID, "123", FIELD_RULE_HTML_DESCRIPTION, longText, - FIELD_RULE_REPOSITORY, "squid", - FIELD_RULE_KEY, "squid:S001"))); + FIELD_RULE_REPOSITORY, "java", + FIELD_RULE_KEY, "java:S001"))); assertThat(tester.countDocuments(TYPE_RULE)).isOne(); assertThat(tester.client().search(EsClient.prepareSearch(TYPE_RULE) .source(new SearchSourceBuilder() diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/rule/RegisterRulesTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/rule/RegisterRulesTest.java index 8dc72061466..fb6fb316b6c 100644 --- a/server/sonar-webserver-core/src/test/java/org/sonar/server/rule/RegisterRulesTest.java +++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/rule/RegisterRulesTest.java @@ -1202,7 +1202,7 @@ public class RegisterRulesTest { .setScope(RuleScope.ALL) .setType(RuleType.CODE_SMELL) .setStatus(RuleStatus.BETA) - .setGapDescription("squid.S115.effortToFix"); + .setGapDescription("java.S115.effortToFix"); rule1.setDebtRemediationFunction(rule1.debtRemediationFunctions().linearWithOffset("5d", "10h")); rule1.createParam("param1").setDescription("parameter one").setDefaultValue("default1"); @@ -1240,7 +1240,7 @@ public class RegisterRulesTest { .setTags("tag1", "tag4") .setType(RuleType.BUG) .setStatus(READY) - .setGapDescription("squid.S115.effortToFix.v2"); + .setGapDescription("java.S115.effortToFix.v2"); rule1.setDebtRemediationFunction(rule1.debtRemediationFunctions().linearWithOffset("6d", "2h")); rule1.createParam("param1").setDescription("parameter one v2").setDefaultValue("default1 v2"); rule1.createParam("param2").setDescription("parameter two v2").setDefaultValue("default2 v2"); diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/rule/RuleDefinitionsLoaderTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/rule/RuleDefinitionsLoaderTest.java index ef51d228f93..9e60dfc16a1 100644 --- a/server/sonar-webserver-core/src/test/java/org/sonar/server/rule/RuleDefinitionsLoaderTest.java +++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/rule/RuleDefinitionsLoaderTest.java @@ -41,12 +41,12 @@ public class RuleDefinitionsLoaderTest { CommonRuleDefinitions commonRulesDefinitions = mock(CommonRuleDefinitions.class); RulesDefinition.Context context = new RuleDefinitionsLoader(commonRulesDefinitions, mock(ServerPluginRepository.class), new RulesDefinition[] { - new FindbugsDefinitions(), new SquidDefinitions() + new FindbugsDefinitions(), new JavaDefinitions() }).load(); assertThat(context.repositories()).hasSize(2); assertThat(context.repository("findbugs")).isNotNull(); - assertThat(context.repository("squid")).isNotNull(); + assertThat(context.repository("java")).isNotNull(); } @Test @@ -54,10 +54,10 @@ public class RuleDefinitionsLoaderTest { CommonRuleDefinitions commonRulesDefinitions = new FakeCommonRuleDefinitions(); RulesDefinition.Context context = new RuleDefinitionsLoader(commonRulesDefinitions, mock(ServerPluginRepository.class), new RulesDefinition[] { - new SquidDefinitions() + new JavaDefinitions() }).load(); - assertThat(context.repositories()).extracting("key").containsOnly("squid", "common-java"); + assertThat(context.repositories()).extracting("key").containsOnly("java", "common-java"); assertThat(context.repository("common-java").rules()).extracting("key").containsOnly("InsufficientBranchCoverage"); } @@ -90,11 +90,11 @@ public class RuleDefinitionsLoaderTest { } } - static class SquidDefinitions implements RulesDefinition { + static class JavaDefinitions implements RulesDefinition { @Override public void define(Context context) { - NewRepository repo = context.createRepository("squid", "java"); - repo.setName("Squid"); + NewRepository repo = context.createRepository("java", "java"); + repo.setName("Sava"); repo.createRule("DEF") .setName("DEF") .setHtmlDescription("Description of DEF"); diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/ActivateRuleAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/ActivateRuleAction.java index 2853201598c..1049c659fb5 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/ActivateRuleAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/ActivateRuleAction.java @@ -79,7 +79,7 @@ public class ActivateRuleAction implements QProfileWsAction { activate.createParam(PARAM_RULE) .setDescription("Rule key") .setRequired(true) - .setExampleValue("squid:AvoidCycles"); + .setExampleValue("java:AvoidCycles"); activate.createParam(PARAM_SEVERITY) .setDescription(format("Severity. Ignored if parameter %s is true.", PARAM_RESET)) diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/text/RuleMacro.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/text/RuleMacro.java index 7dbada7f28d..6b1aaa4ab83 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/text/RuleMacro.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/text/RuleMacro.java @@ -29,7 +29,7 @@ class RuleMacro implements Macro { } /** - * First parameter is the repository, second one is the rule key. Exemple : {rule:squid:ArchitecturalConstraint} + * First parameter is the repository, second one is the rule key. Exemple : {rule:java:ArchitecturalConstraint} */ @Override public String getRegex() { diff --git a/server/sonar-webserver-webapi/src/main/resources/org/sonar/server/qualityprofile/ws/changelog-example.json b/server/sonar-webserver-webapi/src/main/resources/org/sonar/server/qualityprofile/ws/changelog-example.json index 50ba1e571d9..49556046226 100644 --- a/server/sonar-webserver-webapi/src/main/resources/org/sonar/server/qualityprofile/ws/changelog-example.json +++ b/server/sonar-webserver-webapi/src/main/resources/org/sonar/server/qualityprofile/ws/changelog-example.json @@ -8,7 +8,7 @@ "action" : "ACTIVATED", "authorLogin" : "anakin.skywalker", "authorName" : "Anakin Skywalker", - "ruleKey" : "squid:S2438", + "ruleKey" : "java:S2438", "ruleName" : "\"Threads\" should not be used where \"Runnables\" are expected", "params" : { "severity" : "CRITICAL" @@ -19,14 +19,14 @@ "action" : "DEACTIVATED", "authorLogin" : "padme.amidala", "authorName" : "Padme Amidala", - "ruleKey" : "squid:S2162", + "ruleKey" : "java:S2162", "ruleName" : "\"equals\" methods should be symmetric and work for subclasses" }, { "action" : "ACTIVATED", "authorLogin" : "obiwan.kenobi", "authorName" : "Obiwan Kenobi", - "ruleKey" : "squid:S00101", + "ruleKey" : "java:S00101", "ruleName" : "Class names should comply with a naming convention", "date" : "2014-09-12T15:20:46+0200", "params" : { diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/ChangelogActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/ChangelogActionTest.java index bd1270ece65..46e70c7404b 100644 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/ChangelogActionTest.java +++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/ChangelogActionTest.java @@ -320,7 +320,7 @@ public class ChangelogActionTest { String profileUuid = profile.getRulesProfileUuid(); system2.setNow(DateUtils.parseDateTime("2015-02-23T17:58:39+0100").getTime()); - RuleDto rule1 = db.rules().insert(RuleKey.of("squid", "S2438"), r -> r.setName("\"Threads\" should not be used where \"Runnables\" are expected")); + RuleDto rule1 = db.rules().insert(RuleKey.of("java", "S2438"), r -> r.setName("\"Threads\" should not be used where \"Runnables\" are expected")); UserDto user1 = db.users().insertUser(u -> u.setLogin("anakin.skywalker").setName("Anakin Skywalker")); insertChange(c -> c.setRulesProfileUuid(profileUuid) .setUserUuid(user1.getUuid()) @@ -328,7 +328,7 @@ public class ChangelogActionTest { .setData(ImmutableMap.of("severity", "CRITICAL", "ruleUuid", rule1.getUuid()))); system2.setNow(DateUtils.parseDateTime("2015-02-23T17:58:18+0100").getTime()); - RuleDto rule2 = db.rules().insert(RuleKey.of("squid", "S2162"), r -> r.setName("\"equals\" methods should be symmetric and work for subclasses")); + RuleDto rule2 = db.rules().insert(RuleKey.of("java", "S2162"), r -> r.setName("\"equals\" methods should be symmetric and work for subclasses")); UserDto user2 = db.users().insertUser(u -> u.setLogin("padme.amidala").setName("Padme Amidala")); insertChange(c -> c.setRulesProfileUuid(profileUuid) .setUserUuid(user2.getUuid()) @@ -336,7 +336,7 @@ public class ChangelogActionTest { .setData(ImmutableMap.of("ruleUuid", rule2.getUuid()))); system2.setNow(DateUtils.parseDateTime("2014-09-12T15:20:46+0200").getTime()); - RuleDto rule3 = db.rules().insert(RuleKey.of("squid", "S00101"), r -> r.setName("Class names should comply with a naming convention")); + RuleDto rule3 = db.rules().insert(RuleKey.of("java", "S00101"), r -> r.setName("Class names should comply with a naming convention")); UserDto user3 = db.users().insertUser(u -> u.setLogin("obiwan.kenobi").setName("Obiwan Kenobi")); insertChange(c -> c.setRulesProfileUuid(profileUuid) .setUserUuid(user3.getUuid()) diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/rule/RuleUpdaterTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/rule/RuleUpdaterTest.java index 6a6187d642e..7aa7deca36d 100644 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/rule/RuleUpdaterTest.java +++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/rule/RuleUpdaterTest.java @@ -57,7 +57,6 @@ import org.sonar.server.tester.UserSessionRule; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.sonar.api.rule.Severity.CRITICAL; -import static org.sonar.db.rule.RuleDescriptionSectionDto.createDefaultRuleDescriptionSection; import static org.sonar.db.rule.RuleTesting.newCustomRule; import static org.sonar.db.rule.RuleTesting.newRule; import static org.sonar.db.rule.RuleTesting.newTemplateRule; @@ -66,7 +65,7 @@ import static org.sonar.server.rule.RuleUpdate.createForPluginRule; public class RuleUpdaterTest { - static final RuleKey RULE_KEY = RuleKey.of("squid", "S001"); + static final RuleKey RULE_KEY = RuleKey.of("java", "S001"); private final System2 system2 = new TestSystem2().setNow(Instant.now().toEpochMilli()); @@ -98,7 +97,7 @@ public class RuleUpdaterTest { underTest.update(dbSession, update, userSessionRule); }) .isInstanceOf(IllegalArgumentException.class) - .hasMessage("Rule with REMOVED status cannot be updated: squid:S001"); + .hasMessage("Rule with REMOVED status cannot be updated: java:S001"); } @Test @@ -518,7 +517,7 @@ public class RuleUpdaterTest { @Test public void fail_to_update_plugin_rule_if_name_is_set() { - RuleDto ruleDto = db.rules().insert(newRule(RuleKey.of("squid", "S01"))); + RuleDto ruleDto = db.rules().insert(newRule(RuleKey.of("java", "S01"))); dbSession.commit(); assertThatThrownBy(() -> { @@ -530,7 +529,7 @@ public class RuleUpdaterTest { @Test public void fail_to_update_plugin_rule_if_description_is_set() { - RuleDto ruleDto = db.rules().insert(newRule(RuleKey.of("squid", "S01"))); + RuleDto ruleDto = db.rules().insert(newRule(RuleKey.of("java", "S01"))); dbSession.commit(); assertThatThrownBy(() -> { @@ -542,7 +541,7 @@ public class RuleUpdaterTest { @Test public void fail_to_update_plugin_rule_if_severity_is_set() { - RuleDto ruleDto = db.rules().insert(newRule(RuleKey.of("squid", "S01"))); + RuleDto ruleDto = db.rules().insert(newRule(RuleKey.of("java", "S01"))); dbSession.commit(); assertThatThrownBy(() -> { diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/rule/ws/AppActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/rule/ws/AppActionTest.java index 02717909a61..01681d16903 100644 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/rule/ws/AppActionTest.java +++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/rule/ws/AppActionTest.java @@ -72,7 +72,7 @@ public class AppActionTest { " \"language\": \"xoo\"" + " }," + " {" + - " \"key\": \"squid\"," + + " \"key\": \"java\"," + " \"name\": \"SonarQube\"," + " \"language\": \"ws\"" + " }" + @@ -111,7 +111,7 @@ public class AppActionTest { private void insertRules() { RuleRepositoryDto repo1 = new RuleRepositoryDto("xoo", "xoo", "SonarQube"); - RuleRepositoryDto repo2 = new RuleRepositoryDto("squid", "ws", "SonarQube"); + RuleRepositoryDto repo2 = new RuleRepositoryDto("java", "ws", "SonarQube"); db.getDbClient().ruleRepositoryDao().insert(db.getSession(), asList(repo1, repo2)); db.getSession().commit(); } diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/rule/ws/RepositoriesActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/rule/ws/RepositoriesActionTest.java index 2e46d2ee179..5ca37024fd4 100644 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/rule/ws/RepositoriesActionTest.java +++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/rule/ws/RepositoriesActionTest.java @@ -45,7 +45,7 @@ public class RepositoriesActionTest { public void setUp() { DbSession dbSession = dbTester.getSession(); RuleRepositoryDto repo1 = new RuleRepositoryDto("xoo", "xoo", "SonarQube"); - RuleRepositoryDto repo2 = new RuleRepositoryDto("squid", "ws", "SonarQube"); + RuleRepositoryDto repo2 = new RuleRepositoryDto("java", "ws", "SonarQube"); RuleRepositoryDto repo3 = new RuleRepositoryDto("common-ws", "ws", "SonarQube Common"); dbTester.getDbClient().ruleRepositoryDao().insert(dbSession, asList(repo1, repo2, repo3)); dbSession.commit(); @@ -61,7 +61,7 @@ public class RepositoriesActionTest { @Test public void filter_repositories_by_name() { newRequest().setParam("q", "common").execute().assertJson(this.getClass(), "repositories_common.json"); - newRequest().setParam("q", "squid").execute().assertJson(this.getClass(), "repositories_squid.json"); + newRequest().setParam("q", "java").execute().assertJson(this.getClass(), "repositories_java.json"); newRequest().setParam("q", "sonar").execute().assertJson(this.getClass(), "repositories_sonar.json"); } diff --git a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/RepositoriesActionTest/repositories.json b/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/RepositoriesActionTest/repositories.json index ee30e62c188..c25643cc680 100644 --- a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/RepositoriesActionTest/repositories.json +++ b/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/RepositoriesActionTest/repositories.json @@ -6,7 +6,7 @@ "language": "ws" }, { - "key": "squid", + "key": "java", "name": "SonarQube", "language": "ws" }, diff --git a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/RepositoriesActionTest/repositories_squid.json b/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/RepositoriesActionTest/repositories_java.json index 8e8a17083c6..3d08f656f92 100644 --- a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/RepositoriesActionTest/repositories_squid.json +++ b/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/RepositoriesActionTest/repositories_java.json @@ -1,9 +1,9 @@ { "repositories": [ { - "key": "squid", + "key": "java", "name": "SonarQube", "language": "ws" } ] -}
\ No newline at end of file +} diff --git a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/RepositoriesActionTest/repositories_sonar.json b/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/RepositoriesActionTest/repositories_sonar.json index ee30e62c188..c25643cc680 100644 --- a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/RepositoriesActionTest/repositories_sonar.json +++ b/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/RepositoriesActionTest/repositories_sonar.json @@ -6,7 +6,7 @@ "language": "ws" }, { - "key": "squid", + "key": "java", "name": "SonarQube", "language": "ws" }, diff --git a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/RepositoriesActionTest/repositories_ws.json b/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/RepositoriesActionTest/repositories_ws.json index e079f7674c2..c46a4d69203 100644 --- a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/RepositoriesActionTest/repositories_ws.json +++ b/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/RepositoriesActionTest/repositories_ws.json @@ -6,7 +6,7 @@ "language": "ws" }, { - "key": "squid", + "key": "java", "name": "SonarQube", "language": "ws" } diff --git a/sonar-core/src/main/java/org/sonar/core/config/IssueExclusionProperties.java b/sonar-core/src/main/java/org/sonar/core/config/IssueExclusionProperties.java index 88e1d1d8334..71d60350017 100644 --- a/sonar-core/src/main/java/org/sonar/core/config/IssueExclusionProperties.java +++ b/sonar-core/src/main/java/org/sonar/core/config/IssueExclusionProperties.java @@ -43,7 +43,7 @@ public final class IssueExclusionProperties { private static final String PROPERTY_RULE_KEY_PATTERN = "Rule Key Pattern"; private static final String PROPERTY_RULE_KEY_PATTERN_HELP = "<br/>A rule key pattern consists of the rule repository name, followed by a colon, followed by a rule key " + "or rule name fragment. For example:" - + "<ul><li>squid:S1195</li><li>squid:*Naming*</li></ul>"; + + "<ul><li>java:S1195</li><li>java:*Naming*</li></ul>"; public static final String BLOCK_SUFFIX = ".block"; public static final String PATTERNS_BLOCK_KEY = EXCLUSION_KEY_PREFIX + BLOCK_SUFFIX; diff --git a/sonar-core/src/test/java/org/sonar/core/issue/DefaultIssueTest.java b/sonar-core/src/test/java/org/sonar/core/issue/DefaultIssueTest.java index 53d866457c0..3c8ca77a091 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/DefaultIssueTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/DefaultIssueTest.java @@ -40,7 +40,7 @@ public class DefaultIssueTest { issue.setKey("ABCD") .setComponentKey("org.sample.Sample") .setProjectKey("Sample") - .setRuleKey(RuleKey.of("squid", "S100")) + .setRuleKey(RuleKey.of("java", "S100")) .setLanguage("xoo") .setSeverity("MINOR") .setManualSeverity(true) @@ -70,7 +70,7 @@ public class DefaultIssueTest { assertThat(issue.key()).isEqualTo("ABCD"); assertThat(issue.componentKey()).isEqualTo("org.sample.Sample"); assertThat(issue.projectKey()).isEqualTo("Sample"); - assertThat(issue.ruleKey()).isEqualTo(RuleKey.of("squid", "S100")); + assertThat(issue.ruleKey()).isEqualTo(RuleKey.of("java", "S100")); assertThat(issue.language()).isEqualTo("xoo"); assertThat(issue.severity()).isEqualTo("MINOR"); assertThat(issue.manualSeverity()).isTrue(); diff --git a/sonar-core/src/test/java/org/sonar/core/issue/tracking/TrackerTest.java b/sonar-core/src/test/java/org/sonar/core/issue/tracking/TrackerTest.java index 45fe1bfaf19..743f54720e4 100644 --- a/sonar-core/src/test/java/org/sonar/core/issue/tracking/TrackerTest.java +++ b/sonar-core/src/test/java/org/sonar/core/issue/tracking/TrackerTest.java @@ -282,8 +282,8 @@ public class TrackerTest { + " }", "}"); - Issue base1 = baseInput.createIssueOnLine(11, RuleKey.of("squid", "S109"), "Assign this magic number 42 to a well-named constant, and use the constant instead."); - Issue base2 = baseInput.createIssueOnLine(13, RuleKey.of("squid", "S00103"), "Split this 163 characters long line (which is greater than 120 authorized)."); + Issue base1 = baseInput.createIssueOnLine(11, RuleKey.of("java", "S109"), "Assign this magic number 42 to a well-named constant, and use the constant instead."); + Issue base2 = baseInput.createIssueOnLine(13, RuleKey.of("java", "S00103"), "Split this 163 characters long line (which is greater than 120 authorized)."); FakeInput rawInput = FakeInput.createForSourceLines( "package aa;", @@ -303,8 +303,8 @@ public class TrackerTest { " int x = a + 123;", " }", "}"); - Issue raw1 = rawInput.createIssueOnLine(11, RuleKey.of("squid", "S00103"), "Split this 139 characters long line (which is greater than 120 authorized)."); - Issue raw2 = rawInput.createIssueOnLine(15, RuleKey.of("squid", "S109"), "Assign this magic number 123 to a well-named constant, and use the constant instead."); + Issue raw1 = rawInput.createIssueOnLine(11, RuleKey.of("java", "S00103"), "Split this 139 characters long line (which is greater than 120 authorized)."); + Issue raw2 = rawInput.createIssueOnLine(15, RuleKey.of("java", "S109"), "Assign this magic number 123 to a well-named constant, and use the constant instead."); Tracking<Issue, Issue> tracking = tracker.trackNonClosed(rawInput, baseInput); assertThat(tracking.baseFor(raw1)).isNull(); diff --git a/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/rule/internal/RulesBuilderTest.java b/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/rule/internal/RulesBuilderTest.java index 224e4816ec0..4a31ea434bd 100644 --- a/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/rule/internal/RulesBuilderTest.java +++ b/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/rule/internal/RulesBuilderTest.java @@ -41,68 +41,68 @@ public class RulesBuilderTest { @Test public void build_rules() { RulesBuilder builder = new RulesBuilder(); - NewRule newSquid1 = builder.add(RuleKey.of("squid", "S0001")); - newSquid1.setName("Detect bug"); - newSquid1.setDescription("Detect potential bug"); - newSquid1.setInternalKey("foo=bar"); - newSquid1.setSeverity(org.sonar.api.rule.Severity.CRITICAL); - newSquid1.setStatus(RuleStatus.BETA); - newSquid1.addParam("min"); - newSquid1.addParam("max").setDescription("Maximum"); + NewRule newJava1 = builder.add(RuleKey.of("java", "S0001")); + newJava1.setName("Detect bug"); + newJava1.setDescription("Detect potential bug"); + newJava1.setInternalKey("foo=bar"); + newJava1.setSeverity(org.sonar.api.rule.Severity.CRITICAL); + newJava1.setStatus(RuleStatus.BETA); + newJava1.addParam("min"); + newJava1.addParam("max").setDescription("Maximum"); // most simple rule - builder.add(RuleKey.of("squid", "S0002")); + builder.add(RuleKey.of("java", "S0002")); builder.add(RuleKey.of("findbugs", "NPE")); Rules rules = builder.build(); assertThat(rules.findAll()).hasSize(3); - assertThat(rules.findByRepository("squid")).hasSize(2); + assertThat(rules.findByRepository("java")).hasSize(2); assertThat(rules.findByRepository("findbugs")).hasSize(1); assertThat(rules.findByRepository("unknown")).isEmpty(); - Rule squid1 = rules.find(RuleKey.of("squid", "S0001")); - assertThat(squid1.key().repository()).isEqualTo("squid"); - assertThat(squid1.key().rule()).isEqualTo("S0001"); - assertThat(squid1.name()).isEqualTo("Detect bug"); - assertThat(squid1.description()).isEqualTo("Detect potential bug"); - assertThat(squid1.internalKey()).isEqualTo("foo=bar"); - assertThat(squid1.status()).isEqualTo(RuleStatus.BETA); - assertThat(squid1.severity()).isEqualTo(org.sonar.api.rule.Severity.CRITICAL); - assertThat(squid1.params()).hasSize(2); - assertThat(squid1.param("min").key()).isEqualTo("min"); - assertThat(squid1.param("min").description()).isNull(); - assertThat(squid1.param("max").key()).isEqualTo("max"); - assertThat(squid1.param("max").description()).isEqualTo("Maximum"); + Rule java1 = rules.find(RuleKey.of("java", "S0001")); + assertThat(java1.key().repository()).isEqualTo("java"); + assertThat(java1.key().rule()).isEqualTo("S0001"); + assertThat(java1.name()).isEqualTo("Detect bug"); + assertThat(java1.description()).isEqualTo("Detect potential bug"); + assertThat(java1.internalKey()).isEqualTo("foo=bar"); + assertThat(java1.status()).isEqualTo(RuleStatus.BETA); + assertThat(java1.severity()).isEqualTo(org.sonar.api.rule.Severity.CRITICAL); + assertThat(java1.params()).hasSize(2); + assertThat(java1.param("min").key()).isEqualTo("min"); + assertThat(java1.param("min").description()).isNull(); + assertThat(java1.param("max").key()).isEqualTo("max"); + assertThat(java1.param("max").description()).isEqualTo("Maximum"); - Rule squid2 = rules.find(RuleKey.of("squid", "S0002")); - assertThat(squid2.key().repository()).isEqualTo("squid"); - assertThat(squid2.key().rule()).isEqualTo("S0002"); - assertThat(squid2.description()).isNull(); - assertThat(squid2.internalKey()).isNull(); - assertThat(squid2.status()).isEqualTo(RuleStatus.defaultStatus()); - assertThat(squid2.severity()).isEqualTo(Severity.defaultSeverity()); - assertThat(squid2.params()).isEmpty(); + Rule java2 = rules.find(RuleKey.of("java", "S0002")); + assertThat(java2.key().repository()).isEqualTo("java"); + assertThat(java2.key().rule()).isEqualTo("S0002"); + assertThat(java2.description()).isNull(); + assertThat(java2.internalKey()).isNull(); + assertThat(java2.status()).isEqualTo(RuleStatus.defaultStatus()); + assertThat(java2.severity()).isEqualTo(Severity.defaultSeverity()); + assertThat(java2.params()).isEmpty(); } @Test public void fail_to_add_twice_the_same_rule() { RulesBuilder builder = new RulesBuilder(); - builder.add(RuleKey.of("squid", "S0001")); + builder.add(RuleKey.of("java", "S0001")); - assertThatThrownBy(() -> builder.add(RuleKey.of("squid", "S0001"))) + assertThatThrownBy(() -> builder.add(RuleKey.of("java", "S0001"))) .isInstanceOf(IllegalStateException.class) - .hasMessage("Rule 'squid:S0001' already exists"); + .hasMessage("Rule 'java:S0001' already exists"); } @Test public void fail_to_add_twice_the_same_param() { RulesBuilder builder = new RulesBuilder(); - NewRule newRule = builder.add(RuleKey.of("squid", "S0001")); + NewRule newRule = builder.add(RuleKey.of("java", "S0001")); newRule.addParam("min"); newRule.addParam("max"); assertThatThrownBy(() -> newRule.addParam("min")) .isInstanceOf(IllegalStateException.class) - .hasMessage("Parameter 'min' already exists on rule 'squid:S0001'"); + .hasMessage("Parameter 'min' already exists on rule 'java:S0001'"); } } diff --git a/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/sensor/internal/DefaultSensorDescriptorTest.java b/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/sensor/internal/DefaultSensorDescriptorTest.java index 9a8e54dded3..4b0144d294d 100644 --- a/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/sensor/internal/DefaultSensorDescriptorTest.java +++ b/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/sensor/internal/DefaultSensorDescriptorTest.java @@ -53,7 +53,7 @@ public class DefaultSensorDescriptorTest { .onlyOnLanguage("java") .onlyOnFileType(InputFile.Type.MAIN) .onlyWhenConfiguration(c -> c.hasKey("sonar.foo.reportPath2") && c.hasKey("sonar.foo.reportPath")) - .createIssuesForRuleRepository("squid-java") + .createIssuesForRuleRepository("java-java") .processesFilesIndependently(); assertThat(descriptor.name()).isEqualTo("Foo"); @@ -64,7 +64,7 @@ public class DefaultSensorDescriptorTest { assertThat(descriptor.configurationPredicate().test(settings.asConfig())).isFalse(); settings.setProperty("sonar.foo.reportPath2", "foo"); assertThat(descriptor.configurationPredicate().test(settings.asConfig())).isTrue(); - assertThat(descriptor.ruleRepositories()).containsOnly("squid-java"); + assertThat(descriptor.ruleRepositories()).containsOnly("java-java"); assertThat(descriptor.isProcessesFilesIndependently()).isTrue(); } diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ScannerPluginRepositoryTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ScannerPluginRepositoryTest.java index 8d2c0a87ba1..bc6222af6a1 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ScannerPluginRepositoryTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ScannerPluginRepositoryTest.java @@ -46,18 +46,18 @@ public class ScannerPluginRepositoryTest { @Test public void install_and_load_plugins() { - PluginInfo info = new PluginInfo("squid"); - ImmutableMap<String, ScannerPlugin> plugins = ImmutableMap.of("squid", new ScannerPlugin("squid", 1L, info)); + PluginInfo info = new PluginInfo("java"); + ImmutableMap<String, ScannerPlugin> plugins = ImmutableMap.of("java", new ScannerPlugin("java", 1L, info)); Plugin instance = mock(Plugin.class); - when(loader.load(anyMap())).thenReturn(ImmutableMap.of("squid", instance)); + when(loader.load(anyMap())).thenReturn(ImmutableMap.of("java", instance)); when(installer.installRemotes()).thenReturn(plugins); underTest.start(); assertThat(underTest.getPluginInfos()).containsOnly(info); assertThat(underTest.getPluginsByKey()).isEqualTo(plugins); - assertThat(underTest.getPluginInfo("squid")).isSameAs(info); - assertThat(underTest.getPluginInstance("squid")).isSameAs(instance); + assertThat(underTest.getPluginInfo("java")).isSameAs(info); + assertThat(underTest.getPluginInstance("java")).isSameAs(instance); assertThat(underTest.getPluginInstances()).containsOnly(instance); underTest.stop(); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/IssuePublisherTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/IssuePublisherTest.java index 5e63367f913..279a28b7c19 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/IssuePublisherTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/IssuePublisherTest.java @@ -59,9 +59,9 @@ import static org.mockito.Mockito.when; @RunWith(MockitoJUnitRunner.class) public class IssuePublisherTest { - static final RuleKey SQUID_RULE_KEY = RuleKey.of("squid", "AvoidCycle"); - static final String SQUID_RULE_NAME = "Avoid Cycle"; - private static final RuleKey NOSONAR_RULE_KEY = RuleKey.of("squid", "NoSonarCheck"); + static final RuleKey JAVA_RULE_KEY = RuleKey.of("java", "AvoidCycle"); + static final String JAVA_RULE_NAME = "Avoid Cycle"; + private static final RuleKey NOSONAR_RULE_KEY = RuleKey.of("java", "NoSonarCheck"); private DefaultInputProject project; @@ -89,11 +89,11 @@ public class IssuePublisherTest { @Test public void ignore_null_active_rule() { - ruleBuilder.add(SQUID_RULE_KEY).setName(SQUID_RULE_NAME); + ruleBuilder.add(JAVA_RULE_KEY).setName(JAVA_RULE_NAME); initModuleIssues(); DefaultIssue issue = new DefaultIssue(project) .at(new DefaultIssueLocation().on(file).at(file.selectLine(3)).message("Foo")) - .forRule(SQUID_RULE_KEY); + .forRule(JAVA_RULE_KEY); boolean added = moduleIssues.initAndAddIssue(issue); assertThat(added).isFalse(); @@ -102,13 +102,13 @@ public class IssuePublisherTest { @Test public void ignore_null_rule_of_active_rule() { - ruleBuilder.add(SQUID_RULE_KEY).setName(SQUID_RULE_NAME); - activeRulesBuilder.addRule(new NewActiveRule.Builder().setRuleKey(SQUID_RULE_KEY).setQProfileKey("qp-1").build()); + ruleBuilder.add(JAVA_RULE_KEY).setName(JAVA_RULE_NAME); + activeRulesBuilder.addRule(new NewActiveRule.Builder().setRuleKey(JAVA_RULE_KEY).setQProfileKey("qp-1").build()); initModuleIssues(); DefaultIssue issue = new DefaultIssue(project) .at(new DefaultIssueLocation().on(file).at(file.selectLine(3)).message("Foo")) - .forRule(SQUID_RULE_KEY); + .forRule(JAVA_RULE_KEY); boolean added = moduleIssues.initAndAddIssue(issue); assertThat(added).isFalse(); @@ -117,9 +117,9 @@ public class IssuePublisherTest { @Test public void add_issue_to_cache() { - ruleBuilder.add(SQUID_RULE_KEY).setName(SQUID_RULE_NAME); + ruleBuilder.add(JAVA_RULE_KEY).setName(JAVA_RULE_NAME); activeRulesBuilder.addRule(new NewActiveRule.Builder() - .setRuleKey(SQUID_RULE_KEY) + .setRuleKey(JAVA_RULE_KEY) .setSeverity(Severity.INFO) .setQProfileKey("qp-1") .build()); @@ -127,7 +127,7 @@ public class IssuePublisherTest { DefaultIssue issue = new DefaultIssue(project) .at(new DefaultIssueLocation().on(file).at(file.selectLine(3)).message("Foo")) - .forRule(SQUID_RULE_KEY) + .forRule(JAVA_RULE_KEY) .overrideSeverity(org.sonar.api.batch.rule.Severity.CRITICAL) .setQuickFixAvailable(true); @@ -144,13 +144,13 @@ public class IssuePublisherTest { @Test public void add_external_issue_to_cache() { - ruleBuilder.add(SQUID_RULE_KEY).setName(SQUID_RULE_NAME); + ruleBuilder.add(JAVA_RULE_KEY).setName(JAVA_RULE_NAME); initModuleIssues(); DefaultExternalIssue issue = new DefaultExternalIssue(project) .at(new DefaultIssueLocation().on(file).at(file.selectLine(3)).message("Foo")) .type(RuleType.BUG) - .forRule(SQUID_RULE_KEY) + .forRule(JAVA_RULE_KEY) .severity(org.sonar.api.batch.rule.Severity.CRITICAL); moduleIssues.initAndAddExternalIssue(issue); @@ -162,9 +162,9 @@ public class IssuePublisherTest { @Test public void use_severity_from_active_rule_if_no_severity_on_issue() { - ruleBuilder.add(SQUID_RULE_KEY).setName(SQUID_RULE_NAME); + ruleBuilder.add(JAVA_RULE_KEY).setName(JAVA_RULE_NAME); activeRulesBuilder.addRule(new NewActiveRule.Builder() - .setRuleKey(SQUID_RULE_KEY) + .setRuleKey(JAVA_RULE_KEY) .setSeverity(Severity.INFO) .setQProfileKey("qp-1") .build()); @@ -172,7 +172,7 @@ public class IssuePublisherTest { DefaultIssue issue = new DefaultIssue(project) .at(new DefaultIssueLocation().on(file).at(file.selectLine(3)).message("Foo")) - .forRule(SQUID_RULE_KEY); + .forRule(JAVA_RULE_KEY); when(filters.accept(any(InputComponent.class), any(ScannerReport.Issue.class))).thenReturn(true); moduleIssues.initAndAddIssue(issue); @@ -183,9 +183,9 @@ public class IssuePublisherTest { @Test public void filter_issue() { - ruleBuilder.add(SQUID_RULE_KEY).setName(SQUID_RULE_NAME); + ruleBuilder.add(JAVA_RULE_KEY).setName(JAVA_RULE_NAME); activeRulesBuilder.addRule(new NewActiveRule.Builder() - .setRuleKey(SQUID_RULE_KEY) + .setRuleKey(JAVA_RULE_KEY) .setSeverity(Severity.INFO) .setQProfileKey("qp-1") .build()); @@ -193,7 +193,7 @@ public class IssuePublisherTest { DefaultIssue issue = new DefaultIssue(project) .at(new DefaultIssueLocation().on(file).at(file.selectLine(3)).message("")) - .forRule(SQUID_RULE_KEY); + .forRule(JAVA_RULE_KEY); when(filters.accept(any(InputComponent.class), any(ScannerReport.Issue.class))).thenReturn(false); @@ -205,9 +205,9 @@ public class IssuePublisherTest { @Test public void should_ignore_lines_commented_with_nosonar() { - ruleBuilder.add(SQUID_RULE_KEY).setName(SQUID_RULE_NAME); + ruleBuilder.add(JAVA_RULE_KEY).setName(JAVA_RULE_NAME); activeRulesBuilder.addRule(new NewActiveRule.Builder() - .setRuleKey(SQUID_RULE_KEY) + .setRuleKey(JAVA_RULE_KEY) .setSeverity(Severity.INFO) .setQProfileKey("qp-1") .build()); @@ -215,7 +215,7 @@ public class IssuePublisherTest { DefaultIssue issue = new DefaultIssue(project) .at(new DefaultIssueLocation().on(file).at(file.selectLine(3)).message("")) - .forRule(SQUID_RULE_KEY); + .forRule(JAVA_RULE_KEY); file.noSonarAt(new HashSet<>(Collections.singletonList(3))); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/ActiveRulesBuilderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/ActiveRulesBuilderTest.java index 1862a5994f7..d731011260d 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/ActiveRulesBuilderTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/ActiveRulesBuilderTest.java @@ -42,7 +42,7 @@ public class ActiveRulesBuilderTest { @Test public void build_rules() { NewActiveRule activeRule = new NewActiveRule.Builder() - .setRuleKey(RuleKey.of("squid", "S0001")) + .setRuleKey(RuleKey.of("java", "S0001")) .setName("My Rule") .setSeverity(Severity.CRITICAL) .setInternalKey("__S0001__") @@ -52,7 +52,7 @@ public class ActiveRulesBuilderTest { ActiveRules activeRules = new ActiveRulesBuilder() .addRule(activeRule) // most simple rule - .addRule(new NewActiveRule.Builder().setRuleKey(RuleKey.of("squid", "S0002")).build()) + .addRule(new NewActiveRule.Builder().setRuleKey(RuleKey.of("java", "S0002")).build()) .addRule(new NewActiveRule.Builder() .setRuleKey(RuleKey.of("findbugs", "NPE")) .setInternalKey(null) @@ -62,24 +62,24 @@ public class ActiveRulesBuilderTest { .build(); assertThat(activeRules.findAll()).hasSize(3); - assertThat(activeRules.findByRepository("squid")).hasSize(2); + assertThat(activeRules.findByRepository("java")).hasSize(2); assertThat(activeRules.findByRepository("findbugs")).hasSize(1); - assertThat(activeRules.findByInternalKey("squid", "__S0001__")).isNotNull(); + assertThat(activeRules.findByInternalKey("java", "__S0001__")).isNotNull(); assertThat(activeRules.findByRepository("unknown")).isEmpty(); - ActiveRule squid1 = activeRules.find(RuleKey.of("squid", "S0001")); - assertThat(squid1.ruleKey().repository()).isEqualTo("squid"); - assertThat(squid1.ruleKey().rule()).isEqualTo("S0001"); - assertThat(squid1.severity()).isEqualTo(Severity.CRITICAL); - assertThat(squid1.internalKey()).isEqualTo("__S0001__"); - assertThat(squid1.params()).hasSize(1); - assertThat(squid1.param("min")).isEqualTo("20"); + ActiveRule java1 = activeRules.find(RuleKey.of("java", "S0001")); + assertThat(java1.ruleKey().repository()).isEqualTo("java"); + assertThat(java1.ruleKey().rule()).isEqualTo("S0001"); + assertThat(java1.severity()).isEqualTo(Severity.CRITICAL); + assertThat(java1.internalKey()).isEqualTo("__S0001__"); + assertThat(java1.params()).hasSize(1); + assertThat(java1.param("min")).isEqualTo("20"); - ActiveRule squid2 = activeRules.find(RuleKey.of("squid", "S0002")); - assertThat(squid2.ruleKey().repository()).isEqualTo("squid"); - assertThat(squid2.ruleKey().rule()).isEqualTo("S0002"); - assertThat(squid2.severity()).isEqualTo(Severity.defaultSeverity()); - assertThat(squid2.params()).isEmpty(); + ActiveRule java2 = activeRules.find(RuleKey.of("java", "S0002")); + assertThat(java2.ruleKey().repository()).isEqualTo("java"); + assertThat(java2.ruleKey().rule()).isEqualTo("S0002"); + assertThat(java2.severity()).isEqualTo(Severity.defaultSeverity()); + assertThat(java2.params()).isEmpty(); ActiveRule findbugsRule = activeRules.find(RuleKey.of("findbugs", "NPE")); assertThat(findbugsRule.severity()).isEqualTo(Severity.defaultSeverity()); @@ -91,12 +91,12 @@ public class ActiveRulesBuilderTest { public void fail_to_add_twice_the_same_rule() { ActiveRulesBuilder builder = new ActiveRulesBuilder(); NewActiveRule rule = new NewActiveRule.Builder() - .setRuleKey(RuleKey.of("squid", "S0001")) + .setRuleKey(RuleKey.of("java", "S0001")) .build(); builder.addRule(rule); assertThatThrownBy(() -> builder.addRule(rule)) .isInstanceOf(IllegalStateException.class) - .hasMessage("Rule 'squid:S0001' is already activated"); + .hasMessage("Rule 'java:S0001' is already activated"); } } diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/DefaultActiveRulesLoaderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/DefaultActiveRulesLoaderTest.java index 9f76f67f9d1..625fa4e4c5c 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/DefaultActiveRulesLoaderTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/DefaultActiveRulesLoaderTest.java @@ -49,7 +49,7 @@ public class DefaultActiveRulesLoaderTest { private static final int PAGE_SIZE_1 = 150; private static final int PAGE_SIZE_2 = 76; - private static final RuleKey EXAMPLE_KEY = RuleKey.of("squid", "S108"); + private static final RuleKey EXAMPLE_KEY = RuleKey.of("java", "S108"); private static final String FORMAT_KEY = "format"; private static final String FORMAT_VALUE = "^[a-z][a-zA-Z0-9]*$"; private static final String SEVERITY_VALUE = Severity.MINOR; @@ -107,7 +107,7 @@ public class DefaultActiveRulesLoaderTest { Actives.Builder actives = Actives.newBuilder(); IntStream.rangeClosed(1, numberOfRules) - .mapToObj(i -> RuleKey.of("squid", "S" + i)) + .mapToObj(i -> RuleKey.of("java", "S" + i)) .forEach(key -> { Rule.Builder ruleBuilder = Rule.newBuilder(); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/sensor/ModuleSensorOptimizerTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/sensor/ModuleSensorOptimizerTest.java index 0a7b9a3585d..da8b4181e72 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/sensor/ModuleSensorOptimizerTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/sensor/ModuleSensorOptimizerTest.java @@ -99,7 +99,7 @@ public class ModuleSensorOptimizerTest { @Test public void should_optimize_on_repository() { DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor() - .createIssuesForRuleRepositories("squid"); + .createIssuesForRuleRepositories("java"); assertThat(optimizer.shouldExecute(descriptor)).isFalse(); ActiveRules activeRules = new ActiveRulesBuilder() @@ -111,7 +111,7 @@ public class ModuleSensorOptimizerTest { activeRules = new ActiveRulesBuilder() .addRule(new NewActiveRule.Builder().setRuleKey(RuleKey.of("repo1", "foo")).build()) - .addRule(new NewActiveRule.Builder().setRuleKey(RuleKey.of("squid", "rule")).build()) + .addRule(new NewActiveRule.Builder().setRuleKey(RuleKey.of("java", "rule")).build()) .build(); optimizer = new ModuleSensorOptimizer(fs, activeRules, settings.asConfig()); assertThat(optimizer.shouldExecute(descriptor)).isTrue(); diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/SearchRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/SearchRequest.java index 4f8e04ed999..5fc5f178169 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/SearchRequest.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/SearchRequest.java @@ -466,7 +466,7 @@ public class SearchRequest { } /** - * Example value: "squid:AvoidCycles" + * Example value: "java:AvoidCycles" */ public SearchRequest setRules(List<String> rules) { this.rules = rules; diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ActivateRuleRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ActivateRuleRequest.java index 37dda5c0bc7..aa97220ab7e 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ActivateRuleRequest.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ActivateRuleRequest.java @@ -82,7 +82,7 @@ public class ActivateRuleRequest { /** * This is a mandatory parameter. - * Example value: "squid:AvoidCycles" + * Example value: "java:AvoidCycles" */ public ActivateRuleRequest setRule(String rule) { this.rule = rule; diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ActivateRulesRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ActivateRulesRequest.java index 006f61598d6..0fafeff1c65 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ActivateRulesRequest.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ActivateRulesRequest.java @@ -258,7 +258,7 @@ public class ActivateRulesRequest { } /** - * Example value: "squid:S001" + * Example value: "java:S001" */ public ActivateRulesRequest setRuleKey(String ruleKey) { this.ruleKey = ruleKey; diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/DeactivateRuleRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/DeactivateRuleRequest.java index c4ada441f7e..57fb7d1811d 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/DeactivateRuleRequest.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/DeactivateRuleRequest.java @@ -48,7 +48,7 @@ public class DeactivateRuleRequest { /** * This is a mandatory parameter. - * Example value: "squid:AvoidCycles" + * Example value: "java:AvoidCycles" */ public DeactivateRuleRequest setRule(String rule) { this.rule = rule; diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/DeactivateRulesRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/DeactivateRulesRequest.java index 7fd32ba0895..dea2217a971 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/DeactivateRulesRequest.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/DeactivateRulesRequest.java @@ -257,7 +257,7 @@ public class DeactivateRulesRequest { } /** - * Example value: "squid:S001" + * Example value: "java:S001" */ public DeactivateRulesRequest setRuleKey(String ruleKey) { this.ruleKey = ruleKey; diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/DeleteRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/DeleteRequest.java index a5e81200c3a..2738edbbd1a 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/DeleteRequest.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/DeleteRequest.java @@ -34,7 +34,7 @@ public class DeleteRequest { /** * This is a mandatory parameter. - * Example value: "squid:XPath_1402065390816" + * Example value: "java:XPath_1402065390816" */ public DeleteRequest setKey(String key) { this.key = key; diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/RepositoriesRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/RepositoriesRequest.java index d0af95e131e..2a966d975ba 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/RepositoriesRequest.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/RepositoriesRequest.java @@ -46,7 +46,7 @@ public class RepositoriesRequest { } /** - * Example value: "squid" + * Example value: "java" */ public RepositoriesRequest setQ(String q) { this.q = q; diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/SearchRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/SearchRequest.java index c8310b635e3..d8f3421202f 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/SearchRequest.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/SearchRequest.java @@ -376,7 +376,7 @@ public class SearchRequest { } /** - * Example value: "squid:S001" + * Example value: "java:S001" */ public SearchRequest setRuleKey(String ruleKey) { this.ruleKey = ruleKey; |