Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set up spotless linter #25

Merged
merged 14 commits into from
Nov 26, 2023
Merged

set up spotless linter #25

merged 14 commits into from
Nov 26, 2023

Conversation

dejabot
Copy link

@dejabot dejabot commented Nov 23, 2023

See https://docs.wpilib.org/en/stable/docs/software/advanced-gradlerio/code-formatting.html.

This linter will run as part of the build system as well as a GitHub action.

./gradlew spotlessCheck will check for lint errors (a normal gradle build will include this).
./gradlew spotlessApply will auto-format code to adhere to lint checks.

NOTE: we've configured spotless so it only runs on code that's changed relative to main (typically, new code), so we can use spotless incrementally vs change all of our existing code.

Spotless is configured to use Google's Java style guide, which will be a little different from the checkstyle.xml we had been using. We're specifically using AOSP formatting, which uses 4 space vs 2 space indents, since that's the default indentation size in VS Code, and we've also disabled javadoc formatting so short javadoc doesn't get reformatted to single-line, etc.

As part of these changes, we'll also disable our current linter steps (and ultimately delete them).

limit to checking files that have changed relative to main
disable existing linter so we don't double-lint with diff rules
test that linter isn't being run any more

(will not merge)
use latest version of spotless
ignore javadoc in spotless
use AOSP java formatting (four space indents)
aosp() uses four space indents
needed for spotless to be able to run as part of build.
use 2023-22.04 ubuntu container
update to checkout v4
@dejabot
Copy link
Author

dejabot commented Nov 23, 2023

PR is now ready for review.

@dejabot dejabot merged commit 107f7f7 into main Nov 26, 2023
3 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