From: Gustavo Martin Morcuende Date: Sun, 21 Aug 2016 04:20:27 +0000 (+0200) Subject: sonar Java plugin, no time for comments X-Git-Url: https://git.gumartinm.name/?a=commitdiff_plain;h=c581a33557048aa41203e68596d032dffe3b7fa4;p=JavaForFun sonar Java plugin, no time for comments --- 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