-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Format Java source files automatically #46745
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
Changes from all commits
f6176bf
e833d42
72274ca
a5eec34
1194956
b5d2b34
d85a1d4
5ef0dc4
06ab706
5c1ee6a
6a32487
4423991
0c432a5
e1d27cd
b0d0d6d
7d69c76
8418c15
82c44b7
5b76280
2a2856b
896cbe3
7314c3a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,7 @@ plugins { | |
id 'com.gradle.build-scan' version '2.4' | ||
id 'lifecycle-base' | ||
id 'elasticsearch.global-build-info' | ||
id "com.diffplug.gradle.spotless" version "3.24.2" apply false | ||
} | ||
|
||
apply plugin: 'nebula.info-scm' | ||
|
@@ -98,6 +99,34 @@ subprojects { | |
plugins.withType(BuildPlugin).whenPluginAdded { | ||
project.licenseFile = project.rootProject.file('licenses/APACHE-LICENSE-2.0.txt') | ||
project.noticeFile = project.rootProject.file('NOTICE.txt') | ||
|
||
// Projects that should be formatted and checked with Spotless are | ||
// listed here, by project path. Once the number of formatted projects | ||
// is greater than the number of unformatted projects, this can be | ||
// switched to an exclude list, and eventualy removed completely. | ||
def projectPathsToFormat = [ | ||
// ':build-tools' | ||
] | ||
|
||
if (projectPathsToFormat.contains(project.path)) { | ||
project.apply plugin: "com.diffplug.gradle.spotless" | ||
|
||
spotless { | ||
java { | ||
|
||
removeUnusedImports() | ||
eclipse().configFile rootProject.file('.eclipseformat.xml') | ||
trimTrailingWhitespace() | ||
|
||
// See CONTRIBUTING.md for details of when to enabled this. | ||
if (System.getProperty('spotless.paddedcell') != null) { | ||
paddedCell() | ||
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. Shouldn't we have everything about the formatting doable by the IDE plugins? 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. I don't think we'll have much need to enable this on a day-to-day basis, and it's outside the remit of the IDE plugins. This option lets Spotless cope when formatting isn't idempotent, which happened in a few places with GJF. It's a seperate thing from the configured formatting options. |
||
} | ||
} | ||
} | ||
|
||
precommit.dependsOn 'spotlessJavaCheck' | ||
} | ||
} | ||
} | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.