Closed
Bug 1181307
Opened 10 years ago
Closed 5 years ago
Automatically enforce Java code style
Categories
(Firefox for Android Graveyard :: General, defect)
Tracking
(Not tracked)
RESOLVED
INCOMPLETE
People
(Reporter: mcomella, Unassigned)
Details
It'd be a great time saver. We can either (or both!):
* Automatically format (saves more time but it might work against users when a certain non-conforming style is desired)
- See Nick's suggestion below
* Print out style errors for users to fix
- See checkstyle [1]
Of course, this assumes we have a consistent coding style (or several configuration files :( ) and fix the problems in the existing files.
Nick's suggestion:
(In reply to Nick Alexander :nalexander from bug 939350 comment #45)
> I want to note this somewhere, but I don't know quite where. Here'll do!
>
> There's a Gradle plugin making it easy-ish to automatically format Java code:
>
> https://github.com/youribonnaffe/gradle-format-plugin
>
> This ticket tracks doing the right thing in automation, etc -- but we've had
> recent success improving our local story first. We could try that approach
> again.
[1]: http://checkstyle.sourceforge.net/
Comment 1•10 years ago
|
||
We can fix some of these with EditorConfig (http://editorconfig.org/). Intellij has support for this built-in, with plugins for other IDEs as well.
The work needed would be to get our style guide into a .editorconfig file in mobile/android/ or m/a/base
| Reporter | ||
Comment 2•10 years ago
|
||
One thing we should decide on is whether or not we want to fix old style problems, or just fix changed lines as they come along. In the past, we've generally done the latter to avoid version control churn, but it's troublesome because some of these tools tend to fix more than the lines you've changed (e.g. Intellij sometimes plays me like that), so it'd be easier to just fix all the nits and enforce that style with the build system.
Comment 3•10 years ago
|
||
I still need to investigate how much work is involved fixing all the nits in that case.
Another thing involved in this change is to update our wiki in the build process to let people know that they should (if not already) have the plugin as part of their environment setup.
Comment 4•5 years ago
|
||
We have completed our launch of our new Firefox on Android. The development of the new versions use GitHub for issue tracking. If the bug report still reproduces in a current version of [Firefox on Android nightly](https://play.google.com/store/apps/details?id=org.mozilla.fenix) an issue can be reported at the [Fenix GitHub project](https://github.com/mozilla-mobile/fenix/). If you want to discuss your report please use [Mozilla's chat](https://wiki.mozilla.org/Matrix#Connect_to_Matrix) server https://chat.mozilla.org and join the [#fenix](https://chat.mozilla.org/#/room/#fenix:mozilla.org) channel.
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → INCOMPLETE
| Assignee | ||
Updated•5 years ago
|
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•