Skip to content

ci: enforce formatting with fmt:check instead of silent reformat - #490

Merged
AndreasIgel merged 1 commit into
java-helpers:mainfrom
igel-devin-ai:fmt-check-enforcement
Dec 5, 2026
Merged

AndreasIgel merged 1 commit into
java-helpers:mainfrom
igel-devin-ai:fmt-check-enforcement

Conversation

@igel-devin-ai

Copy link
Copy Markdown
Contributor

Summary

The build bound fmt:format, which silently rewrites unformatted sources during CI instead of failing. Two problems with that:

  1. formatting violations never surface — contributors and reviewers never learn the code was misformatted
  2. it corrupts coverage measurement: compiled classes correspond to the rewritten sources, while the Sonar analysis runs on the committed sources. Line numbers in the jacoco XML then fall out of range and the coverage import is silently dropped per file — observed on feat: model and render fields and constructors in nested types (#487) #488 where the scanner logged Line 696 is out of range in the file RoasterCodeGenerator.java (lines: 695) and the whole file showed 0% coverage despite thorough tests

Change

  • execution goal format → check: the build fails with a clear message when sources are not formatted
  • CONTRIBUTING.md updated: run mvn fmt:format before committing

Verified: main is currently fmt-clean (0 non-complying files across all modules), so no reformat commit is needed.

The build bound fmt:format, which silently reformatted sources during
CI instead of failing on violations. Besides hiding formatting problems
from contributors, this corrupted coverage measurement: compiled
classes corresponded to the rewritten sources while Sonar analysis
runs on the committed sources, so jacoco line numbers fell out of
range and coverage imports were silently dropped per file (observed
on java-helpers#488 for RoasterCodeGenerator and BuilderDefinitionCreator).

The build now fails with a clear message when sources are not
formatted; contributors run 'mvn fmt:format' before committing.
@sonarqubecloud

sonarqubecloud Bot commented Dec 5, 2026

Copy link
Copy Markdown

@AndreasIgel
AndreasIgel merged commit 1feabae into java-helpers:main Dec 5, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants