forked from mozilla/gecko-dev
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1571899 - Use google-java-format via spotless to enforce Java for…
…matting. r=ahal,owlish This change adds a new lint `android-format` which enforces formatting of Java code using google-java-format. To run the lint simply run: ./mach lint -l android-format This command also support automatically fixing all errors running by adding --fix: ./mach lint -l android-format --fix This change also removes all the formatting-related checkstyle checks which are now implicitly enforced by the formatter. Differential Revision: https://phabricator.services.mozilla.com/D127734
- Loading branch information
Showing
8 changed files
with
133 additions
and
28 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
Spotless | ||
======== | ||
|
||
`Spotless <https://github.com/diffplug/spotless>`__ is a pluggable formatter | ||
for Gradle and Android. | ||
|
||
In our current configuration, Spotless includes the | ||
`Google Java Format plug-in https://github.com/google/google-java-format`__ | ||
which formats all our Java code using the Google Java coding style guidelines. | ||
|
||
|
||
Run Locally | ||
----------- | ||
|
||
The mozlint integration of spotless can be run using mach: | ||
|
||
.. parsed-literal:: | ||
$ mach lint --linter android-format | ||
Alternatively, omit the ``--linter android-format`` and run all configured linters, which will include | ||
spotless. | ||
|
||
|
||
Autofix | ||
------- | ||
|
||
The spotless linter provides a ``--fix`` option. |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
android-format: | ||
description: Android formatting lint | ||
include: ['mobile/android'] | ||
exclude: [] | ||
extensions: ['java'] | ||
support-files: | ||
- 'mobile/android/**/Makefile.in' | ||
- 'mobile/android/config/**' | ||
- 'mobile/android/gradle.configure' | ||
- 'mobile/android/**/moz.build' | ||
- '**/*.gradle' | ||
type: global | ||
payload: android.lints:format | ||
setup: android.lints:setup |
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
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