Dockerized GeoServer micro-services
GeoServer Cloud follows a set of coding standards to ensure code consistency and quality across the project. This document outlines the key standards and how they are enforced.
Code style consistency is enforced using automated tools during the build process. The project uses a build-tools module approach, similar to other major Java projects like Apache Commons, Spring Framework, and Hibernate, to centralize style configuration.
Checkstyle is used to enforce consistent code style and formatting standards. The configuration is located in the build-tools
module.
import java.util.*
) are forbidden to improve code readabilityequals()
and hashCode()
The Checkstyle configuration is stored in the following files:
build-tools/src/main/resources/checkstyle/checkstyle.xml
: Main configurationbuild-tools/src/main/resources/checkstyle/suppressions.xml
: Rules for suppressing certain checksIn addition to Checkstyle, the project uses:
Style checks are run as part of the build process. You can trigger them manually with:
# Run all checks
mvn validate -Dqa -fae -ntp -T1C
# Run only Java formatting checks
mvn validate -Dqa -fae -Dsortpom.skip=true -ntp -T1C
# Run only POM checks
mvn validate -Dqa -fae -Dspotless.skip=true -Dcheckstyle.skip=true -ntp -T1C
To automatically fix style issues:
# Format all files
make format
# Format only Java files
make format-java
# Format only POM files
make format-pom
Most common IDEs can be configured to follow these style guidelines: