-
Notifications
You must be signed in to change notification settings - Fork 0
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
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
…feature-use-spotless-linter
needed for spotless to be able to run as part of build.
use 2023-22.04 ubuntu container update to checkout v4
PR is now ready for review. |
rcahoon
approved these changes
Nov 26, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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).