-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Add spring-javaformat checkstyle and formatting #8946
Closed
Closed
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
spring-projects-issues
added
the
status: waiting-for-triage
An issue we've not yet triaged
label
Aug 6, 2020
Rename a few test classes that accidentally ended in `Test` instead of `Tests`. Issue spring-projectsgh-8945
Find `http` config using a regex search of `^\s*https*$` and protect them against formatting. Issue spring-projectsgh-8945
Find `auth` config using a regex search of `^\s*auths*$` and protect them against formatting. Issue spring-projectsgh-8945
Find `User.withUsername` calls and protect them against formatting. Issue spring-projectsgh-8945
Find `withDefaultPasswordEncoder` calls and protect them against formatting. Issue spring-projectsgh-8945
Remove the formatter-on/formatter-off comments from Javadoc examples so that they don't confuse checkstyle. The comments are not necessary in the Javadoc since `pre` blocks are not formatted in the same way as code. Issue spring-projectsgh-8945
Add spring-javaformat plugin but disable it for all sample projects. Issue spring-projectsgh-8945
Run `./gradlew format` to reformat all java files. Issue spring-projectsgh-8945
Use '^\s+//\ \~\ .*$' and '^\s+//\ ============+$' regular expression searches to remove superfluous comments. Prior to this commit, many classes would have comments to indicate blocks of code (such as constructors/methods/instance fields). These added a lot of noise and weren't all that helpful, especially given the outline views available in most modern IDEs. Issue spring-projectsgh-8945
Introduce checkstyle rules from spring-javaformat, but keep them disabled so that fixes can be introduced one commit at a time. Issue spring-projectsgh-8945
Always use compact annotations when possible. For example, replace `@Target(value = ElementType.TYPE)` with `@Target(ElementType.TYPE)`. Issue spring-projectsgh-8945
Suppress `BCrypt` and `ComparableVersion` from checkstyle since these source files were developed by a third-party. Issue spring-projectsgh-8945
Remove the array style rules suppression since it doesn't cause any checkstyle violations. Issue spring-projectsgh-8945
Ensure that Javadoc "@" tags appear in a consistent and well defined order. Issue spring-projectsgh-8945
Use "organize imports" from Eclipse to cleanup import statements so that they appear in a consistent and well defined order. Issue spring-projectsgh-8945
Refactor a few classes so that empty blocks are not longer used. For example, rather than: if(x) { } else { i++; } use: if(!x) { i++; } Issue spring-projectsgh-8945
Update classes that have private constructors so that they are also declared final. In a few cases, inner-classes used private constructors but were subclassed. These have now been changed to have package-private constructors. Issue spring-projectsgh-8945
Apply an Eclipse cleanup rules to ensure that fields are always accessed using `this.`. This aligns with the style used by Spring Framework and helps users quickly see the difference between a local and member variable. Issue spring-projectsgh-8945
Apply automated cleanup rules to add `@Override` and `@Deprecated` annotations and to fix class references used with static methods. Issue spring-projectsgh-8945
Replace code of the form `a = b =c` with distinct statements. Although this results in more lines of code, they are usually easier to understand. Issue spring-projectsgh-8945
Move all inner-types so that they are consistently the last item defined. This aligns with the style used by Spring Framework and the consistency generally makes it easier to scan the source. Issue spring-projectsgh-8945
Search and replace using '(?s)/\*\s*\* \(non-Javadoc\).*?\*/' to remove all "(non-Javadoc)" comments. These comments used to be added automatically by Eclipse, but are not really necessary. Issue spring-projectsgh-8945
Add suppressions for existing `InterfaceIsType` violations. Ideally theses should be classes, but we can't easily change them without breaking binary back compatibility. Issue spring-projectsgh-8945
Update code to use a consistent modifier order that aligns with that used in the "Java Language specification". Issue spring-projectsgh-8945
Update all exception classes so that they are fully immutable and cannot be changed once they have been thrown. Issue spring-projectsgh-8945
Remove the "need braces" checkstyle suppression which does not cause any violations. Issue spring-projectsgh-8945
Refactor `HeadersBeanDefinitionParser` and `AclImpl` to reduce the number of nested if statements. A few extracted methods are now used to hopefully improve readability. Issue spring-projectsgh-8945
Update all files to ensure that they always end with a new-line character. Issue spring-projectsgh-8945
Manually polish `spring-security-crypto` following the formatting and checkstyle fixes. Issue spring-projectsgh-8945
Manually polish `spring-security-data` following the formatting and checkstyle fixes. Issue spring-projectsgh-8945
Manually polish `spring-security-ldap` following the formatting and checkstyle fixes. Issue spring-projectsgh-8945
Manually polish `spring-security-messaging` following the formatting and checkstyle fixes. Issue spring-projectsgh-8945
Manually polish `spring-security-oauth-cleint` following the formatting and checkstyle fixes. Issue spring-projectsgh-8945
Manually polish `spring-security-oauth-core` following the formatting and checkstyle fixes. Issue spring-projectsgh-8945
Manually polish `spring-security-oauth-jose` following the formatting and checkstyle fixes. Issue spring-projectsgh-8945
Manually polish `spring-security-oauth-resource-server` following the formatting and checkstyle fixes. Issue spring-projectsgh-8945
Manually polish `spring-security-openid` following the formatting and checkstyle fixes. Issue spring-projectsgh-8945
Manually polish `spring-security-remoting` following the formatting and checkstyle fixes. Issue spring-projectsgh-8945
Manually polish `spring-security-rsocket` following the formatting and checkstyle fixes. Issue spring-projectsgh-8945
Manually polish `spring-security-saml2` following the formatting and checkstyle fixes. Issue spring-projectsgh-8945
Manually polish `spring-security-taglibs` following the formatting and checkstyle fixes. Issue spring-projectsgh-8945
Manually polish `spring-security-test` following the formatting and checkstyle fixes. Issue spring-projectsgh-8945
Manually polish `spring-security-web` following the formatting and checkstyle fixes. Issue spring-projectsgh-8945
Remove all blank lines from test code so that test methods are visually grouped together. This generally helps to make the test classes easer to scan, however, the "given" / "when" / "then" blocks used by some tests are now not as easy to discern. Issue spring-projectsgh-8945
Fix a few tests that were accidentally importing incorrect AssertJ classes. Issue spring-projectsgh-8945
Update tests that use `assertThat((Object) ...)` to use the convenience `assertThatObject(...)` method instead. Issue spring-projectsgh-8945
Update a couple of tests to use the more traditional `@Mock` annotation placement. Issue spring-projectsgh-8945
Fix `DefaultSavedRequestMixinTests` so that `assertThat` is used rather than Java's `assert` keyword. Issue spring-projectsgh-8945
Consistently use `assertThatExceptionOfType(...).isThrownBy(...)` rather than `assertThatCode` or `assertThatThrownBy`. This aligns with Spring Boot and Spring Cloud. It also allows the convenience `assertThatIllegalArgument` and `assertThatIllegalState` methods to be used. Issue spring-projectsgh-8945
rwinch
added
in: build
An issue in the build
type: enhancement
A general enhancement
and removed
status: waiting-for-triage
An issue we've not yet triaged
labels
Aug 11, 2020
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.
This PR provide an initial set of fixes for #8945 which mainly deal with code issues. Another round will be required for Javadoc violations.