[SERVER-78890] clang-tidy MongoHeaderBracketCheck false positive Created: 12/Jul/23 Updated: 02/Feb/24 Resolved: 12/Jul/23 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Ben Shteinfeld | Assignee: | Unassigned |
| Resolution: | Gone away | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Assigned Teams: |
Server Development Platform
|
| Participants: |
| Description |
|
When VSCode lints src/mongo/db/query/plan_executor.cpp, I get the error:
This seems like a false positive as the referenced import is a mongo import and should not use angle brackets. |
| Comments |
| Comment by David Percy [ 30/Jan/24 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Thanks, I think another thing that threw me off was that "clangd: restart language server" didn't fix it. Now that I think about it, that must be because clang-tidy is separate from clangd. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by David Percy [ 30/Jan/24 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I had this problem again today. It looks like .clang-tidy is overwritten by other build profiles:
Rerunning scons compiledb does fix it:
And it stays fixed even if I rebuild a .o file or rerun generated-sources:
But if I re-create the 'opt' build profile it gets overwritten the first time that profile runs 'generated-sources':
This must be because the rule that creates .clang-tidy has multiple targets, some of which are prefixed build/opt/:
So it looks like .clang-tidy will break whenever you create or re-create a build profile (or any ninjafile with a different VARIANT_DIR). If the contents of .clang-tidy depend on the build profile, maybe we should put it into build/opt/ build/compiledb/ etc? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Ben Shteinfeld [ 12/Jul/23 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Seems like `./buildscripts/scons.py --build-profile=compiledb compiledb` and reloading the window fixes the issue. Thanks! Not sure how I got into the bad state. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Daniel Moody [ 12/Jul/23 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I believe this is likely due to some configuration issue where the build dir where error_codes.h gets generated to is not being reflected in the generated .clang-tidy file. Did you some how regenerate the compile_commands.json with out regenerating .clang-tidy? I believe regenerating the .clang-tidy file (via "compiledb" target) with the intended build configuration should fix the issue. |