Skip to content

Enforce Checkstyle in CI: failsOnError/failOnViolation are disabled #21

Description

@devops-thiago

Background

Checkstyle is configured in pom.xml with failsOnError=false and failOnViolation=false, and the CI job runs mvn checkstyle:check with continue-on-error: true (.github/workflows/ci.yml). The Checkstyle step can therefore never fail the build or the pipeline — the check is decorative.

Impact

  • Code style violations are never surfaced to developers or blocked at merge time.
  • The README advertises Checkstyle as part of the "automated code quality" story, which is misleading.
  • Style drift accumulates over time; Spotless only enforces formatting, not style rules.

How to reproduce

  1. Introduce a Checkstyle violation (e.g. a line exceeding the configured limit or a missing Javadoc where required).
  2. Run mvn checkstyle:check — violations are reported but the build exits 0.
  3. Push to a branch — the code-quality CI job reports Checkstyle failures with continue-on-error and still passes.

Where the fix should land

Decide on an enforcement policy, then:

  • Set failsOnError=true and failOnViolation=true in pom.xml and fix the violations that surface.
  • Remove continue-on-error: true from the Checkstyle step in .github/workflows/ci.yml.
  • Consider adding a checked-in checkstyle.xml (currently none exists; the plugin falls back to google_checks.xml) if stricter rules are desired.

Files touched

  • pom.xml
  • .github/workflows/ci.yml
  • checkstyle.xml (new, optional)

Acceptance criteria

  • mvn checkstyle:check exits non-zero on a deliberately introduced violation.
  • CI code-quality job fails when Checkstyle reports violations.
  • The existing codebase passes the enforced rules (no build regressions).
  • mvn test is green.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingjavaPull requests that update java code

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions