Closed Bug 1555560 Opened 6 years ago Closed 4 years ago

Add support for black formatting python code in mozlint

Categories

(Developer Infrastructure :: Lint and Formatting, task, P2)

Tracking

(firefox80 fixed)

RESOLVED FIXED
mozilla80
Tracking Status
firefox80 --- fixed

People

(Reporter: catlee, Assigned: tomprince)

References

Details

Attachments

(2 files, 1 obsolete file)

Similar to bug 1551078, we should have support for running black over our python code.

Depends on D33125

Attached file Bug 1555560: Fix deprecated python syntax (obsolete) (deleted) —

Depends on D33126

Assignee: nobody → catlee

I feel like everyone is all aboard the black train, so don't expect anything to come of this comment.. but I'm going to make it anyway :).

Has anyone looked into yapf? I like the idea of us being able to tweak knobs in configuration (while still enforcing a consistent mozilla-central wide style). I worry that:

A) Black will be somewhat annoying as a linter (I have fewer reservations about using it as a formatter that just makes the changes outright).
B) Black is too opinionated. I definitely see the value in consistency, but frankly some of the things it enforces seem pretty esoteric and unhelpful. I sometimes feel like I'm alone in this opinion, but I believe there is a little bit of room for personal freedom of expression in programming. I like yapf for its configurability, it can give us the best of both worlds.

Anyway, I'm not going to step in the way of progress here or anything. I definitely agree that using black is better than not using anything at all.

(In reply to Andrew Halberstadt [:ahal] from comment #4)

but frankly some of the things it enforces seem pretty esoteric and unhelpful.

I definitely find that a few of the choices that black makes to be poor for readability (but not unbearably so). However, I think not having any knobs outweighs that by a significant margin.

Attachment #9068612 - Attachment is obsolete: true
Attachment #9068610 - Attachment is obsolete: true
Attachment #9068611 - Attachment is obsolete: true
Attachment #9068610 - Attachment is obsolete: false
Attachment #9068611 - Attachment is obsolete: false
Attachment #9068610 - Attachment description: Bug 1555560: Add support for black formatting with mozlint → Bug 1555560: Add support for black formatting with mozlint; r?ahal
Attachment #9068611 - Attachment description: Bug 1555560: Run black format check in automation → Bug 1555560: Run black format check in automation; r?ahal
Attachment #9068610 - Attachment is obsolete: true
Attachment #9068611 - Attachment is obsolete: true
Assignee: catlee → nobody

I have since jumped aboard the black train ;)

Priority: -- → P2
Assignee: nobody → mozilla
Attachment #9068610 - Attachment is obsolete: false
Status: NEW → ASSIGNED
Attachment #9068611 - Attachment is obsolete: false
Pushed by mozilla@hocat.ca: https://hg.mozilla.org/integration/autoland/rev/f2896032ced6 Add support for black formatting with mozlint; r=sylvestre https://hg.mozilla.org/integration/autoland/rev/bd9460ac6e48 Run black format check in automation; r=ahal,sylvestre
Pushed by mozilla@hocat.ca: https://hg.mozilla.org/integration/autoland/rev/bed3e7c8f5d2 Add support for black formatting with mozlint; r=sylvestre https://hg.mozilla.org/integration/autoland/rev/e59f19cfc123 Run black format check in automation; r=ahal,sylvestre
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla80
Regressions: 1651633
Regressions: 1651642
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: