SonarQube

SonarQube is a Tool to test a project on code quality, perform automatic reviews and analyze code to detect bugs, code smells and security vulnerabilities.

Setup

brew install sonarqube sonar-scanner
brew services start sonarqube
# SonarQube runs on http://localhost:9000

Connect a Project to SonarQube

# Goto your Maven Repo:
cd ~/Repositories/DemoProject

# make sure you have a ./target:
mvn clean package

# Create a Sonar-Project Properties File:
cat > sonar-project.properties << EOF
sonar.projectKey=company:project
sonar.projectName=DemoProject
sonar.projectVersion=0.1
sonar.sources=src/main/java
sonar.java.binaries=target/classes
sonar.java.source=1.8
EOF

# Run Sonar-Scanner on your project:
sonar-scanner ./