]> source.dussan.org Git - sonarqube.git/commitdiff
Fix violations reported on Nemo, fix JavaDocs
authorGodin <mandrikov@gmail.com>
Tue, 30 Nov 2010 18:34:03 +0000 (18:34 +0000)
committerGodin <mandrikov@gmail.com>
Tue, 30 Nov 2010 18:34:03 +0000 (18:34 +0000)
sonar-plugin-api/src/main/java/org/sonar/api/batch/AbstractFileComplexityDecorator.java
sonar-plugin-api/src/main/java/org/sonar/api/batch/AbstractFunctionComplexityDecorator.java
sonar-plugin-api/src/main/java/org/sonar/api/batch/AbstractFunctionComplexityDistributionDecorator.java
sonar-plugin-api/src/main/java/org/sonar/api/batch/DecoratorContext.java
sonar-plugin-api/src/main/java/org/sonar/api/batch/SensorContext.java
sonar-plugin-api/src/main/java/org/sonar/api/resources/Library.java
sonar-plugin-api/src/main/java/org/sonar/api/resources/ProjectFileSystem.java
sonar-plugin-api/src/main/java/org/sonar/api/resources/Resource.java
sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceUtils.java

index 37945f608bd3300e7b0656528844e612e6bcf239..b20016abef408f53fd10bd5c6c92731f94e0113d 100644 (file)
@@ -31,9 +31,10 @@ import java.util.Arrays;
 import java.util.List;
 
 /**
- * @deprecated a formula has been implemented on the metric, so no need to have decorator anymore
- * @since 2.1
+ * @deprecated since 2.1, a formula has been implemented on the metric, so no need to have decorator anymore
+ * @since 1.10
  */
