From c581a33557048aa41203e68596d032dffe3b7fa4 Mon Sep 17 00:00:00 2001 From: Gustavo Martin Morcuende Date: Sun, 21 Aug 2016 06:20:27 +0200 Subject: [PATCH] sonar Java plugin, no time for comments --- .../java/de/example/plugins/custom/java/CustomPlugin.java | 3 +-- .../plugins/custom/java/CustomRulesCheckRegistrar.java | 12 ++++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Sonar/Plugins/sonar-custom-java-plugin/src/main/java/de/example/plugins/custom/java/CustomPlugin.java b/Sonar/Plugins/sonar-custom-java-plugin/src/main/java/de/example/plugins/custom/java/CustomPlugin.java index d87bcc5..7914239 100644 --- a/Sonar/Plugins/sonar-custom-java-plugin/src/main/java/de/example/plugins/custom/java/CustomPlugin.java +++ b/Sonar/Plugins/sonar-custom-java-plugin/src/main/java/de/example/plugins/custom/java/CustomPlugin.java @@ -14,8 +14,7 @@ public class CustomPlugin implements Plugin { builder.add( CustomRulesDefinition.class, CustomRulesCheckRegistrar.class, - CustomProfile.class, - CustomSensor.class); + CustomProfile.class); context.addExtensions(builder.build()); } diff --git a/Sonar/Plugins/sonar-custom-java-plugin/src/main/java/de/example/plugins/custom/java/CustomRulesCheckRegistrar.java b/Sonar/Plugins/sonar-custom-java-plugin/src/main/java/de/example/plugins/custom/java/CustomRulesCheckRegistrar.java index f17f649..62488d4 100644 --- a/Sonar/Plugins/sonar-custom-java-plugin/src/main/java/de/example/plugins/custom/java/CustomRulesCheckRegistrar.java +++ b/Sonar/Plugins/sonar-custom-java-plugin/src/main/java/de/example/plugins/custom/java/CustomRulesCheckRegistrar.java @@ -4,6 +4,18 @@ import org.sonar.plugins.java.api.CheckRegistrar; import de.example.custom.java.checks.CheckList; +/** + * This class will be called by org.sonar.java.SonarComponents (see constructor) and + * the SonarComponents object will be injected (SonarQube is using PicoContainer) in + * org.sonar.plugins.java.JavaSquidSensor. + * + * It seems like the SonarQube developers in charge of writing the Java plugin tried to + * make easy the creation of custom Java plugins. + * + * So, JavaSquidSensor will be the object that will run my rules (my Checks) whenever it finds Java code. + * I do not have to do anything else, what is great! + * + */ public class CustomRulesCheckRegistrar implements CheckRegistrar { @Override -- 2.1.4