From 098fb79fbb2a5018970a1b3eb806b86bf347d13a Mon Sep 17 00:00:00 2001 From: Eric Morand Date: Wed, 4 Dec 2024 06:53:32 +0100 Subject: [PATCH 1/2] [POC] Assert S105 check's rule key --- .../org/sonar/javascript/checks/S105Test.java | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S105Test.java diff --git a/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S105Test.java b/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S105Test.java new file mode 100644 index 00000000000..17330c12d35 --- /dev/null +++ b/sonar-plugin/javascript-checks/src/test/java/org/sonar/javascript/checks/S105Test.java @@ -0,0 +1,32 @@ +/* + * SonarQube JavaScript Plugin + * Copyright (C) 2011-2024 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the Sonar Source-Available License Version 1, as published by SonarSource SA. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the Sonar Source-Available License for more details. + * + * You should have received a copy of the Sonar Source-Available License + * along with this program; if not, see https://sonarsource.com/license/ssal/ + */ +package org.sonar.javascript.checks; + +import org.junit.jupiter.api.Test; +import org.sonar.check.Rule; + +import static org.assertj.core.api.Assertions.assertThat; + +class S105Test { + + @Test + void test_rule_key() { + var check = new S105(); + + assertThat(check.getClass().getAnnotation(Rule.class).key()).isEqualTo("S105"); + } +} From c58b9a4312890cc5216d78ffe6df49a501905909 Mon Sep 17 00:00:00 2001 From: Eric Morand Date: Wed, 4 Dec 2024 08:37:01 +0100 Subject: [PATCH 2/2] Deliberately change S105 deprecated rule key --- .../src/main/java/org/sonar/javascript/checks/S105.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S105.java b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S105.java index 00773b2280a..feecaf48ccf 100644 --- a/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S105.java +++ b/sonar-plugin/javascript-checks/src/main/java/org/sonar/javascript/checks/S105.java @@ -24,7 +24,7 @@ @JavaScriptRule @TypeScriptRule -@DeprecatedRuleKey(ruleKey = "TabCharacter") +@DeprecatedRuleKey(ruleKey = "TabCharacters") @Rule(key = "S105") public class S105 extends Check {