Closed Bug 1571899 Opened 3 years ago Closed 10 months ago

Identify and apply formatter to java code

Categories

(GeckoView :: General, task, P3)

Unspecified
All

Tracking

(firefox95 fixed)

RESOLVED FIXED
95 Branch
Tracking Status
firefox95 --- fixed

People

(Reporter: agi, Assigned: agi)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

Similarly to what happend to our javascript and c++ we should identify a formatter and apply it to the entire java codebase. And make sure it runs on every check in.

snorp linked to this plugin which seems promising: https://github.com/diffplug/spotless (with the google-java-format)

Priority: -- → P3
Rank: 4
Rank: 4 → 13
Assignee: agi → nobody
Assignee: nobody → agi
Status: NEW → ASSIGNED

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.

Attachment #9244656 - Attachment description: Bug 1571899 - Add use google-java-format via spotless to enforce Java formatting. → Bug 1571899 - Use google-java-format via spotless to enforce Java formatting.
Pushed by asferro@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/a0a60d0f61a5
Use google-java-format via spotless to enforce Java formatting. r=ahal,owlish
https://hg.mozilla.org/integration/autoland/rev/1fa64c7fe170
Format Java codebase with google-java-formatter. r=owlish
Status: ASSIGNED → RESOLVED
Closed: 10 months ago
Resolution: --- → FIXED
Target Milestone: --- → 95 Branch
You need to log in before you can comment on or make changes to this bug.