Skip to content

Spotless formatter#110

Open
jennatripoli wants to merge 15 commits into
mainfrom
Jenna-SpotlessFormatter
Open

Spotless formatter#110
jennatripoli wants to merge 15 commits into
mainfrom
Jenna-SpotlessFormatter

Conversation

@jennatripoli

@jennatripoli jennatripoli commented Nov 30, 2025

Copy link
Copy Markdown
Contributor

Added Spotless code formatter to build.gradle to enable the Gradle command spotlessApply to apply formatting rules to all files. Specifically, these rules follow the Google Java Style Guide.

I opted to not apply the changes here since (for now) I do not think we need to apply the formatting to this repository. I created a branch (Jenna-SpotlessFormatterApply) where I ran the formatter so the changes can be viewed there. The main violations included the line length and blank lines.

The spotlessCheck command was modified from its out-of-the-box version to warn rather than error when there are formatting violations. This is in an effort to not create barriers to the development workflow, especially during high-impact times like competition.

When the check fails, the following message appears in the console:

═════════════════════════════════════════════════
Spotless found formatting violations in Java!

1. Open the WPILib Command Palette
2. Select WPILib: Run a command with Gradle

Run spotlessCheck to see the violations
Run spotlessApply to automatically fix violations
═════════════════════════════════════════════════

@jennatripoli jennatripoli Nov 30, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

google-java-format fails when imports are not continuous, which in this case is caused by the commented lines

@jennatripoli jennatripoli marked this pull request as ready for review November 30, 2025 19:01
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.

1 participant