+@Deprecated
 public abstract class AbstractFileComplexityDecorator implements Decorator {
 
   private Language language;
index 1a17608f1d79606ed81c821f8c061bc650849584..2406a8868c06b49ccd2926e291e2398c7b834928 100644 (file)
@@ -30,9 +30,10 @@ import java.util.Arrays;
 import java.util.List;\r
 \r
 /**\r
- * @deprecated a formula has been implemented on the metric, so no need to have decorator anymore\r
- * @since 2.1\r
+ * @deprecated since 2.1, a formula has been implemented on the metric, so no need to have decorator anymore\r
+ * @since 1.13\r
  */\r
+@Deprecated\r
 public abstract class AbstractFunctionComplexityDecorator implements Decorator {\r
 \r
   private Language language;\r
index e6323ffa720c022826d3b559e65c0e61589b6f97..6ea9adeefeb0c6bf48a21d3ac354e9caacb6a4ac 100644 (file)
 \r
 package org.sonar.api.batch;\r
 \r
-import org.sonar.api.measures.CountDistributionBuilder;\r
 import org.sonar.api.measures.CoreMetrics;\r
-import org.sonar.api.measures.Metric;\r
+import org.sonar.api.measures.CountDistributionBuilder;\r
 import org.sonar.api.measures.Measure;\r
+import org.sonar.api.measures.Metric;\r
+import org.sonar.api.resources.Language;\r
 import org.sonar.api.resources.Project;\r
 import org.sonar.api.resources.Resource;\r
-import org.sonar.api.resources.Language;\r
-\r
 \r
 /**\r
- * @deprecated a formula has been implemented on the metric, so no need to have decorator anymore\r
- * @since 2.1\r
+ * @deprecated since 2.1, a formula has been implemented on the metric, so no need to have decorator anymore\r
+ * @since 2.0\r
  */\r
+@Deprecated\r
 public abstract class AbstractFunctionComplexityDistributionDecorator implements Decorator {\r
 \r
   private CountDistributionBuilder builder = new CountDistributionBuilder(CoreMetrics.FUNCTION_COMPLEXITY_DISTRIBUTION);\r
index 837cb557978ca13437eb31c166df36c39c78e25a..dc5c5b9dc58a783083eb9ae3fecd6a8a07b72c7d 100644 (file)
@@ -50,10 +50,8 @@ public interface DecoratorContext {
   /**
    * Child contexts are read only
    */
-
   List<DecoratorContext> getChildren();
 
-
   // MEASURES
 
   /**
@@ -76,21 +74,21 @@ public interface DecoratorContext {
    */
   Collection<Measure> getChildrenMeasures(Metric metric);
 
-
   /**
    * Add a measure on the current resource. It can not be executed from children contexts.
-   *
+   * 
    * @return the same context
    */
   DecoratorContext saveMeasure(Measure measure);
 
   /**
    * Add a measure on the current resource. It can not be executed from children contexts.
-   *
+   * 
    * @return the current object
    */
   DecoratorContext saveMeasure(Metric metric, Double value);
 
+  // DEPENDENCIES
 
   Dependency saveDependency(Dependency dependency);
 
@@ -100,7 +98,6 @@ public interface DecoratorContext {
 
   Collection<Dependency> getOutgoingDependencies();
 
-
   // RULES
 
   /**
@@ -112,7 +109,7 @@ public interface DecoratorContext {
    * Save a coding rule violation. The decorator which calls this method must be depended upon BatchBarriers.END_OF_VIOLATIONS_GENERATION.
    * 
    * @since 2.5
-   * @param force allows to force creation of violation even if it was supressed by {@link org.sonar.api.rules.ViolationFilter}
+   * @param force allows to force creation of violation even if it was suppressed by {@link org.sonar.api.rules.ViolationFilter}
    */
   DecoratorContext saveViolation(Violation violation, boolean force);
 
@@ -121,6 +118,8 @@ public interface DecoratorContext {
    */
   DecoratorContext saveViolation(Violation violation);
 
+  // EVENTS
+
   /**
    * @return the list of events associated to the current resource
    */
@@ -128,22 +127,20 @@ public interface DecoratorContext {
 
   /**
    * Creates an event for a given date
-   *
-   * @param name        the event name
+   * 
+   * @param name the event name
    * @param description the event description
-   * @param category    the event category
-   * @param date        the event date
+   * @param category the event category
+   * @param date the event date
    * @return the created event
    */
   Event createEvent(String name, String description, String category, Date date);
 
   /**
    * Deletes an event
-   *
+   * 
    * @param event the event to delete
    */
   void deleteEvent(Event event);
 
-
-
 }
index e1082ecdf3e14cb8486b8b5910d7d326c6944837..ae0f10862c4e85cb712c1c6b89ea4b19c518b5a9 100644 (file)
@@ -59,7 +59,6 @@ public interface SensorContext {
    */
   Measure saveMeasure(Metric metric, Double value);
 
-
   // ----------- MEASURES ON RESOURCES --------------
 
   /**
@@ -69,7 +68,7 @@ public interface SensorContext {
 
   /**
    * Key is updated when saving the resource.
-   *
+   * 
    * @return the key as saved in database. Null if the resource is set as excluded.
    */
   String saveResource(Resource resource);
@@ -86,19 +85,22 @@ public interface SensorContext {
 
   /**
    * Add or update a measure.
-   * <p/>
-   * <p>The resource is automatically saved, so there is no need to execute the method saveResource(). Does nothing if the resource is set as excluded.</p>
+   * <p>
+   * The resource is automatically saved, so there is no need to execute the method saveResource(). Does nothing if the resource is set as
+   * excluded.
+   * </p>
    */
   Measure saveMeasure(Resource resource, Metric metric, Double value);
 
   /**
    * Add or update a measure.
-   * <p/>
-   * <p>The resource is automatically saved, so there is no need to execute the method saveResource(). Does nothing if the resource is set as excluded.</p>
+   * <p>
+   * The resource is automatically saved, so there is no need to execute the method saveResource(). Does nothing if the resource is set as
+   * excluded.
+   * </p>
    */
   Measure saveMeasure(Resource resource, Measure measure);
 
-
   // ----------- RULE VIOLATIONS --------------
 
   /**
@@ -108,7 +110,7 @@ public interface SensorContext {
    * @param force allows to force creation of violation even if it was supressed by {@link org.sonar.api.rules.ViolationFilter}
    */
   void saveViolation(Violation violation, boolean force);
-  
+
   /**
    * Save a coding rule violation.
    */
@@ -119,8 +121,7 @@ public interface SensorContext {
    */
   void saveViolations(Collection<Violation> violations);
 
-
-  // ----------- DEPENDENCIES BETWEEN RESOURCES  --------------
+  // ----------- DEPENDENCIES BETWEEN RESOURCES --------------
 
   /**
    * Build a new dependency : from depends upon to. The dependency is NOT saved. The method saveDependency() must still be executed.
@@ -133,19 +134,18 @@ public interface SensorContext {
 
   Collection<Dependency> getOutgoingDependencies(Resource from);
 
-  // ----------- FILE SOURCES  --------------
+  // ----------- FILE SOURCES --------------
 
   /**
    * Does nothing if the resource is set as excluded.
    */
   void saveSource(Resource resource, String source);
 
-
   // ----------- LINKS --------------
 
   /**
-   * add a link to an external page like project homepage, sources (subversion, ...), continuous integration server...
-   * Example : context.addLink(new ProjectLink("maven_site, "Maven site", "http://my.maven.com)
+   * add a link to an external page like project homepage, sources (subversion, ...), continuous integration server... Example :
+   * context.addLink(new ProjectLink("maven_site, "Maven site", "http://my.maven.com)
    */
   void saveLink(ProjectLink link);
 
@@ -154,7 +154,6 @@ public interface SensorContext {
    */
   void deleteLink(String key);
 
-
   // ----------- EVENTS --------------
 
   /**
@@ -164,18 +163,18 @@ public interface SensorContext {
 
   /**
    * Creates an event for a given date
-   *
-   * @param name        the event name
+   * 
+   * @param name the event name
    * @param description the event description
-   * @param category    the event category
-   * @param date        the event date
+   * @param category the event category
+   * @param date the event date
    * @return the created event
    */
   Event createEvent(Resource resource, String name, String description, String category, Date date);
 
   /**
    * Deletes an event
-   *
+   * 
    * @param event the event to delete
    */
   void deleteEvent(Event event);
index 84daac57437ae45fc286c84f9767bb6d21bf5263..1681a06b108ede7ae2f3e8a7f676723b3b0e7da7 100644 (file)
@@ -68,7 +68,7 @@ public class Library extends Resource {
 
   @Override
   public String getScope() {
-    return Resource.SCOPE_PROJECT;
+    return Resource.SCOPE_SET;
   }
 
   @Override
index 24a47bfe1a07014a32abb90bb3388e6357dee016..d6ef7c3a0e68da8f61a9842aa79ea5f3173a1bd8 100644 (file)
@@ -29,8 +29,7 @@ import java.util.List;
  */
 public interface ProjectFileSystem {
   /**
-   * Source encoding. It's the default plateform charset if it is not defined in the project
-   * (Maven property 'project.build.sourceEncoding').
+   * Source encoding. It's the default platform charset if it is not defined in the project (Maven property 'project.build.sourceEncoding').
    */
   Charset getSourceCharset();
 
@@ -59,20 +58,20 @@ public interface ProjectFileSystem {
   File getSonarWorkingDirectory();
 
   /**
-   * Get file from path. It can be absolute or relative to project basedir. For example resolvePath("pom.xml") or resolvePath("src/main/java")
+   * Get file from path. It can be absolute or relative to project basedir. For example resolvePath("pom.xml") or
+   * resolvePath("src/main/java")
    */
   File resolvePath(String path);
 
   /**
    * Source files, excluding unit tests and files matching project exclusion patterns.
-   *
+   * 
    * @param langs language filter. Check all files, whatever their language, if null or empty.
    */
   List<File> getSourceFiles(Language... langs);
 
   /**
-   * Java source files, excluding unit tests and files matching project exclusion patterns.
-   * Shortcut for getSourceFiles(Java.INSTANCE)
+   * Java source files, excluding unit tests and files matching project exclusion patterns. Shortcut for getSourceFiles(Java.INSTANCE)
    */
   List<File> getJavaSourceFiles();
 
@@ -93,7 +92,7 @@ public interface ProjectFileSystem {
 
   /**
    * Save data into a new file of Sonar working directory.
-   *
+   * 
    * @return the created file
    */
   File writeToWorkingDirectory(String content, String fileName) throws IOException;
index 32862e6bd7df3c054fc5e4f75d183c6aaf87805b..0b470243b6705ba0800b50ae6dcd01efff6991d1 100644 (file)
@@ -21,7 +21,7 @@ package org.sonar.api.resources;
 
 /**
  * The interface to implement to create a resource in Sonar
- *
+ * 
  * @since 1.10
  */
 public abstract class Resource<PARENT extends Resource> {
@@ -29,26 +29,25 @@ public abstract class Resource<PARENT extends Resource> {
   public static final String SCOPE_SET = "PRJ";
   public static final String SCOPE_SPACE = "DIR";
   public static final String SCOPE_ENTITY = "FIL";
-  
+
   /**
-   * Use SCOPE_SET instead
+   * @deprecated since 1.11, use {@link #SCOPE_SET} instead.
    */
   @Deprecated
   public static final String SCOPE_PROJECT = SCOPE_SET;
 
   /**
-   * Use SCOPE_SPACE instead
+   * @deprecated since 1.11, use {@link #SCOPE_SPACE} instead.
    */
   @Deprecated
   public static final String SCOPE_DIRECTORY = SCOPE_SPACE;
 
   /**
-   * Use SCOPE_ENTITY instead
+   * @deprecated since 1.11, use {@link #SCOPE_ENTITY} instead.
    */
   @Deprecated
   public static final String SCOPE_FILE = SCOPE_ENTITY;
 
-
   public static final String QUALIFIER_VIEW = "VW";
   public static final String QUALIFIER_SUBVIEW = "SVW";
   public static final String QUALIFIER_LIB = "LIB";
@@ -63,13 +62,13 @@ public abstract class Resource<PARENT extends Resource> {
   public static final String QUALIFIER_UNIT_TEST_CLASS = "UTS";
 
   /**
-   * Use QUALIFIER_PROJECT instead
+   * @deprecated since 1.11, use {@link #QUALIFIER_PROJECT} instead.
    */
   @Deprecated
   public static final String QUALIFIER_PROJECT_TRUNK = QUALIFIER_PROJECT;
 
   /**
-   * Use QUALIFIER_MODULE instead
+   * @deprecated since 1.11, use {@link #QUALIFIER_MODULE} instead.
    */
   @Deprecated
   public static final String QUALIFIER_PROJECT_BRANCH = QUALIFIER_MODULE;
@@ -82,7 +81,6 @@ public abstract class Resource<PARENT extends Resource> {
 
   private boolean isExcluded = false;
 
-
   /**
    * @return the resource key
    */
@@ -126,20 +124,20 @@ public abstract class Resource<PARENT extends Resource> {
 
   /**
    * The parent is used to build the resources tree, for example for relations between classes, packages and projects.
-   * <p>Return null if the parent is the project.</p>
+   * <p>
+   * Return null if the parent is the project.
+   * </p>
    */
   public abstract PARENT getParent();
 
   /**
-   * Check resource against an Ant pattern, like mypackag?/*Foo.java. It's used for example
-   * to match resource exclusions.
-   *
+   * Check resource against an Ant pattern, like mypackag?/*Foo.java. It's used for example to match resource exclusions.
+   * 
    * @param antPattern Ant-like pattern (with **, * and ?). It includes file suffixes.
    * @return true if the resource matches the Ant pattern
    */
   public abstract boolean matchFilePattern(String antPattern);
 
-
   public final Integer getId() {
     return id;
   }
index 830478bede908e7167fbc70c7a5ddfc85c932359..e243e8b044ae6b266de75d4678314fe80095309b 100644 (file)
@@ -49,7 +49,7 @@ public final class ResourceUtils {
   }
 
   /**
-   * @return whther a resource is a maven module of  project
+   * @return whether a resource is a maven module of project
    */
   public static boolean isModuleProject(Resource resource) {
     return Resource.QUALIFIER_MODULE.equals(resource.getQualifier());
@@ -62,7 +62,6 @@ public final class ResourceUtils {
     return resource != null && Resource.QUALIFIER_PACKAGE.equals(resource.getQualifier());
   }
 
-
   /**
    * @return whether a resource is a set
    */
@@ -92,20 +91,19 @@ public final class ResourceUtils {
   }
 
   /**
-   * Alias for isDirectory(resource)
+   * Alias for {@link #isSpace(Resource)}
    */
   public static boolean isDirectory(Resource resource) {
     return isSpace(resource);
   }
 
   /**
-   * Alias for isEntity(resource)
+   * Alias for {@link #isEntity(Resource)}
    */
   public static boolean isFile(Resource resource) {
     return isEntity(resource);
   }
 
-
   /* QUALIFIERS */
 
   /**
@@ -115,7 +113,6 @@ public final class ResourceUtils {
     return Resource.QUALIFIER_CLASS.equals(resource.getQualifier());
   }
 
-
   /**
    * @return whether a resource is a unit test class
    */
@@ -123,7 +120,9 @@ public final class ResourceUtils {
     return Resource.QUALIFIER_UNIT_TEST_CLASS.equals(resource.getQualifier());
   }
 
-
+  /**
+   * @return whether a resource is a library
+   */
   public static boolean isLibrary(Resource resource) {
     return Resource.QUALIFIER_LIB.equals(resource.getQualifier());
   }