Skip to content

Add braces for ControlStatementBraces PMD rule; fail-on-ControlStatementBraces and exclude LooseCoupling#4440

Closed
shai-almog wants to merge 3 commits intomasterfrom
codex/fix-controlstatementbraces-violations
Closed

Add braces for ControlStatementBraces PMD rule; fail-on-ControlStatementBraces and exclude LooseCoupling#4440
shai-almog wants to merge 3 commits intomasterfrom
codex/fix-controlstatementbraces-violations

Conversation

@shai-almog
Copy link
Collaborator

Motivation

  • Bring source into compliance with PMD ControlStatementBraces by ensuring all control statements use braces to avoid fragile single-line conditionals.
  • Tighten quality gating so future PMD ControlStatementBraces violations fail the quality check while excluding LooseCoupling which is not appropriate for this codebase.

Description

  • Added explicit braces to single-line control statements across the codebase (many files under CodenameOne/src/...), fixing PMD ControlStatementBraces violations (examples: VideoCaptureConstraints, ChartComponent, XYSeries, Deflate, ColorUtil, XYChart, ImageViewer, AsyncResource, and many more).
  • Updated the core unit-tests PMD ruleset maven/core-unittests/pmd.xml to exclude the LooseCoupling rule.
  • Updated the quality gating script .github/scripts/generate-quality-report.py to add ControlStatementBraces to the set of forbidden PMD rules so violations will cause the quality report to fail the build.
  • Minor related cleanups where required to preserve semantics when adding braces (e.g. small formatting adjustments, and a corrected return-brace in AsyncResource.isCancelled).

Testing

  • No automated tests were executed in this change; only code edits and the quality-report/script updates were applied locally.
  • Recommended verification: run the core unit tests and generate quality reports with the Maven command from AGENTS.md: cd maven && mvn clean verify -DunitTests=true -pl core-unittests -am -Dmaven.javadoc.skip=true -Plocal-dev-javase to ensure PMD/SpotBugs checks and unit tests pass.

Codex Task

@shai-almog shai-almog closed this Jan 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant