diff options
author | simonbrandhof <simon.brandhof@gmail.com> | 2010-11-23 22:11:55 +0000 |
---|---|---|
committer | simonbrandhof <simon.brandhof@gmail.com> | 2010-11-23 22:11:55 +0000 |
commit | 767f520c9a10f0842bf5bc0084defbf196337230 (patch) | |
tree | 3179977129e8f951406b4288a488477a51e8e6ba /tests | |
parent | b603701f4475d1b0b2728dedbe61cb8133eac1cf (diff) | |
download | sonarqube-767f520c9a10f0842bf5bc0084defbf196337230.tar.gz sonarqube-767f520c9a10f0842bf5bc0084defbf196337230.zip |
SONAR-1988 Description of rule parameters should be optional
Diffstat (limited to 'tests')
3 files changed, 73 insertions, 1 deletions
diff --git a/tests/integration/sonar-it-reference-plugin/src/main/java/itests/ITestsPlugin.java b/tests/integration/sonar-it-reference-plugin/src/main/java/itests/ITestsPlugin.java index 73c30c51ca9..f416f5dcf7f 100644 --- a/tests/integration/sonar-it-reference-plugin/src/main/java/itests/ITestsPlugin.java +++ b/tests/integration/sonar-it-reference-plugin/src/main/java/itests/ITestsPlugin.java @@ -24,6 +24,7 @@ import itests.languages.LanguageWithoutRulesEngine; import itests.page.GwtSamplePage;
import itests.page.RubyApiTestsPage;
import itests.resourcetab.SampleResourceTab;
+import itests.rules.SampleRules;
import itests.ws.RubyWebService;
import org.sonar.api.Plugin;
@@ -50,7 +51,7 @@ public class ITestsPlugin implements Plugin { extensions.add(SampleSensor.class);
extensions.add(LanguageWithoutRulesEngine.class);
extensions.add(ServerSideExtensionUsingExternalDependency.class);
-
+ extensions.add(SampleRules.class);
// web
extensions.add(SampleResourceTab.class);
diff --git a/tests/integration/sonar-it-reference-plugin/src/main/java/itests/rules/RuleWithoutDefinition.java b/tests/integration/sonar-it-reference-plugin/src/main/java/itests/rules/RuleWithoutDefinition.java new file mode 100644 index 00000000000..44f00919cac --- /dev/null +++ b/tests/integration/sonar-it-reference-plugin/src/main/java/itests/rules/RuleWithoutDefinition.java @@ -0,0 +1,27 @@ +/* + * Sonar, open source software quality management tool. + * Copyright (C) 2009 SonarSource SA + * mailto:contact AT sonarsource DOT com + * + * Sonar 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. + * + * Sonar 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 Sonar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package itests.rules; + +import org.sonar.check.IsoCategory; +import org.sonar.check.Rule; + +@Rule(key="no_description", name="No description", isoCategory = IsoCategory.Maintainability) +public class RuleWithoutDefinition { +} diff --git a/tests/integration/sonar-it-reference-plugin/src/main/java/itests/rules/SampleRules.java b/tests/integration/sonar-it-reference-plugin/src/main/java/itests/rules/SampleRules.java new file mode 100644 index 00000000000..1e7f9d272f6 --- /dev/null +++ b/tests/integration/sonar-it-reference-plugin/src/main/java/itests/rules/SampleRules.java @@ -0,0 +1,44 @@ +/* + * Sonar, open source software quality management tool. + * Copyright (C) 2009 SonarSource SA + * mailto:contact AT sonarsource DOT com + * + * Sonar 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. + * + * Sonar 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 Sonar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package itests.rules; + +import org.sonar.api.resources.Java; +import org.sonar.api.rules.AnnotationRuleParser; +import org.sonar.api.rules.Rule; +import org.sonar.api.rules.RuleRepository; + +import java.util.Arrays; +import java.util.List; + +public class SampleRules extends RuleRepository { + + private AnnotationRuleParser ruleParser; + + public SampleRules(AnnotationRuleParser ruleParser) { + super("it", Java.KEY); + setName("Integration tests"); + this.ruleParser = ruleParser; + } + + @Override + public List<Rule> createRules() { + return ruleParser.parse("it", Arrays.<Class>asList(RuleWithoutDefinition.class)); + } +} |