Code Quality Tools

April 23, 2026 ยท View on GitHub

See also: Building


Overview

The build is configured with four code-quality tools that run automatically in CI:

ToolWhat It Checks
CheckStyleCode style and naming conventions
SpotBugsPotential bugs via static analysis
RevapiBreaking API changes against the latest GA release
JaCoCoTest coverage thresholds

All four are configured to fail the build on violations.
Always run them locally before opening a pull request.


Running CheckStyle and SpotBugs Locally

mvn spotbugs:check checkstyle:checkstyle-aggregate \
  -DskipTests -Dgpg.skip \
  -pl "<groupId>:<artifactId>" -am

Example for azure-core:

mvn spotbugs:check checkstyle:checkstyle-aggregate \
  -DskipTests -Dgpg.skip \
  -pl "com.azure:azure-core" -am

Testing for Breaking API Changes (Revapi)

mvn revapi:check

This compares the current API surface against the latest GA version on Maven Central and reports any incompatible changes.


Generating HTML Quality Reports

mvn install site:site site:stage -Dgpg.skip

Report output locations:

ReportPath
SpotBugseng/spotbugs-aggregate-report/target/spotbugs/spotbugsXml.html
CheckStyletarget/staging/checkstyle-aggregate.html
JavaDoctarget/staging/apidocs/index.html
Revapitarget/staging/revapi-aggregate-report.html
Maven Sitetarget/staging/index.html

Generating JaCoCo Coverage Report

mvn test -Dgpg.skip -Dinclude-non-shipping-modules

Report: eng/jacoco-test-coverage/target/site/test-coverage/index.html


Skipping Analysis During Local Development

Add these flags to any Maven command for a faster local build:

-Dmaven.javadoc.skip=true -Dcheckstyle.skip=true -Dspotbugs.skip=true -Drevapi.skip=true

Do not skip these in your final PR build. CI will check them regardless.


Configuration Files

The linting configuration files live under eng/lintingconfigs/:

FilePurpose
eng/lintingconfigs/checkstyle/track2/checkstyle.xmlCheckStyle rules
eng/lintingconfigs/checkstyle/track2/checkstyle-suppressions.xmlPer-module suppressions
eng/lintingconfigs/spotbugs/spotbugs-exclude.xmlSpotBugs exclusion filters

Adding a CheckStyle Suppression

If a package has a legitimately long name (approved by architects), add a suppression:

<!-- eng/lintingconfigs/checkstyle/track2/checkstyle-suppressions.xml -->
<suppress checks="PackageName" files="com/azure/resourcemanager/<verylongsegment>/.*\.java"/>

Important: Never disable CheckStyle or SpotBugs rules globally.
File-scoped suppressions require justification in the PR description.


Javadoc Guidelines