0

As seen in this video, the C++ Linter provided in the C/C++ extension from Microsoft (clang-tidy) in VSCode squiggles the header of the standard library, producing an irresolvable problem.

However, outside of this fact, the linter works as expected, as demonstrated by the double-declaration being squiggled and clearing itself after being removed in the video.

I have tried many solutions to this problem:

Using // NOLINT (and its derivates such as //NOLINTNEXTLINE) as described in the clang-tidy documentation. This does not change anything.

#include <iostream> // NOLINT

Using the --header_filter= argument, in the following forms, which completely broke the linting:

"C_Cpp.codeAnalysis.clangTidy.headerFilter": "^((?!std_abs\\.h|stl_algobase\\.h|type_traits).)*$",
"C_Cpp.codeAnalysis.clangTidy.args": [
    "--header_filter='^((?!std_abs\\.h|stl_algobase\\.h|type_traits).)*$'"
],

This does not work as Posix ERE does not support negative lookahead and the header filter is supposed to specify which ones to check, not which ones to ignore. I also tried matching the offending files, even though the documentation specifies the exact opposite, which also broke the linting.

Using --line-filter to filter the line out, which also broke the linting:

"C_Cpp.codeAnalysis.clangTidy.args": [
        "--line-filter=[{\"name\":\"vscode_main.cpp\", \"lines\": [[1,1]]}]"
],

I also tried the opposite version of that, to no avail:

"C_Cpp.codeAnalysis.clangTidy.args": [
        "--line-filter=[{\"name\":\"vscode_main.cpp\", \"lines\": [[2,1000]]}]"
],

In conclusion, my attempts either did nothing or broke linting completely. If anyone has any solutions to or suggestions regarding the problem and could post them, I'd be glad.

0 Answers0