diff options
author | simonbrandhof <simon.brandhof@gmail.com> | 2010-09-23 13:29:43 +0000 |
---|---|---|
committer | simonbrandhof <simon.brandhof@gmail.com> | 2010-09-23 13:29:43 +0000 |
commit | f908b8b900e51728bbf04291e5d241e0317a18d0 (patch) | |
tree | 3b7f2d4114b987f369a5447c0371edd9224c10ef /sonar-check-api | |
parent | 28a97998eb8ea682d47c286e3d0ac59976d17dc8 (diff) | |
download | sonarqube-f908b8b900e51728bbf04291e5d241e0317a18d0.tar.gz sonarqube-f908b8b900e51728bbf04291e5d241e0317a18d0.zip |
add the package org.sonar.api.checks in order to implement its own rules engine
Diffstat (limited to 'sonar-check-api')
7 files changed, 122 insertions, 3 deletions
diff --git a/sonar-check-api/src/main/java/org/sonar/check/AnnotationIntrospector.java b/sonar-check-api/src/main/java/org/sonar/check/AnnotationIntrospector.java index 15def7431c3..d368a616240 100644 --- a/sonar-check-api/src/main/java/org/sonar/check/AnnotationIntrospector.java +++ b/sonar-check-api/src/main/java/org/sonar/check/AnnotationIntrospector.java @@ -23,6 +23,11 @@ import java.lang.reflect.Field; import java.util.ArrayList; import java.util.List; +/** + * @since 2.1 (experimental) + * @deprecated since 2.3 + */ +@Deprecated public final class AnnotationIntrospector { private AnnotationIntrospector() { diff --git a/sonar-check-api/src/main/java/org/sonar/check/BelongsToProfiles.java b/sonar-check-api/src/main/java/org/sonar/check/BelongsToProfiles.java index a7d15fdf891..16ada04cce8 100644 --- a/sonar-check-api/src/main/java/org/sonar/check/BelongsToProfiles.java +++ b/sonar-check-api/src/main/java/org/sonar/check/BelongsToProfiles.java @@ -25,10 +25,12 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** - * @since 2.1 + * @since 2.1 (experimental) + * @deprecated since 2.3. Not supported anymore */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) +@Deprecated public @interface BelongsToProfiles { BelongsToProfile[] value() default {}; diff --git a/sonar-check-api/src/main/java/org/sonar/check/Check.java b/sonar-check-api/src/main/java/org/sonar/check/Check.java index 8a8ae8ef1af..6731d041560 100644 --- a/sonar-check-api/src/main/java/org/sonar/check/Check.java +++ b/sonar-check-api/src/main/java/org/sonar/check/Check.java @@ -25,10 +25,12 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** - * @since 2.1 + * @since 2.1 (experimental) + * @deprecated since 2.3. Use @Rule */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) +@Deprecated public @interface Check { /** diff --git a/sonar-check-api/src/main/java/org/sonar/check/CheckProperty.java b/sonar-check-api/src/main/java/org/sonar/check/CheckProperty.java index 17ac5801e53..935e8e8592d 100644 --- a/sonar-check-api/src/main/java/org/sonar/check/CheckProperty.java +++ b/sonar-check-api/src/main/java/org/sonar/check/CheckProperty.java @@ -25,10 +25,12 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** - * @since 2.1 + * @since 2.1 (experimental) + * @deprecated since 2.3. Use @RuleProperty */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) +@Deprecated public @interface CheckProperty { /** diff --git a/sonar-check-api/src/main/java/org/sonar/check/Message.java b/sonar-check-api/src/main/java/org/sonar/check/Message.java index 0eecb1437c2..94bea04c303 100644 --- a/sonar-check-api/src/main/java/org/sonar/check/Message.java +++ b/sonar-check-api/src/main/java/org/sonar/check/Message.java @@ -21,6 +21,7 @@ package org.sonar.check; import java.util.Locale; +@Deprecated public interface Message { /** diff --git a/sonar-check-api/src/main/java/org/sonar/check/Rule.java b/sonar-check-api/src/main/java/org/sonar/check/Rule.java new file mode 100644 index 00000000000..2b072ccbfa0 --- /dev/null +++ b/sonar-check-api/src/main/java/org/sonar/check/Rule.java @@ -0,0 +1,58 @@ +/* + * 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 org.sonar.check; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * @since 2.3 + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +public @interface Rule { + + /** + * The default key is the class name. + */ + String key() default ""; + + /** + * The rule name. If not defined, then the name is the key + */ + String name() default ""; + + /** + * The description, optional. + */ + String description() default ""; + + /** + * Default priority. + */ + Priority priority() default Priority.MAJOR; + + /** + * Will probably be deprecated and replaced by tags + */ + IsoCategory isoCategory(); +} diff --git a/sonar-check-api/src/main/java/org/sonar/check/RuleProperty.java b/sonar-check-api/src/main/java/org/sonar/check/RuleProperty.java new file mode 100644 index 00000000000..fc545a24163 --- /dev/null +++ b/sonar-check-api/src/main/java/org/sonar/check/RuleProperty.java @@ -0,0 +1,49 @@ +/* + * 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 org.sonar.check; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * @since 2.3 + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.FIELD) +public @interface RuleProperty { + + /** + * The default key is the field name, read by reflection. Overriding this key can be useful when + * obfuscating the code. + */ + String key() default ""; + + /** + * Optional description + */ + String description() default ""; + + /** + * Optional default value. + */ + String defaultValue() default ""; +} |