Closed Bug 1466070 Opened 7 years ago Closed 5 years ago

Add clang-format as target of ./mach lint

Categories

(Developer Infrastructure :: Lint and Formatting, enhancement)

enhancement
Not set
normal

Tracking

(firefox77 fixed)

RESOLVED FIXED
mozilla77
Tracking Status
firefox77 --- fixed

People

(Reporter: Sylvestre, Assigned: Sylvestre)

References

(Depends on 2 open bugs)

Details

Attachments

(3 files, 3 obsolete files)

A development which kept me partly busy in a flight between Paris & SF I am not sure we want to do but at least, I would like to dump the code and start a discussion. Currently, we have two ways to call clang-format: 1) ./mach clang-format => will run on a diff 2) ./mach clang-format -p <path> => will run on a path with the option -s to show the local changes or not. With ./mach lint -l clang-format it will run only on whitelist directories (and not sure we have any in our code base?) We can show the full diff at the end but I am not sure it makes sense to use the mozlint mechanism to show warnings/errors.
I would be open to something like this, it's kind of similar to a patch I wrote almost a year ago for rustfmt in bug 1369792. I never ended up landing that because the fit was a little awkward (plus rustfmt wasn't stable yet). With rustfmt, there were seprate diffs for each issue, and I was able to stuff them into mozlint's 'source' attribute. I needed to modify the mozlint formatters to actually display this attribute though. Do you have an example of what the output looks like? I think treating formatters like a linter is fine, though it could be contentious.
Assignee: nobody → sledru

Lot of work for a small gain, closing for now

Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX

Might be easier with the new option (--dry-run)
https://prereleases.llvm.org/10.0.0/rc3/tools/clang/docs/ReleaseNotes.html#clang-format

I will have a look

Status: RESOLVED → REOPENED
Resolution: WONTFIX → ---

From a high level, I think it would be nice if we kept formatting and linting as two separate commands. See my idea in bug 1511122 (and quick prototype patch in there).

That said, we already do run formatters in mach lint (at least rustfmt), so there's precedent for adding more if that's easier.

See Also: → 1511122
Attachment #9138249 - Attachment description: Bug 1466070 - install clang-format-10 from apt.llvm.org (wip) → Bug 1466070 - install clang-format-10 from apt.llvm.org r?#linter-reviewers
Attachment #9138248 - Attachment description: Bug 1466070 - create the new job → Bug 1466070 - mozlint/clang-format: create the new job r?#linter-reviewers
Attachment #9138234 - Attachment description: Bug 1466070 - Integrate clang-format into mozlint → Bug 1466070 - Integrate clang-format into mozlint r?#linter-reviewers
Attachment #9138252 - Attachment is obsolete: true
Depends on: 1625884
Attachment #9138249 - Attachment is obsolete: true
Attachment #9139314 - Attachment is obsolete: true
Pushed by sledru@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/11586e57bc1e Integrate clang-format into mozlint r=linter-reviewers,ahal https://hg.mozilla.org/integration/autoland/rev/bb752332e3f7 mozlint/clang-format: create the new job r=ahal
Status: REOPENED → RESOLVED
Closed: 6 years ago5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla77
Depends on: 1633115
Depends on: 1670949
Depends on: 1670951
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: