aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-scanner-engine/src
diff options
context:
space:
mode:
authorBelen Pruvost <belen.pruvost@sonarsource.com>2022-07-06 16:55:00 +0200
committersonartech <sonartech@sonarsource.com>2022-07-07 20:03:10 +0000
commitf8b052dd328e5348266764edca80b87249896a5b (patch)
tree49827fb100d862f9208de1b0fd09476f905017af /sonar-scanner-engine/src
parent233c3c9320d8f22b75eb657dc58d7b1974f1478e (diff)
downloadsonarqube-f8b052dd328e5348266764edca80b87249896a5b.tar.gz
sonarqube-f8b052dd328e5348266764edca80b87249896a5b.zip
[NO JIRA] Replace 'squid' with 'java'
Diffstat (limited to 'sonar-scanner-engine/src')
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ScannerPluginRepositoryTest.java10
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/IssuePublisherTest.java44
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/ActiveRulesBuilderTest.java36
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/DefaultActiveRulesLoaderTest.java4
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/sensor/ModuleSensorOptimizerTest.java4
5 files changed, 49 insertions, 49 deletions
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();