Closed Bug 1543492 Opened 7 months ago Closed 7 months ago

Improve the error message when the clang-format isn't correct

Categories

(Firefox Build System :: Lint and Formatting, task)

task
Not set

Tracking

(firefox68 fixed)

RESOLVED FIXED
mozilla68
Tracking Status
firefox68 --- fixed

People

(Reporter: keeler, Assigned: andi)

References

(Regression)

Details

Attachments

(1 file)

A couple of times I've seen this error after using hg rebase or hg backout:

Processing 1 file(s)...
YAML:28:19: error: unknown key 'StatementMacros'
StatementMacros: [MARKUPMAP, ASSERT_TRUE, ASSERT_FALSE, TEST, CHECK]
                  ^
Error reading /home/keeler/mozilla-unified/.clang-format: Invalid argument
The error occurred in the implementation of the invoked mach command.

This should never occur and is likely a bug in the implementation of that
command. Consider filing a bug for this issue.

If filing a bug, please include the full output of mach, including this error
message.

The details of the failure are as follows:

AssertionError

  File "/home/keeler/mozilla-unified/python/mach/mach/main.py", line 524, in _run
    **vars(args.command_args))
  File "/home/keeler/mozilla-unified/python/mach/mach/registrar.py", line 101, in _run_command_handler
    assert isinstance(result, (int, long))

Please run mach boostrap to update the version of clang-format
(until you do, just comment the last line of .clang-format)

Regressed by: 1542146

Ah, that did it. Thanks!

Status: NEW → RESOLVED
Closed: 7 months ago
Resolution: --- → WORKSFORME

I had the same problem yesterday, and I think something should be done to make things more obvious.

Status: RESOLVED → REOPENED
Resolution: WORKSFORME → ---

We are checking the version of clang-tidy, we should probably do the same with clang-format.
(we could just add the version in .clang-format as a comment)

Andi, could take the lead on that? Thanks

Type: defect → task
Flags: needinfo?(bpostelnicu)
Summary: YAML:28:19: error: unknown key 'StatementMacros' occasionally when rebasing, using backout, etc. → Improve the error message when the clang-format isn't correct

Sure this is a good idea, but since clang-tidy and clang-format are shipped together hence they are bounded in the same package I would suggest using this version tracker: https://searchfox.org/mozilla-central/source/tools/clang-tidy/config.yaml#21

Flags: needinfo?(bpostelnicu)
Assignee: nobody → bpostelnicu

this might add some confusion, this is why I didn't suggested it but why not :)
Please rename the field in config.yaml

Sure, the actual name will only cause confusion. But the field has been added in this revision but without any extra implementation that can leverage it: https://hg.mozilla.org/mozilla-central/rev/4c43aecaddf8

Pushed by bpostelnicu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/bc17715cc318
for clang based static-analysis and formating add a package version that represents a baseline if we continue the analysis or prompt for an update. r=sylvestre
Status: REOPENED → RESOLVED
Closed: 7 months ago7 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla68
Duplicate of this bug: 1544238
Duplicate of this bug: 1544373
You need to log in before you can comment on or make changes to this bug.