Open Bug 1575449 Opened 2 years ago Updated 2 years ago

.clang-format files in subdirectories ignored

Categories

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

task
Not set
normal

Tracking

(Not tracked)

People

(Reporter: benc, Unassigned)

Details

For Thunderbird we've got a comm/.clang-format, which ./mach clang-format doesn't seem to pick up.

Steps to replicate (assumes you've got comm/ checked out):

$ ./mach clang-format -s -p comm/mailnews/base/src/nsMsgDBView.cpp

Expected results:

Should be no results - the file follows the CC conventions.

Actual results:

clang-format complains about a huge number of lines.

(Background: MC changed to Thingy* foo over Thingy *foo while we were reformatting everything, and we decided to avoid another pass and stick with the CC-prevalent Thingy *foo style, at least for now).

I think the problem occurs because the mach frontend to clang-format first copies the files out into a tmp dir (under obj-... ) before invoking clang-format upon it. And because the file is no longer under comm/, our .clang-format is being ignored.
There seem to be a bunch of .clang-format files in M-C subdirectories too - I assume they suffer a similar issue?

Oddly, people have reported that it works OK on windows. Just Linux (and mac?) which are affected?

Quick & dirty workaround:
Before running ./mach clang-format, copy comm/.clang-format to somewhere above the tmp dir, eg:

$ cp comm/.clang-format obj-x86_64-pc-linux-gnu/

Ok, this probably explains why I see so many fix-ups in the diff file...

You need to log in before you can comment on or make changes to this bug.