Make Clang-tidy in power tools Visual Studio error list window friendly
See original GitHub issueIf the error messages from clang-tidy were rearranged before being sent to the output window from
<file>(<line>): warning: description [clang-tidy-checker]
into
<file>(<line>): warning [clang-tidy-checker]: description
so that issues like this
C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\winnt.h(19370): warning: redundant '__fastfail' declaration [readability-redundant-declaration]
would be
C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\winnt.h(19370): warning [readability-redundant-declaration]: redundant '__fastfail' declaration
And then that would automatically put the [clang-tidy-checker] into the “Code” section of the ErrorList
And then that would allow us to sort/filter by clang-tidy-checker post running
Issue Analytics
- State:
- Created 6 years ago
- Reactions:5
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Code analysis with clang-tidy in Visual Studio
Running clang-tidy results in itemized warnings populating the Error List, from where you can quickly navigate around your code. The “Category” ...
Read more >How to use clang-tidy with Visual Studio and CMake?
We use Visual Studio 2015, CMake 3.13, and I've installed LLVM 9 to get clang-tidy. I'm fine with running clang-tidy on the command...
Read more >Automatically detect your .clang-tidy file
Open Clang Power Tools Settings Menu. Clang Power Tools Toolbar · Select the Tidy tab. · Be sure you have the Detect .clang-tidy...
Read more >Clang-Tidy, part 1: Modernize your source code using C ...
This blog series will introduce the clang-tidy utility from the Clang/LLVM project and show how to use it to automatically refactor C++ ......
Read more >“Best” static code analysis tools : r/cpp
I'm part of a small committee at my company to investigate different options for static analysis tools. I know the best tool is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @jrp2014 ,
My buddy @Enache-Ionut is hard-at-work on this issue, but it turns out it’s not as easy to implement as it seems.
He made significant progress but hit some blockers and reached-out for help in the VS community.
We’ll update this thread when we have it completely functional.
Regarding the clang-tidy checks toggle switches in Settings we’re aware of the limitation of not being able to do bulk toggle. This is a limitation of the stock UI controller we use for Settings. We have current plans to update that UI. In the meantime, you can use our Cutom checks section where you can specify a list of checks using wildcards, eg.
modernize-*,readability-*
Thanks for your feedback.
An alternative (to using the name of the Clang Tidy Check) would be to assign arbitrary code values (warning numbers) to each Clang Tidy check, then place those warning numbers into the Code column in the Visual Studio Errors window.
The SonarLint for Visual Studio 2022 extension does exactly this. The code for this extension is open source here in GitHub so it should be straightforward to see how they pulled this off.
As for the name of the Clang Tidy Check, it already shows up in the Description (though it might be best if the name of the check came first).
The arbitrary warning numbers associated with the Clang Tidy checks could have a numbering scheme. For example, warnings with available fixes could be numbered 1000 to 4999, while warnings from checks which lack automatic fixes could be in the range 5000 to 9999. Within these ranges, there could be further sub-divisions, based on the group of checks (e.g.
readability
,bug-prone
,modernize
, etc.), the severity of the warning, or other criteria.SonarLint uses the code prefix
cpp:
to distinguish their warning numbers from the Visual C++ compiler (which prefixes warning numbers withC
). Perhapscpt:
orct:
would be a suitable prefix for each warning number.Also, the Code values (warning numbers shown in the Visual Studio Errors window) can be hyperlinks. Microsoft VC++ compiler warnings link to the corresponding Microsoft Learn page. SonarLint warnings link to their reference pages showing non-compliant and compliant code examples. The code values for Clang Tidy warnings could link to the Clang Tidy page for the corresponding check.