Skip to content

veraee/fsRelaxSonarRules

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

My Simple Sonar Rules

Build Status

Rules

RelaxedUndocumentedApi: A modified copy of the original "sonar-java UndocumentedApi S1176" as of 20171201, some rules are more relaxed than in the original:

  • If there is only one constructor in the class, you do not need to document the class and the constructor but only either of them - prefer to document the class. Objective: The description for both is almost always the same, as there is nothing to say about the constructor which is not also useful to be mentioned in the class's javadoc.
  • No need to document parameters, return type and thrown Exceptions: If parameters are well-typed and well-named and the method is well-designed (not too many parameters, ...), the documentation of the parameters is only noise in 99%. And in 90% this is also the case for the return type - the method name should document the return type sufficiently. And in 80% this is also the case for the Exception - the Exception class name should document the exceptional case sufficiently.
  • The usual signatures of Exception constructors need not to be documented, as this is only noise.
     Exception()
     Exception(String message)
     Exception(String message, Throwable cause)
     Exception(Throwable cause)
    

Note: This rule's name is "Should document public api"; with classes filter "**" it replaces the original rule "Public types, methods and fields (API) should be documented with Javadoc"

CommonsOldCommonsCurrent: Prefer to use current version of the Apache Commons library:

  • Prefer collections4 over collections
  • Prefer lang3 over lang

Note: This rule's name is "Should use current version of apache commons libraries"

Build hints

Hint for IDE: Run mvn test-compile once before first test, so that the dependencies of the java classes in "src/test/files" ("UT dependencies") are fetched and placed in "target".

IntelliJ IDEA: Run/Debug Configurations -> Before launch: Run Maven Goal: 'mvn test-compile'

Order of build:

  1. Run Maven Goal
  2. Build

Make plugin jar:

  • mvn clean install
  • cp target/fsRelaxSonarRules-main-1.0-SNAPSHOT.jar SONAR/sonarqube-6.6/extensions/plugins/

Releases

Via maven:

  <repositories>
    <repository>
      <id>jitpack.io</id>
      <url>https://jitpack.io</url>
    </repository>
  </repositories>
  
    <dependency>
    
      <groupId>com.github.veraee</groupId>
      <artifactId>fsRelaxSonarRules</artifactId>
      <version>v0.0.1-alpha.1</version>
    </dependency>

or download jar file: https://github.com/veraee/fsRelaxSonarRules/releases/download/v0.0.1-alpha.1/fsRelaxSonarRules-main-1.0-SNAPSHOT.zip