From 169a9eb32a0c32b44502da024d13d67a6241bed6 Mon Sep 17 00:00:00 2001 From: GabinL21 Date: Fri, 8 Nov 2024 16:10:21 +0100 Subject: [PATCH] SONARPHP-1520 Address comments --- .../php-custom-rules-plugin/build.gradle.kts | 53 ------------------- .../samples/php/CustomPHPRuleRepository.java | 53 ------------------- .../samples/php/CustomPHPRulesPlugin.java | 31 ----------- .../php/CustomPHPSubscriptionCheck.java | 46 ---------------- .../samples/php/CustomPHPVisitorCheck.java | 38 ------------- .../projects/custom_rules/src/simple.php | 13 ++--- its/plugin/tests/build.gradle.kts | 3 +- .../com/sonar/it/php/CustomRulesTest.java | 10 ++-- .../java/com/sonar/it/php/Tests.java | 2 +- .../sonar/it/php/profile-php-custom-rules.xml | 16 ++---- .../README.md | 0 .../build.gradle.kts | 6 +-- .../org/sonar/samples/php/MyPhpRules.java | 2 +- .../samples/php/PHPCustomRulesPlugin.java | 0 .../php/checks/ForbiddenFunctionUseCheck.java | 2 +- .../OtherForbiddenFunctionUseCheck.java | 8 +-- .../org/sonar/l10n/php/rules/custom/S1.html | 0 .../org/sonar/l10n/php/rules/custom/S2.html | 6 +-- .../org/sonar/samples/php/MyPhpRulesTest.java | 0 .../samples/php/PHPCustomRulesPluginTest.java | 0 .../checks/ForbiddenFunctionUseCheckTest.java | 0 .../OtherForbiddenFunctionUseCheckTest.java | 0 .../checks/forbiddenFunctionUseCheck.php | 0 settings.gradle.kts | 3 +- 24 files changed, 29 insertions(+), 263 deletions(-) delete mode 100644 its/plugin/plugins/php-custom-rules-plugin/build.gradle.kts delete mode 100644 its/plugin/plugins/php-custom-rules-plugin/src/main/java/org/sonar/samples/php/CustomPHPRuleRepository.java delete mode 100644 its/plugin/plugins/php-custom-rules-plugin/src/main/java/org/sonar/samples/php/CustomPHPRulesPlugin.java delete mode 100644 its/plugin/plugins/php-custom-rules-plugin/src/main/java/org/sonar/samples/php/CustomPHPSubscriptionCheck.java delete mode 100644 its/plugin/plugins/php-custom-rules-plugin/src/main/java/org/sonar/samples/php/CustomPHPVisitorCheck.java rename {php-custom-rules => php-custom-rules-plugin}/README.md (100%) rename {php-custom-rules => php-custom-rules-plugin}/build.gradle.kts (92%) rename {php-custom-rules => php-custom-rules-plugin}/src/main/java/org/sonar/samples/php/MyPhpRules.java (98%) rename {php-custom-rules => php-custom-rules-plugin}/src/main/java/org/sonar/samples/php/PHPCustomRulesPlugin.java (100%) rename {php-custom-rules => php-custom-rules-plugin}/src/main/java/org/sonar/samples/php/checks/ForbiddenFunctionUseCheck.java (100%) rename {php-custom-rules => php-custom-rules-plugin}/src/main/java/org/sonar/samples/php/checks/OtherForbiddenFunctionUseCheck.java (95%) rename {php-custom-rules => php-custom-rules-plugin}/src/main/resources/org/sonar/l10n/php/rules/custom/S1.html (100%) rename {php-custom-rules => php-custom-rules-plugin}/src/main/resources/org/sonar/l10n/php/rules/custom/S2.html (59%) rename {php-custom-rules => php-custom-rules-plugin}/src/test/java/org/sonar/samples/php/MyPhpRulesTest.java (100%) rename {php-custom-rules => php-custom-rules-plugin}/src/test/java/org/sonar/samples/php/PHPCustomRulesPluginTest.java (100%) rename {php-custom-rules => php-custom-rules-plugin}/src/test/java/org/sonar/samples/php/checks/ForbiddenFunctionUseCheckTest.java (100%) rename {php-custom-rules => php-custom-rules-plugin}/src/test/java/org/sonar/samples/php/checks/OtherForbiddenFunctionUseCheckTest.java (100%) rename {php-custom-rules => php-custom-rules-plugin}/src/test/resources/checks/forbiddenFunctionUseCheck.php (100%) diff --git a/its/plugin/plugins/php-custom-rules-plugin/build.gradle.kts b/its/plugin/plugins/php-custom-rules-plugin/build.gradle.kts deleted file mode 100644 index ae518b6990..0000000000 --- a/its/plugin/plugins/php-custom-rules-plugin/build.gradle.kts +++ /dev/null @@ -1,53 +0,0 @@ -import org.sonarsource.php.registerCleanupTask - -plugins { - id("org.sonarsource.php.java-conventions") - id("org.sonarsource.php.code-style-convention") - alias(libs.plugins.shadow) -} - -dependencies { - compileOnly(libs.sonar.plugin.api) - compileOnly(project(":sonar-php-plugin")) -} - -description = "PHP Custom Rules Example for SonarQube" - -tasks.jar { - manifest { - attributes( - mapOf( - "Plugin-ChildFirstClassLoader" to "false", - "Plugin-Class" to "org.sonar.samples.php.CustomPHPRulesPlugin", - "Plugin-Description" to "PHP Custom Rules Example for SonarQube", - "Plugin-Developers" to "SonarSource Team", - "Plugin-Display-Version" to version, - "Plugin-Homepage" to "https://sonarsource.atlassian.net/browse/SONARPHP", - "Plugin-IssueTrackerUrl" to "https://sonarsource.atlassian.net/browse/SONARPHP", - "Plugin-Key" to "php-custom-rules", - "Plugin-License" to "GNU LGPL 3", - "Plugin-Name" to "PHP Custom Plugin Example", - "Plugin-Organization" to "SonarSource", - "Plugin-OrganizationUrl" to "https://www.sonarsource.com", - "Plugin-RequiredForLanguages" to "php", - "Plugin-SourcesUrl" to "https://github.com/SonarSource/sonar-php", - "Plugin-Version" to project.version, - "Sonar-Version" to "9.9", - "SonarLint-Supported" to "true", - "Version" to project.version.toString(), - "Jre-Min-Version" to java.sourceCompatibility.majorVersion, - ), - ) - } -} - -val cleanupTask = registerCleanupTask() - -tasks.shadowJar { - dependsOn(cleanupTask) - minimize() -} - -artifacts { - archives(tasks.shadowJar) -} diff --git a/its/plugin/plugins/php-custom-rules-plugin/src/main/java/org/sonar/samples/php/CustomPHPRuleRepository.java b/its/plugin/plugins/php-custom-rules-plugin/src/main/java/org/sonar/samples/php/CustomPHPRuleRepository.java deleted file mode 100644 index a5e83b25d2..0000000000 --- a/its/plugin/plugins/php-custom-rules-plugin/src/main/java/org/sonar/samples/php/CustomPHPRuleRepository.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * SonarQube PHP Plugin - * Copyright (C) 2010-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 GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * 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 GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.samples.php; - -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import org.sonar.api.server.rule.RulesDefinition; -import org.sonar.api.server.rule.RulesDefinitionAnnotationLoader; -import org.sonar.plugins.php.api.visitors.PHPCustomRuleRepository; - -public class CustomPHPRuleRepository implements RulesDefinition, PHPCustomRuleRepository { - - @Override - public void define(Context context) { - NewRepository repository = context.createRepository(repositoryKey(), "php").setName("My custom repo"); - new RulesDefinitionAnnotationLoader().load(repository, checkClasses().toArray(new Class[] {})); - Map remediationCosts = new HashMap<>(); - remediationCosts.put("visitor", "5min"); - remediationCosts.put("subscription", "10min"); - repository.rules().forEach(rule -> rule.setDebtRemediationFunction( - rule.debtRemediationFunctions().constantPerIssue(remediationCosts.get(rule.key())))); - repository.done(); - } - - @Override - public String repositoryKey() { - return "php-custom-rules"; - } - - @Override - public List> checkClasses() { - return Arrays.asList(CustomPHPVisitorCheck.class, CustomPHPSubscriptionCheck.class); - } -} diff --git a/its/plugin/plugins/php-custom-rules-plugin/src/main/java/org/sonar/samples/php/CustomPHPRulesPlugin.java b/its/plugin/plugins/php-custom-rules-plugin/src/main/java/org/sonar/samples/php/CustomPHPRulesPlugin.java deleted file mode 100644 index 191b738aab..0000000000 --- a/its/plugin/plugins/php-custom-rules-plugin/src/main/java/org/sonar/samples/php/CustomPHPRulesPlugin.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube PHP Plugin - * Copyright (C) 2010-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 GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * 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 GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.samples.php; - -import org.sonar.api.Plugin; - -public class CustomPHPRulesPlugin implements Plugin { - - @Override - public void define(Context context) { - context.addExtension(CustomPHPRuleRepository.class); - } - -} diff --git a/its/plugin/plugins/php-custom-rules-plugin/src/main/java/org/sonar/samples/php/CustomPHPSubscriptionCheck.java b/its/plugin/plugins/php-custom-rules-plugin/src/main/java/org/sonar/samples/php/CustomPHPSubscriptionCheck.java deleted file mode 100644 index 8cb33abe60..0000000000 --- a/its/plugin/plugins/php-custom-rules-plugin/src/main/java/org/sonar/samples/php/CustomPHPSubscriptionCheck.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * SonarQube PHP Plugin - * Copyright (C) 2010-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 GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * 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 GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.samples.php; - -import java.util.Collections; -import java.util.List; -import org.sonar.check.Rule; -import org.sonar.plugins.php.api.tree.Tree; -import org.sonar.plugins.php.api.tree.Tree.Kind; -import org.sonar.plugins.php.api.visitors.PHPSubscriptionCheck; - -@Rule( - key = "subscription", - name = "PHP subscription visitor check", - description = "desc") -public class CustomPHPSubscriptionCheck extends PHPSubscriptionCheck { - - @Override - public List nodesToVisit() { - return Collections.singletonList( - Kind.FOR_STATEMENT); - } - - @Override - public void visitNode(Tree tree) { - context().newIssue(this, tree, "For statement."); - } - -} diff --git a/its/plugin/plugins/php-custom-rules-plugin/src/main/java/org/sonar/samples/php/CustomPHPVisitorCheck.java b/its/plugin/plugins/php-custom-rules-plugin/src/main/java/org/sonar/samples/php/CustomPHPVisitorCheck.java deleted file mode 100644 index 2f8dc721be..0000000000 --- a/its/plugin/plugins/php-custom-rules-plugin/src/main/java/org/sonar/samples/php/CustomPHPVisitorCheck.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SonarQube PHP Plugin - * Copyright (C) 2010-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 GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * 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 GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.samples.php; - -import org.sonar.check.Rule; -import org.sonar.plugins.php.api.tree.expression.FunctionExpressionTree; -import org.sonar.plugins.php.api.visitors.PHPVisitorCheck; - -@Rule( - key = "visitor", - name = "PHP visitor check", - description = "desc") -public class CustomPHPVisitorCheck extends PHPVisitorCheck { - - @Override - public void visitFunctionExpression(FunctionExpressionTree tree) { - context().newIssue(this, tree, "Function expression."); - super.visitFunctionExpression(tree); - } - -} diff --git a/its/plugin/projects/custom_rules/src/simple.php b/its/plugin/projects/custom_rules/src/simple.php index 97f1c53394..b52fc5383d 100644 --- a/its/plugin/projects/custom_rules/src/simple.php +++ b/its/plugin/projects/custom_rules/src/simple.php @@ -1,11 +1,6 @@ issues; @@ -51,17 +51,17 @@ static void prepare() { @Test void baseTreeVisitorCheck() { - assertSingleIssue("php-custom-rules:visitor", 5, "Function expression.", "5min"); + assertSingleIssue("custom:S1", 4, "Remove the usage of this forbidden function.", "5min"); } @Test void subscriptionBaseVisitorCheck() { - assertSingleIssue("php-custom-rules:subscription", 8, "For statement.", "10min"); + assertSingleIssue("custom:S2", 6, "Remove the usage of this other forbidden function.", "10min"); } - private void assertSingleIssue(String ruleKey, int expectedLine, String expectedMessage, String expectedDebt) { + private static void assertSingleIssue(String ruleKey, int expectedLine, String expectedMessage, String expectedDebt) { assertThat(Tests.issuesForRule(issues, ruleKey)).hasSize(1); - Issue issue = Tests.issuesForRule(issues, ruleKey).get(0); + var issue = Tests.issuesForRule(issues, ruleKey).get(0); assertThat(issue.getLine()).isEqualTo(expectedLine); assertThat(issue.getMessage()).isEqualTo(expectedMessage); assertThat(issue.getDebt()).isEqualTo(expectedDebt); diff --git a/its/plugin/tests/src/integrationTest/java/com/sonar/it/php/Tests.java b/its/plugin/tests/src/integrationTest/java/com/sonar/it/php/Tests.java index ebab50346c..8c832c6bba 100644 --- a/its/plugin/tests/src/integrationTest/java/com/sonar/it/php/Tests.java +++ b/its/plugin/tests/src/integrationTest/java/com/sonar/it/php/Tests.java @@ -73,7 +73,7 @@ class Tests { .restoreProfileAtStartup(FileLocation.ofClasspath(RESOURCE_DIRECTORY + "profile.xml")) .restoreProfileAtStartup(FileLocation.ofClasspath(RESOURCE_DIRECTORY + "no_rules.xml")) // Custom rules plugin - .addPlugin(FileLocation.byWildcardFilename(new File("../plugins/php-custom-rules-plugin/build/libs"), "php-custom-rules-plugin-*-all.jar")) + .addPlugin(FileLocation.byWildcardFilename(new File("../../../php-custom-rules-plugin/build/libs"), "php-custom-rules-plugin-*-all.jar")) .restoreProfileAtStartup(FileLocation.ofClasspath(RESOURCE_DIRECTORY + "profile-php-custom-rules.xml")) .restoreProfileAtStartup(FileLocation.ofClasspath(RESOURCE_DIRECTORY + "nosonar.xml")) .restoreProfileAtStartup(FileLocation.ofClasspath(RESOURCE_DIRECTORY + "sleep.xml")) diff --git a/its/plugin/tests/src/integrationTest/resources/com/sonar/it/php/profile-php-custom-rules.xml b/its/plugin/tests/src/integrationTest/resources/com/sonar/it/php/profile-php-custom-rules.xml index 5382a942ea..136e0e775b 100644 --- a/its/plugin/tests/src/integrationTest/resources/com/sonar/it/php/profile-php-custom-rules.xml +++ b/its/plugin/tests/src/integrationTest/resources/com/sonar/it/php/profile-php-custom-rules.xml @@ -4,20 +4,12 @@ php - php-custom-rules - visitor + custom + S1 - php-custom-rules - subscription - - - deprecated-php-custom-rules - visitor - - - deprecated-php-custom-rules - subscription + custom + S2 diff --git a/php-custom-rules/README.md b/php-custom-rules-plugin/README.md similarity index 100% rename from php-custom-rules/README.md rename to php-custom-rules-plugin/README.md diff --git a/php-custom-rules/build.gradle.kts b/php-custom-rules-plugin/build.gradle.kts similarity index 92% rename from php-custom-rules/build.gradle.kts rename to php-custom-rules-plugin/build.gradle.kts index 621e4579c2..075751433e 100644 --- a/php-custom-rules/build.gradle.kts +++ b/php-custom-rules-plugin/build.gradle.kts @@ -7,11 +7,11 @@ plugins { dependencies { compileOnly(libs.sonar.plugin.api) - compileOnly(project(":sonar-php-plugin")) + compileOnly(project(":php-frontend")) testImplementation(libs.junit.jupiter) testImplementation(libs.sonar.plugin.api.impl) - testImplementation(project(":sonar-php-plugin")) + testImplementation(project(":php-frontend")) } description = "PHP Custom Rules Example for SonarQube" @@ -27,7 +27,7 @@ tasks.jar { "Plugin-Display-Version" to version, "Plugin-Homepage" to "https://sonarsource.atlassian.net/browse/SONARPHP", "Plugin-IssueTrackerUrl" to "https://sonarsource.atlassian.net/browse/SONARPHP", - "Plugin-Key" to "php", + "Plugin-Key" to "custom", "Plugin-License" to "GNU LGPL 3", "Plugin-Name" to "PHP Custom Rules", "Plugin-Organization" to "SonarSource", diff --git a/php-custom-rules/src/main/java/org/sonar/samples/php/MyPhpRules.java b/php-custom-rules-plugin/src/main/java/org/sonar/samples/php/MyPhpRules.java similarity index 98% rename from php-custom-rules/src/main/java/org/sonar/samples/php/MyPhpRules.java rename to php-custom-rules-plugin/src/main/java/org/sonar/samples/php/MyPhpRules.java index aeeaab2669..6b5769dbb1 100644 --- a/php-custom-rules/src/main/java/org/sonar/samples/php/MyPhpRules.java +++ b/php-custom-rules-plugin/src/main/java/org/sonar/samples/php/MyPhpRules.java @@ -70,7 +70,7 @@ public void define(Context context) { // Optionally define remediation costs Map remediationCosts = new HashMap<>(); remediationCosts.put(ForbiddenFunctionUseCheck.KEY, "5min"); - remediationCosts.put(OtherForbiddenFunctionUseCheck.KEY, "5min"); + remediationCosts.put(OtherForbiddenFunctionUseCheck.KEY, "10min"); repository.rules().forEach(rule -> rule.setDebtRemediationFunction( rule.debtRemediationFunctions().constantPerIssue(remediationCosts.get(rule.key())))); diff --git a/php-custom-rules/src/main/java/org/sonar/samples/php/PHPCustomRulesPlugin.java b/php-custom-rules-plugin/src/main/java/org/sonar/samples/php/PHPCustomRulesPlugin.java similarity index 100% rename from php-custom-rules/src/main/java/org/sonar/samples/php/PHPCustomRulesPlugin.java rename to php-custom-rules-plugin/src/main/java/org/sonar/samples/php/PHPCustomRulesPlugin.java diff --git a/php-custom-rules/src/main/java/org/sonar/samples/php/checks/ForbiddenFunctionUseCheck.java b/php-custom-rules-plugin/src/main/java/org/sonar/samples/php/checks/ForbiddenFunctionUseCheck.java similarity index 100% rename from php-custom-rules/src/main/java/org/sonar/samples/php/checks/ForbiddenFunctionUseCheck.java rename to php-custom-rules-plugin/src/main/java/org/sonar/samples/php/checks/ForbiddenFunctionUseCheck.java index ffe39e897a..11320c1837 100644 --- a/php-custom-rules/src/main/java/org/sonar/samples/php/checks/ForbiddenFunctionUseCheck.java +++ b/php-custom-rules-plugin/src/main/java/org/sonar/samples/php/checks/ForbiddenFunctionUseCheck.java @@ -46,8 +46,8 @@ ) public class ForbiddenFunctionUseCheck extends PHPVisitorCheck { - private static final Set FORBIDDEN_FUNCTIONS = Set.of("foo", "bar"); public static final String KEY = "S1"; + private static final Set FORBIDDEN_FUNCTIONS = Set.of("foo", "bar"); /** * Overriding method visiting the call expression to create an issue diff --git a/php-custom-rules/src/main/java/org/sonar/samples/php/checks/OtherForbiddenFunctionUseCheck.java b/php-custom-rules-plugin/src/main/java/org/sonar/samples/php/checks/OtherForbiddenFunctionUseCheck.java similarity index 95% rename from php-custom-rules/src/main/java/org/sonar/samples/php/checks/OtherForbiddenFunctionUseCheck.java rename to php-custom-rules-plugin/src/main/java/org/sonar/samples/php/checks/OtherForbiddenFunctionUseCheck.java index 6660e55733..e58b0e300f 100644 --- a/php-custom-rules/src/main/java/org/sonar/samples/php/checks/OtherForbiddenFunctionUseCheck.java +++ b/php-custom-rules-plugin/src/main/java/org/sonar/samples/php/checks/OtherForbiddenFunctionUseCheck.java @@ -45,11 +45,11 @@ tags = {"convention"}, // Description can either be given in this annotation or through HTML name .html located in package // src/resources/org/sonar/l10n/php/rules/ - description = "

The following functions should not be used:

  • foo
  • bar
") + description = "

The following functions should not be used:

  • fizz
  • buzz
") public class OtherForbiddenFunctionUseCheck extends PHPSubscriptionCheck { - private static final Set FORBIDDEN_FUNCTIONS = Set.of("foo", "bar"); public static final String KEY = "S2"; + private static final Set FORBIDDEN_FUNCTIONS = Set.of("fizz", "buzz"); @Override public List nodesToVisit() { @@ -58,14 +58,14 @@ public List nodesToVisit() { /** * Overriding method visiting the call expression to create an issue - * each time a call to "foo()" or "bar()" is done. + * each time a call to "fizz()" or "buzz()" is done. */ @Override public void visitNode(Tree tree) { ExpressionTree callee = ((FunctionCallTree) tree).callee(); if (callee.is(Kind.NAMESPACE_NAME) && FORBIDDEN_FUNCTIONS.contains(((NamespaceNameTree) callee).qualifiedName())) { - context().newIssue(this, callee, "Remove the usage of this forbidden function."); + context().newIssue(this, callee, "Remove the usage of this other forbidden function."); } } diff --git a/php-custom-rules/src/main/resources/org/sonar/l10n/php/rules/custom/S1.html b/php-custom-rules-plugin/src/main/resources/org/sonar/l10n/php/rules/custom/S1.html similarity index 100% rename from php-custom-rules/src/main/resources/org/sonar/l10n/php/rules/custom/S1.html rename to php-custom-rules-plugin/src/main/resources/org/sonar/l10n/php/rules/custom/S1.html diff --git a/php-custom-rules/src/main/resources/org/sonar/l10n/php/rules/custom/S2.html b/php-custom-rules-plugin/src/main/resources/org/sonar/l10n/php/rules/custom/S2.html similarity index 59% rename from php-custom-rules/src/main/resources/org/sonar/l10n/php/rules/custom/S2.html rename to php-custom-rules-plugin/src/main/resources/org/sonar/l10n/php/rules/custom/S2.html index 1bf97c04c0..5437fa0727 100644 --- a/php-custom-rules/src/main/resources/org/sonar/l10n/php/rules/custom/S2.html +++ b/php-custom-rules-plugin/src/main/resources/org/sonar/l10n/php/rules/custom/S2.html @@ -2,6 +2,6 @@ The following functions should not be used:

    -
  • foo
  • -
  • bar
  • -
\ No newline at end of file +
  • fizz
  • +
  • buzz
  • + diff --git a/php-custom-rules/src/test/java/org/sonar/samples/php/MyPhpRulesTest.java b/php-custom-rules-plugin/src/test/java/org/sonar/samples/php/MyPhpRulesTest.java similarity index 100% rename from php-custom-rules/src/test/java/org/sonar/samples/php/MyPhpRulesTest.java rename to php-custom-rules-plugin/src/test/java/org/sonar/samples/php/MyPhpRulesTest.java diff --git a/php-custom-rules/src/test/java/org/sonar/samples/php/PHPCustomRulesPluginTest.java b/php-custom-rules-plugin/src/test/java/org/sonar/samples/php/PHPCustomRulesPluginTest.java similarity index 100% rename from php-custom-rules/src/test/java/org/sonar/samples/php/PHPCustomRulesPluginTest.java rename to php-custom-rules-plugin/src/test/java/org/sonar/samples/php/PHPCustomRulesPluginTest.java diff --git a/php-custom-rules/src/test/java/org/sonar/samples/php/checks/ForbiddenFunctionUseCheckTest.java b/php-custom-rules-plugin/src/test/java/org/sonar/samples/php/checks/ForbiddenFunctionUseCheckTest.java similarity index 100% rename from php-custom-rules/src/test/java/org/sonar/samples/php/checks/ForbiddenFunctionUseCheckTest.java rename to php-custom-rules-plugin/src/test/java/org/sonar/samples/php/checks/ForbiddenFunctionUseCheckTest.java diff --git a/php-custom-rules/src/test/java/org/sonar/samples/php/checks/OtherForbiddenFunctionUseCheckTest.java b/php-custom-rules-plugin/src/test/java/org/sonar/samples/php/checks/OtherForbiddenFunctionUseCheckTest.java similarity index 100% rename from php-custom-rules/src/test/java/org/sonar/samples/php/checks/OtherForbiddenFunctionUseCheckTest.java rename to php-custom-rules-plugin/src/test/java/org/sonar/samples/php/checks/OtherForbiddenFunctionUseCheckTest.java diff --git a/php-custom-rules/src/test/resources/checks/forbiddenFunctionUseCheck.php b/php-custom-rules-plugin/src/test/resources/checks/forbiddenFunctionUseCheck.php similarity index 100% rename from php-custom-rules/src/test/resources/checks/forbiddenFunctionUseCheck.php rename to php-custom-rules-plugin/src/test/resources/checks/forbiddenFunctionUseCheck.php diff --git a/settings.gradle.kts b/settings.gradle.kts index ff83979e4c..cb176907f1 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -34,9 +34,8 @@ includeBuild("build-logic") include(":sonar-php-plugin") include(":php-frontend") include(":php-checks") -include(":php-custom-rules") +include(":php-custom-rules-plugin") include(":its:plugin:tests") -include(":its:plugin:plugins:php-custom-rules-plugin") include(":its:ruling") gradle.allprojects {