☕️ SonarJava : Java static analyzer for SonarQube & SonarLint
Java HTML Other
Latest commit 34005f6 Mar 28, 2017 @saberduck saberduck committed with benzonico SONARJAVA-872 Detect null passed as encoding for commons-io (#1344)
* SONARJAVA-872 add copy method on MethodMatcher

* SONARJAVA-872 Detect methods with charset argument set to null literal

* SONARJAVA-872 review feedback
Permalink
Failed to load latest commit information.
its SONARJAVA-872 add signatures from commons-io (#1340) Mar 27, 2017
java-checks-testkit SONARJAVA-2197 Improve log message when JSON file for rule is not fou… Mar 23, 2017
java-checks SONARJAVA-872 Detect null passed as encoding for commons-io (#1344) Mar 28, 2017
java-frontend SONARJAVA-872 Detect null passed as encoding for commons-io (#1344) Mar 28, 2017
java-jacoco-previous Prepare for next development iteration Mar 23, 2017
java-jacoco Prepare for next development iteration Mar 23, 2017
java-maven-model Prepare for next development iteration Mar 23, 2017
java-surefire Prepare for next development iteration Mar 23, 2017
sonar-jacoco-listeners Prepare for next development iteration Mar 23, 2017
sonar-java-plugin SONARJAVA-2108 Allow usage of lines for secondaries instead of whole … Mar 23, 2017
.cix.yml SONARJAVA-1689 Remove sonar-compat module Jun 6, 2016
.gitattributes Fix quality flaw: Coverage on missing new line Mar 2, 2017
.gitignore Fix issue for maven analysis Sep 9, 2015
.gitmodules Use submodule for it sources Aug 14, 2015
.travis.yml travis: remove resolver-status.properties from .m2 before caching (#980) Aug 22, 2016
CONTRIBUTING.md Improve contrib guidelines (#1006) Sep 22, 2016
LICENSE.txt Add License and copyright files (#1143) Dec 19, 2016
NOTICE.txt Add NOTICE.txt file [ci skip] Jan 10, 2017
PULL_REQUEST_TEMPLATE.md Update Readme, pom metadatas and add contributing and pr template files Apr 11, 2016
README.md README: Fix broken links, use https (#1339) Mar 27, 2017
cix.sh Stop running every tests all the time (#915) Jun 30, 2016
pom.xml Prepare for next development iteration Mar 23, 2017
third-party-licenses.sh Add License and copyright files (#1143) Dec 19, 2016
travis.sh Enable the generation of Javadoc on the master branch Oct 14, 2016

README.md

SonarJava Build Status

SonarJava is a code analyzer for Java projects. Information about the SonarJava features is available here.

Build status (all branches)

Build Status

Features

Useful links

Have question or feedback?

To provide feedback (request a feature, report a bug etc.) use the SonarQube Google Group. Please do not forget to specify the language (Java!), plugin version and SonarQube version. If you have a question on how to use plugin (and the docs don't help you) direct it to Stack Overflow tagged both sonarqube and java.

Contributing

Topic in SonarQube Google Group

To request a new feature, please create a new thread in SonarQube Google Group. Even if you plan to implement it yourself and submit it back to the community, please start a new thread first to be sure that we can use it.

Pull Request (PR)

To submit a contribution, create a pull request for this repository. Please make sure that you follow our code style and all tests are passing (Travis build is created for each PR).

Custom Rules

If you have an idea for a rule but you are not sure that everyone needs it you can implement a custom rule available only for you.

Testing

To run tests locally follow these instructions.

Build the Project and Run Unit Tests

To build the plugin and run its unit tests, execute this command from the project's root directory:

mvn clean package

Note: You need to run the package goal because the jacoco-previous module will shade JaCoCo to support two binary format of JaCoCo. This shading mechanism is bound to maven package phase and is required for other modules to compile.

Integration Tests

To run integration tests, you will need to create a properties file like the one shown below, and set the url pointing to its location in an environment variable named ORCHESTRATOR_CONFIG_URL.

# version of SonarQube Server
sonar.runtimeVersion=5.6

orchestrator.updateCenterUrl=http://update.sonarsource.org/update-center-dev.properties

With for instance the ORCHESTRATOR_CONFIG_URL variable being set as:

export ORCHESTRATOR_CONFIG_URL=file:///home/user/workspace/orchestrator.properties

Before running the ITs, be sure your MAVEN_HOME environment variable is set.

Plugin Test

The "Plugin Test" is an additional integration test which verifies plugin features such as metric calculation, coverage etc. To launch it:

mvn clean install -Pit-plugin

Ruling Test

The "Ruling Test" is a special integration test which launches the analysis of a large code base, saves the issues created by the plugin in report files, and then compares those results to the set of expected issues (stored as JSON files).

To run the test, first make sure the submodules are checked out:

git submodule init 
git submodule update

Launch ruling test:

cd its/ruling
mvn clean install -DskipTests=false

This test gives you the opportunity to examine the issues created by each rule and make sure they're what you expect. You can inspect new/lost issues checking web-pages mentioned in the logs at the end of analysis:

INFO  - HTML Issues Report generated: /path/to/project/sonar-java/its/sources/src/.sonar/issues-report/issues-report.html
INFO  - Light HTML Issues Report generated: /path/to/project/sonar-java/its/sources/src/.sonar/issues-report/issues-report-light.html

If everything looks good to you, you can copy the file with the actual issues located at:

its/ruling/target/actual/

Into the directory with the expected issues:

its/ruling/src/test/resources/

For example using the command:

cp its/ruling/target/actual/* its/ruling/src/test/resources/

License

Copyright 2012-2017 SonarSource.

Licensed under the GNU Lesser General Public License, Version 3.0