Skip to content

HPCC4J-791 Add automated code formatting - #978

Open
rpastrana wants to merge 1 commit into
hpcc-systems:candidate-9.12.xfrom
rpastrana:HPCC4J-791-formatting-enhancementNEW
Open

HPCC4J-791 Add automated code formatting#978
rpastrana wants to merge 1 commit into
hpcc-systems:candidate-9.12.xfrom
rpastrana:HPCC4J-791-formatting-enhancementNEW

Conversation

@rpastrana

@rpastrana rpastrana commented Mar 12, 2026

Copy link
Copy Markdown
Member
  • Add formatter-maven-plugin to pom.xml with validate/format goals
  • Enhance copilot-instructions.md with detailed Eclipse formatting enforcement rules
  • Fix 8 critical Eclipse formatter settings to minimize disruptive changes:
  • Add Code Formatting section to README.md with usage examples
  • Enable 'mvn formatter:validate' for CI and 'mvn formatter:format' for auto-fixing"

Type of change:

  • This change is a bug fix (non-breaking change which fixes an issue).
  • This change is a new feature (non-breaking change which adds functionality).
  • This change is a breaking change (fix or feature that will cause existing behavior to change).

Custom Platform Testing (Optional)

Custom HPCC-Platform Repository:
repository:

Custom HPCC-Platform Branch:
branch:

Checklist:

  • I have created a corresponding JIRA ticket for this submission
  • My code follows the code style of this project.
    • I have applied the Eclipse code-format template provided.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly, or...
    • I have created a JIRA ticket to update the documentation.
    • Any new interfaces or exported functions are appropriately commented.
  • I have read the HPCC Systems CONTRIBUTORS document (https://github.com/hpcc-systems/HPCC-Platform/wiki/Guide-for-contributors).
  • The change has been fully tested:
    • This change does not cause any existing JUnits to fail.
    • I have include JUnit coverage to test this change
    • I have performed system test and covered possible regressions and side effects.
  • I have given due consideration to all of the following potential concerns:
    • Scalability
    • Performance
    • Security
    • Thread-safety
    • Premature optimization
    • This change fixes the problem, not just the symptom

Testing:

- Add formatter-maven-plugin to pom.xml with validate/format goals
- Enhance copilot-instructions.md with detailed Eclipse formatting enforcement rules
- Fix 8 critical Eclipse formatter settings to minimize disruptive changes:
- Add Code Formatting section to README.md with usage examples
- Enable 'mvn formatter:validate' for CI and 'mvn formatter:format' for auto-fixing"

Signed-off-by: Rodrigo Pastrana <rodrigo.pastrana@lexisnexisrisk.com>
@rpastrana
rpastrana requested a review from Copilot March 12, 2026 18:05
@github-actions

Copy link
Copy Markdown

Jira Issue: https://hpccsystems.atlassian.net/browse/HPCC4J-791

Jirabot Action Result:
Workflow Transition To: Merge Pending
Additional PR: #978

@github-actions

Copy link
Copy Markdown

🔄 Upmerge Test Results

Status: ✅ All branches merged successfully
PR: #978 - HPCC4J-791 Add automated code formatting
Base Branch: candidate-9.12.x
Test Time: 2026-03-12 18:06:04 UTC

✅ Successful Branches (5)

  • candidate-9.12.x
  • candidate-9.14.x
  • candidate-10.0.x
  • candidate-10.2.x
  • master
    This comment was automatically generated by the upmerge test workflow.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an automated Java formatting workflow (Eclipse formatter config + Maven plugin + docs) so formatting can be validated in CI and applied locally.

Changes:

  • Adds formatter-maven-plugin configuration to the parent pom.xml
  • Tweaks several Eclipse formatter settings to reduce disruptive reformat diffs
  • Documents formatter usage in README.md and adds detailed formatting guidance in .github/copilot-instructions.md

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
pom.xml Introduces formatter-maven-plugin and binds an execution to the Maven lifecycle
eclipse/HPCC-JAVA-Formatter.xml Updates several Eclipse formatter settings (alignment/brace/newline behaviors)
README.md Adds a “Code Formatting” section with formatter:validate / formatter:format usage
.github/copilot-instructions.md Expands formatting rules and review expectations for contributors

Comment thread pom.xml
Comment on lines +300 to +329
<plugin>
<groupId>net.revelc.code.formatter</groupId>
<artifactId>formatter-maven-plugin</artifactId>
<version>${formatter.maven.plugin.version}</version>
<configuration>
<configFile>${maven.multiModuleProjectDirectory}/eclipse/HPCC-JAVA-Formatter.xml</configFile>
<encoding>UTF-8</encoding>
<lineEnding>LF</lineEnding>
<directories>
<directory>${project.basedir}/src/main/java</directory>
<directory>${project.basedir}/src/test/java</directory>
</directories>
<excludes>
<!-- Exclude generated code -->
<exclude>**/gen/**</exclude>
<exclude>**/ws/client/gen/**</exclude>
<exclude>**/wrappers/gen/**</exclude>
<exclude>**/antlr/**/*.java</exclude>
</excludes>
</configuration>
<executions>
<execution>
<id>format-check</id>
<goals>
<goal>format</goal>
</goals>
<phase>validate</phase>
</execution>
</executions>
</plugin>

Copilot AI Mar 12, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The execution is bound to the validate phase but runs the format goal, which will modify sources during normal builds/CI (e.g., mvn test), rather than failing the build on violations. To match the PR intent (validate in CI, format only when explicitly invoked), bind the validate goal to the validate phase, and keep format as a developer-invoked goal (or gate it behind an opt-in profile/property).

Copilot uses AI. Check for mistakes.
Comment thread README.md

This project uses the Eclipse formatter configuration (`eclipse/HPCC-JAVA-Formatter.xml`) to ensure consistent Java code formatting. You can format code using Maven commands:

**Validate formatting** (check for violations without modifying files):

Copilot AI Mar 12, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs describe formatter:validate as the CI-friendly check, but the current pom.xml binds formatter:format to the Maven validate phase, meaning a standard build will auto-modify files. Either update the pom.xml execution to run validate (preferred) or adjust this documentation to reflect that formatting occurs automatically during the lifecycle.

Copilot uses AI. Check for mistakes.
- **Blank lines**:
- 1 line after package declaration
- 1 line after import section
- 1 line between methods

Copilot AI Mar 12, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This guidance conflicts with the updated Eclipse formatter setting blank_lines_before_method (now 0 in eclipse/HPCC-JAVA-Formatter.xml), so Copilot would be instructed to flag/require something the formatter won’t enforce. Please align these bullet points with the actual formatter configuration (or revert the formatter change if 1 blank line between methods is the desired standard).

Suggested change
- 1 line between methods
- Follow Eclipse formatter configuration for blank lines between methods (currently 0 configured blank lines before methods)

Copilot uses AI. Check for mistakes.

@jpmcmu jpmcmu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rpastrana Looks good to me

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.

3 participants