This plugin enables code QA analysis of Java Properties files within SonarQube:
- Computes metrics: lines of code, comments lines, etc.
- Performs more than 15 checks such as: Duplicated keys should be removed, Property with empty value should be removed, Separators should follow a convention, etc.
- Download and install SonarQube
- Install the Java Properties plugin either by a direct download or through the Update Center.
- Install your favorite analyzer (SonarQube Runner, Maven, etc.) and analyze your code.
-
Java properties files are expected to be encoded in ISO-8859-1 as stated in Java specifications. During analysis, the following error may indicate that the file is not encoded in ISO-8859-1:
Caused by: java.lang.IllegalArgumentException: Unable to highlight file \[moduleKey=xxx, relative=xxx, basedir=xxx\] from offset 808 to offset 876 at org.sonar.api.batch.sensor.highlighting.internal.DefaultHighlighting.highlight(DefaultHighlighting.java:85) at org.sonar.batch.source.DefaultHighlightable$DefaultHighlightingBuilder.highlight(DefaultHighlightable.java:79) at org.sonar.jproperties.ast.visitors.SyntaxHighlighterVisitor.visitNode(SyntaxHighlighterVisitor.java:93) at com.sonar.sslr.impl.ast.AstWalker.visitNode(AstWalker.java:114) ...