-
-
Notifications
You must be signed in to change notification settings - Fork 962
Spotless / Checkstyle & Code Reformatting #14903
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
Open
jdaugherty
wants to merge
7
commits into
7.0.x
Choose a base branch
from
style-enforcement
base: 7.0.x
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+36,659
−35,791
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
75496de
build: add support for checkstyle / spotless to grails-core
jdaugherty 1fb64db
style: reformat grails-core per styling rules
jdaugherty 1a31949
chore: switch to https
jdaugherty 437336f
style: fixing wildcard imports in grails-forge
jdaugherty 78c97cf
feedback: gradle type safe api usage
jdaugherty be88c6e
feedback: starting to correct formatting issues
jdaugherty 94fb424
revert: test styling changes
jdaugherty File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?xml version="1.0"?> | ||
<!-- | ||
~ Licensed to the Apache Software Foundation (ASF) under one | ||
~ or more contributor license agreements. See the NOTICE file | ||
~ distributed with this work for additional information | ||
~ regarding copyright ownership. The ASF licenses this file | ||
~ to you under the Apache License, Version 2.0 (the | ||
~ "License"); you may not use this file except in compliance | ||
~ with the License. You may obtain a copy of the License at | ||
~ | ||
~ https://www.apache.org/licenses/LICENSE-2.0 | ||
~ | ||
~ Unless required by applicable law or agreed to in writing, | ||
~ software distributed under the License is distributed on an | ||
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
~ KIND, either express or implied. See the License for the | ||
~ specific language governing permissions and limitations | ||
~ under the License. | ||
--> | ||
<!DOCTYPE suppressions PUBLIC | ||
"-//Puppy Crawl//DTD Suppressions 1.1//EN" | ||
"http://checkstyle.sourceforge.net/dtds/suppressions_1_1.dtd"> | ||
<suppressions> | ||
<suppress checks="FileLength" | ||
files="GrailsDomainBinder.java|AbstractHibernateCriteriaBuilder.java|StreamCharBuffer.java"/> | ||
<!-- Ignore until we decide what to do with these files --> | ||
<!-- maybe replace with https://github.com/openjson/openjson --> | ||
<suppress files=".*[\\/]grails-web-common[\\/]src[\\/]main[\\/]groovy[\\/]org[\\/]grails[\\/]web[\\/]json[\\/].*" checks=".*"/> | ||
<suppress files=".*[\\/]grails-wrapper[\\/]src[\\/]main[\\/]java[\\/]grails[\\/]init[\\/]GrailsVersion.*" checks=".*"/> | ||
<suppress files=".*[\\/]grails-wrapper[\\/]src[\\/]main[\\/]java[\\/]grails[\\/]init[\\/]GrailsWrapperHome.*" checks=".*"/> | ||
</suppressions> |
File renamed without changes.
This file contains hidden or 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
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import com.diffplug.gradle.spotless.SpotlessExtension | ||
import io.spring.nohttp.gradle.NoHttpExtension | ||
|
||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
apply plugin: 'checkstyle' | ||
apply plugin: 'com.diffplug.spotless' | ||
apply plugin: 'io.spring.nohttp' // enforce https everywhere | ||
|
||
extensions.configure(SpotlessExtension) { | ||
// Explicit `it` required in extension configuration | ||
it.java { | ||
licenseHeaderFile(rootProject.layout.projectDirectory.file('etc/config/spotless/license.java')) | ||
target( | ||
'grails-app/**/*.java', | ||
'src/main/groovy/**/*.java', | ||
'src/main/java/**/*.java' | ||
) | ||
} | ||
it.groovy { | ||
licenseHeaderFile(rootProject.layout.projectDirectory.file('etc/config/spotless/license.java')) | ||
target( | ||
'grails-app/**/*.groovy', | ||
'src/main/groovy/**/*.groovy' | ||
) | ||
} | ||
it.format('javaMisc') { | ||
licenseHeaderFile(rootProject.layout.projectDirectory.file('etc/config/spotless/license.java'), '\\/\\*\\*') | ||
target( | ||
'src/main/**/module-info.java', | ||
'src/main/**/package-info.java' | ||
) | ||
} | ||
} | ||
|
||
extensions.configure(CheckstyleExtension) { | ||
// Explicit `it` required in extension configuration | ||
it.configFile = rootProject.layout.projectDirectory.file('etc/config/checkstyle/checkstyle.xml').asFile | ||
it.configDirectory = project.rootProject.layout.projectDirectory.dir('etc/config/checkstyle').asFile | ||
it.maxErrors = 1 | ||
it.maxWarnings = 10 | ||
it.showViolations = true | ||
} | ||
|
||
extensions.configure(NoHttpExtension) { | ||
// Explicit `it` required in extension configuration | ||
// TODO: xsd, xml, & doc files need looked at; this will at least make sure our POMs are correct | ||
it.source.exclude( | ||
'build/**', | ||
'src/test/**', | ||
'LICENSE', '**/LICENSE', 'NOTICE', '**/NOTICE', 'licenses/**', 'INSTALL', | ||
'**/*.xsd', '**/*.xml', '**/*.dtd', | ||
'**/test/**', | ||
'**/@[email protected]', | ||
'**/grails-doc/**' // TODO: the grails doc still has a lot of work to do to remove https | ||
) | ||
} | ||
|
||
if (tasks.names.contains('checkstyleTest')) { | ||
tasks.named('checkstyleTest').configure { | ||
it.group = 'verification' | ||
it.enabled = false | ||
} | ||
} | ||
|
||
if (tasks.names.contains('checkstyleMain')) { | ||
tasks.named('checkstyleMain').configure { | ||
it.group = 'verification' | ||
it.dependsOn('spotlessCheck') | ||
} | ||
} |
This file contains hidden or 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
jdaugherty marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or 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
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,15 +50,15 @@ interface PromiseFactory { | |
/** | ||
* Creates a promise with a value pre-bound to it | ||
* @param value The value | ||
* @param <T> The type of the value | ||
* @param <T> The type of the value | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm... what formatting rule adding this whitespace? |
||
* @return A Promise | ||
*/ | ||
<T> Promise<T> createBoundPromise(T value) | ||
|
||
/** | ||
* Creates an unfulfilled promise that returns the given type | ||
* @param returnType The return type | ||
* @param <T> The type of the class | ||
* @param <T> The type of the class | ||
* @return The unfulfilled promise | ||
*/ | ||
<T> Promise<T> createPromise(Class<T> returnType) | ||
|
@@ -76,23 +76,23 @@ interface PromiseFactory { | |
* @param map The map | ||
* @return A promise | ||
*/ | ||
<K,V> Promise<Map<K,V>> createPromise(Map<K, V> map) | ||
<K, V> Promise<Map<K, V>> createPromise(Map<K, V> map) | ||
|
||
/** | ||
* Creates a promise from the given map where the values of the map are either closures or Promise instances | ||
* | ||
* @param map The map | ||
* @return A promise | ||
*/ | ||
<K,V> Promise<Map<K,V>> createPromise(Map<K, V> map, List<PromiseDecorator> decorators) | ||
<K, V> Promise<Map<K, V>> createPromise(Map<K, V> map, List<PromiseDecorator> decorators) | ||
|
||
/** | ||
* Creates a promise from one or more other promises | ||
* | ||
* @param promises The promises | ||
* @return The promise | ||
*/ | ||
<T> Promise<List<T>> createPromise(Promise<T>...promises) | ||
<T> Promise<List<T>> createPromise(Promise<T>... promises) | ||
|
||
/** | ||
* Creates a promise from one or many closures | ||
|
@@ -132,7 +132,7 @@ interface PromiseFactory { | |
* @param promises The promises | ||
* @return The list of bound values | ||
*/ | ||
<T> List<T> waitAll(Promise<T>...promises) | ||
<T> List<T> waitAll(Promise<T>... promises) | ||
/** | ||
* Synchronously waits for all promises to complete returning a list of values | ||
* | ||
|
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add comment why we have chosen to disable
checkstyleTest
?