{"id":29926,"date":"2021-12-14T19:26:50","date_gmt":"2021-12-14T19:26:50","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/cppblog\/?p=29926"},"modified":"2021-12-21T18:04:52","modified_gmt":"2021-12-21T18:04:52","slug":"visual-studio-code-c-december-2021-update-clang-tidy","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cppblog\/visual-studio-code-c-december-2021-update-clang-tidy\/","title":{"rendered":"Visual Studio Code C++ December 2021 Update: clang-tidy"},"content":{"rendered":"<p>The latest <a href=\"https:\/\/github.com\/microsoft\/vscode-cpptools\/releases\/tag\/1.8.0-insiders2\">insiders release<\/a> of the C++ extension is here, bringing clang-tidy support to VS Code! <a href=\"https:\/\/clang.llvm.org\/extra\/clang-tidy\/\">Clang-tidy<\/a> is a clang-based C++ linter tool that detects common errors in your code, like style violations and bugs that can be deduced via static analysis. <a href=\"https:\/\/github.com\/microsoft\/vscode-cpptools\/issues\/2908\">Clang-tidy integration<\/a> was one of our top asks on GitHub, so we\u2019re excited to announce that it\u2019s ready for you to try!<\/p>\n<h2>Getting started<\/h2>\n<h2>Do I need to install clang-tidy?<\/h2>\n<p>Nope! Clang-tidy now comes bundled with the C++ extension. But if you already have clang-tidy installed (and it\u2019s on your environment\u2019s path), the C++ extension will use that one instead. You can point the C++ extension to any clang-tidy binary by editing the C++ extension\u2019s <strong>Clang Tidy: Path<\/strong> setting.<\/p>\n<h2>How do I run clang-tidy in VS Code?<\/h2>\n<p>To manually run clang-tidy, open the <strong>Command Palette (Ctrl + Shift + P)<\/strong> and type <strong>\u201cRun Code Analysis.\u201d <\/strong>You can run clang-tidy on the active file, on all open files, or on the entire workspace.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/run-code-analysis.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-29937\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/run-code-analysis.png\" alt=\"Screenshot showing how to manually run clang-tidy from the Command Palette\" width=\"2024\" height=\"380\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/run-code-analysis.png 2024w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/run-code-analysis-300x56.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/run-code-analysis-1024x192.png 1024w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/run-code-analysis-768x144.png 768w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/run-code-analysis-1536x288.png 1536w\" sizes=\"(max-width: 2024px) 100vw, 2024px\" \/><\/a><\/p>\n<p>If there are certain workspace files or folders that you <em>don\u2019t<\/em> want to run clang-tidy on, add them to the <strong>Clang Tidy: Exclude<\/strong> setting (C_Cpp.codeAnalysis.exclude in settings.json).<\/p>\n<p>You can also set clang-tidy to run automatically whenever you open or save a file. To turn on automatic code analysis, open your project settings by selecting <strong>\u201cPreferences: Open Settings (UI)\u201d<\/strong> from the <strong>Command Palette (Ctrl + Shift + P).<\/strong><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/open-settings-ui.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-29936\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/open-settings-ui.png\" alt=\"Screenshot showing how to open VS Code settings from the Command Palette\" width=\"1742\" height=\"184\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/open-settings-ui.png 1742w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/open-settings-ui-300x32.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/open-settings-ui-1024x108.png 1024w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/open-settings-ui-768x81.png 768w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/open-settings-ui-1536x162.png 1536w\" sizes=\"(max-width: 1742px) 100vw, 1742px\" \/><\/a><\/p>\n<p>Then search for <strong>\u201ccode analysis\u201d <\/strong>to find all the clang-tidy settings and set\u00a0<strong>Clang Tidy: Enabled<\/strong> to true.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/clang-tidy-enable-setting.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-29929\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/clang-tidy-enable-setting.png\" alt=\"Screenshot of the Clang Tidy: Enabled setting in VS Code, which must be set to true in order for code analysis to run automatically in the background\" width=\"1770\" height=\"284\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/clang-tidy-enable-setting.png 1770w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/clang-tidy-enable-setting-300x48.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/clang-tidy-enable-setting-1024x164.png 1024w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/clang-tidy-enable-setting-768x123.png 768w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/clang-tidy-enable-setting-1536x246.png 1536w\" sizes=\"(max-width: 1770px) 100vw, 1770px\" \/><\/a><\/p>\n<p><strong>Note:<\/strong> You can set clang-tidy settings globally (in the User tab) or at the workspace level.<\/p>\n<p>You can check if clang-tidy is running by looking for the fire icon in the blue status bar at the bottom of the window.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/fire-icon-hover.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-29935\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/fire-icon-hover.png\" alt=\"Screenshot of the fire icon in the status bar. Users can hover over this icon to see the status of clang-tidy.\" width=\"590\" height=\"192\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/fire-icon-hover.png 590w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/fire-icon-hover-300x98.png 300w\" sizes=\"(max-width: 590px) 100vw, 590px\" \/><\/a><\/p>\n<p>To pause or cancel clang-tidy, click on the fire icon and then choose an option from the drop down.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/cancel-pause-clang-tidy.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-29927\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/cancel-pause-clang-tidy.png\" alt=\"Screenshot showing the Cancel and Pause options for clang-tidy from a dropdown in VS Code\" width=\"1746\" height=\"242\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/cancel-pause-clang-tidy.png 1746w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/cancel-pause-clang-tidy-300x42.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/cancel-pause-clang-tidy-1024x142.png 1024w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/cancel-pause-clang-tidy-768x106.png 768w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/cancel-pause-clang-tidy-1536x213.png 1536w\" sizes=\"(max-width: 1746px) 100vw, 1746px\" \/><\/a><\/p>\n<h2>How do I configure clang-tidy checks and check options?<\/h2>\n<p>If you have a .clang-tidy configuration file in your project directory, the C++ extension will honor the checks and options defined in that file. If you have multiple .clang-tidy configuration files in your workspace, clang-tidy will use the configuration file closest to the source file by searching up the path in its parent directories. Alternatively, you can specify a clang-tidy configuration with the <strong>Clang Tidy: Config<\/strong> setting. <strong>Clang Tidy: Config<\/strong> accepts checks and check options as a YAML\/JSON-formatted string.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/clang-tidy-config.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-29928\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/clang-tidy-config.png\" alt=\"Screenshot of the Clang Tidy: Config setting in VS Code, where users can pass a string in YAML\/JSON format to specify clang-tidy checks and options\" width=\"1860\" height=\"376\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/clang-tidy-config.png 1860w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/clang-tidy-config-300x61.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/clang-tidy-config-1024x207.png 1024w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/clang-tidy-config-768x155.png 768w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/clang-tidy-config-1536x311.png 1536w\" sizes=\"(max-width: 1860px) 100vw, 1860px\" \/><\/a><\/p>\n<p>If a source file doesn\u2019t have a .clang-tidy configuration file in any of its parent directories, and the <strong>Clang Tidy: Config<\/strong> property is left empty, then the fallback configuration (defined in C_Cpp.codeAnalysis.clangTidy.fallbackConfig) will be used for that file.<\/p>\n<p>You can enable and disable more checks by using the <strong>Clang Tidy &gt; Checks: Enabled<\/strong> and <strong>Clang Tidy &gt; Checks: Disabled<\/strong> settings. The checks defined in these settings are run in addition to the checks in the .clang-tidy file.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/enabled-checks-setting.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-29934\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/enabled-checks-setting.png\" alt=\"Screenshot of the Clang Tidy &gt; Checks: Enabled setting in VS Code, where users pick which clang-tidy settings to run on their project\" width=\"1558\" height=\"504\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/enabled-checks-setting.png 1558w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/enabled-checks-setting-300x97.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/enabled-checks-setting-1024x331.png 1024w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/enabled-checks-setting-768x248.png 768w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/enabled-checks-setting-1536x497.png 1536w\" sizes=\"(max-width: 1558px) 100vw, 1558px\" \/><\/a><\/p>\n<p>Selecting <strong>Add Item<\/strong> shows a list of all clang-tidy checks.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/list-of-clang-tidy-checks.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-29940\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/list-of-clang-tidy-checks.png\" alt=\"Screenshot showing the list of available clang-tidy checks after selecting Add Item in the Clang Tidy &gt; Checks: Enabled settings\" width=\"1630\" height=\"1162\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/list-of-clang-tidy-checks.png 1630w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/list-of-clang-tidy-checks-300x214.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/list-of-clang-tidy-checks-1024x730.png 1024w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/list-of-clang-tidy-checks-768x547.png 768w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/list-of-clang-tidy-checks-1536x1095.png 1536w\" sizes=\"(max-width: 1630px) 100vw, 1630px\" \/><\/a><\/p>\n<p>You can add as many checks as you\u2019d like to both the <strong>Clang Tidy &gt; Checks: Enabled<\/strong> and <strong>Clang Tidy &gt; Checks: Disabled<\/strong> settings.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/enabled-and-disabled-checks.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-29933\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/enabled-and-disabled-checks.png\" alt=\"Screenshot of the Clang Tidy &gt; Checks: Disabled and Clang Tidy &gt; Checks: Disabled settings in VS Code, where users can choose which clang-tidy checks to run or not run for their workspace\" width=\"1602\" height=\"1244\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/enabled-and-disabled-checks.png 1602w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/enabled-and-disabled-checks-300x233.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/enabled-and-disabled-checks-1024x795.png 1024w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/enabled-and-disabled-checks-768x596.png 768w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/enabled-and-disabled-checks-1536x1193.png 1536w\" sizes=\"(max-width: 1602px) 100vw, 1602px\" \/><\/a><\/p>\n<h2>How do I pass command line args to clang-tidy?<\/h2>\n<p>If you typically pass <a href=\"https:\/\/clang.llvm.org\/extra\/clang-tidy\/\">command line options<\/a> to clang-tidy, you can specify those in the <strong>Clang Tidy: Args<\/strong> property. The <strong>Clang Tidy: Args<\/strong> setting takes precedence over the equivalent Clang Tidy settings in the editor (such as Clang Tidy &gt; Checks: Enabled and Clang Tidy &gt; Checks: Disabled).<\/p>\n<h2>Viewing check results in the editor<\/h2>\n<p>The results of clang-tidy checks (warnings and errors) are displayed in the <strong>Problems panel<\/strong> and as squiggles beneath relevant sections of code.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/clang-tidy-problems-pane.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-29930\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/clang-tidy-problems-pane.png\" alt=\"Screenshot of the results of clang-tidy checks showing up in the Problems pane in VS Code\" width=\"1646\" height=\"1312\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/clang-tidy-problems-pane.png 1646w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/clang-tidy-problems-pane-300x239.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/clang-tidy-problems-pane-1024x816.png 1024w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/clang-tidy-problems-pane-768x612.png 768w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/clang-tidy-problems-pane-1536x1224.png 1536w\" sizes=\"(max-width: 1646px) 100vw, 1646px\" \/><\/a><\/p>\n<p>Clicking on the problem in the Problems panel takes you to the issue in your source file. To clear the code analysis squiggles, click on the Quick Actions lightbulb, and then select <strong>Clear code analysis squiggles.<\/strong><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/clear-code-analysis-squiggles.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-29931\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/clear-code-analysis-squiggles.png\" alt=\"Screenshot of the &quot;Clear Code Analysis Squiggles&quot; Quick Action, which is visible when selecting the lightbulb next to underlined code \" width=\"1172\" height=\"388\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/clear-code-analysis-squiggles.png 1172w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/clear-code-analysis-squiggles-300x99.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/clear-code-analysis-squiggles-1024x339.png 1024w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/12\/clear-code-analysis-squiggles-768x254.png 768w\" sizes=\"(max-width: 1172px) 100vw, 1172px\" \/><\/a><\/p>\n<h2>Clang-tidy settings<\/h2>\n<p>Here\u2019s a list of new VS Code settings to help you configure clang-tidy for your workspace.<\/p>\n<table>\n<tbody>\n<tr>\n<td width=\"282\"><strong>Setting name<\/strong><\/td>\n<td width=\"60\"><strong>Type<\/strong><\/td>\n<td width=\"84\"><strong>Default value<\/strong><\/td>\n<td width=\"198\"><strong>Description<\/strong><\/td>\n<\/tr>\n<tr>\n<td width=\"282\">C_Cpp.codeAnalysis.clangTidy.enabled<\/p>\n<p>&nbsp;<\/td>\n<td width=\"60\">Boolean<\/td>\n<td width=\"84\">False<\/td>\n<td width=\"198\">When true, clang-tidy will be enabled and run automatically if C_Cpp.codeAnalysis.runAutomatically is set to true<\/p>\n<p>&nbsp;<\/td>\n<\/tr>\n<tr>\n<td width=\"282\">C_Cpp.codeAnalysis.runAutomatically<\/td>\n<td width=\"60\">Boolean<\/td>\n<td width=\"84\">True<\/td>\n<td width=\"198\">When true, runs clang-tidy on file open and file save.<\/p>\n<p>&nbsp;<\/td>\n<\/tr>\n<tr>\n<td width=\"282\">C_Cpp.codeAnalysis.clangTidy.path<\/td>\n<td width=\"60\">String<\/td>\n<td width=\"84\">Null (empty)<\/td>\n<td width=\"198\">The full path to the clang-tidy executable.<\/td>\n<\/tr>\n<tr>\n<td width=\"282\">C_Cpp.codeAnalysis.clangTidy.checks.enabled<\/td>\n<td width=\"60\">Array of strings<\/td>\n<td width=\"84\">Null (empty)<\/td>\n<td width=\"198\">List of enabled\u00a0clang-tidy\u00a0checks. The values are appended to the\u00a0Checks\u00a0in a\u00a0.clang-tidy\u00a0file or\u00a0C_Cpp \u203a Code Analysis \u203a Clang Tidy: Config.<\/td>\n<\/tr>\n<tr>\n<td width=\"282\">C_Cpp.codeAnalysis.clangTidy.checks.disabled<\/td>\n<td width=\"60\">Array of strings<\/td>\n<td width=\"84\">Null (empty)<\/td>\n<td width=\"198\">List of disabled\u00a0clang-tidy\u00a0checks. The values are appended to the\u00a0Checks\u00a0in a\u00a0.clang-tidy\u00a0file or\u00a0C_Cpp \u203a Code Analysis \u203a Clang Tidy: Config, if any.<\/td>\n<\/tr>\n<tr>\n<td width=\"282\">C_Cpp.codeAnalysis.clangTidy.config<\/td>\n<td width=\"60\">String<\/td>\n<td width=\"84\">Null (empty)<\/td>\n<td width=\"198\">Specifies a\u00a0clang-tidy\u00a0configuration in YAML\/JSON format:\u00a0{Checks: &#8216;-*,clang-analyzer-*&#8217;, CheckOptions: [{key: x, value: y}]}. When empty, any found .clang-tidy files will be used.<\/td>\n<\/tr>\n<tr>\n<td width=\"282\">C_Cpp.codeAnalysis.clangTidy.fallbackConfig<\/td>\n<td width=\"60\">String<\/td>\n<td width=\"84\">Null (empty)<\/td>\n<td width=\"198\">Specifies a\u00a0clang-tidy\u00a0configuration in YAML\/JSON format to be used as a fallback when\u00a0C_Cpp \u203a Code Analysis \u203a Clang Tidy: Config\u00a0is not set and no\u00a0.clang-tidy\u00a0file is found.<\/td>\n<\/tr>\n<tr>\n<td width=\"282\">C_Cpp.codeAnalysis.clangTidy.args<\/td>\n<td width=\"60\">Array of strings<\/td>\n<td width=\"84\">Null (empty)<\/td>\n<td width=\"198\">Command line arguments to pass to\u00a0clang-tidy. These take precedence over the equivalent\u00a0C_Cpp.codeAnalysis.clangTidy.*\u00a0settings.<\/td>\n<\/tr>\n<tr>\n<td width=\"282\">C_Cpp.codeAnalysis.exclude<\/td>\n<td width=\"60\">String<\/td>\n<td width=\"84\">Null (empty)<\/td>\n<td width=\"198\">Configure glob patterns for excluding folders and files for code analysis.<\/td>\n<\/tr>\n<tr>\n<td width=\"282\">C_Cpp.codeAnalysis.clangTidy.headerFilter<\/td>\n<td width=\"60\">String<\/td>\n<td width=\"84\">Null (empty)<\/td>\n<td width=\"198\">A POSIX extended regular expression (ERE) matching the names of the headers to output diagnostics from. It overrides the\u00a0HeaderFilterRegex\u00a0option in a\u00a0.clang-tidy\u00a0file, if any.<\/td>\n<\/tr>\n<tr>\n<td width=\"282\">C_Cpp.codeAnalysis.maxConcurrentThreads<\/p>\n<p>(User level only)<\/td>\n<td width=\"60\">Int<\/td>\n<td width=\"84\">Null (empty)<\/td>\n<td width=\"198\">The maximum number of concurrent threads to use for code analysis. The default of\u00a0null\u00a0(empty) uses half the value inherited from\u00a0C_Cpp: Max Concurrent Threads.<\/td>\n<\/tr>\n<tr>\n<td width=\"282\">C_Cpp.codeAnalysis.maxMemory<\/p>\n<p>(User level only)<\/td>\n<td width=\"60\">Int<\/td>\n<td width=\"84\">Null (empty)<\/td>\n<td width=\"198\">Fewer code analysis processes will run concurrently after this memory usage (in MB) is exceeded. The default of\u00a0null\u00a0(empty) uses the value inherited from\u00a0C_Cpp: Max Memory.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Coming soon<\/h2>\n<p>Hang tight! Applying suggested fixes in the editor is coming soon.<\/p>\n<h2>What do you think?<\/h2>\n<p><a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=ms-vscode.cpptools\">Download the C++ extension for Visual Studio Code<\/a>\u202ftoday and join our Insiders program to access this initial release of clang-tidy integration. To join our Insiders program, go to <strong>File<\/strong> &gt; <strong>Preferences<\/strong> &gt; <strong>Settings<\/strong> and under <strong>Extensions<\/strong>\u202f&gt;\u202f<strong>C\/C++,<\/strong>\u202fchange the \u201c<strong>C_Cpp: Update Channel<\/strong>\u201d to \u201c<strong>Insiders<\/strong>.\u201d Then under <strong>Features\u202f<\/strong>&gt;\u202f<strong>Extensions<\/strong>, enable \u201c<strong>Extensions<\/strong>:<strong>\u202fAuto Update<\/strong>.\u201d<\/p>\n<p>If you run into any issues, or have any suggestions, please report them in the\u202f<a href=\"https:\/\/github.com\/Microsoft\/vscode-cpptools\/issues\">Issues section of our GitHub repository<\/a>.<\/p>\n<p>We can be reached via the comments below or in email at\u202f<a href=\"mailto:visualcpp@microsoft.com\">visualcpp@microsoft.com<\/a>. You can also find our team on Twitter at\u202f<a href=\"https:\/\/twitter.com\/visualc\">@<\/a><a href=\"https:\/\/twitter.com\/visualc\">VisualC<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The latest insiders release of the C++ extension is here, bringing clang-tidy support to VS Code! Clang-tidy is a clang-based C++ linter tool that detects common errors in your code, like style violations and bugs that can be deduced via static analysis. Clang-tidy integration was one of our top asks on GitHub, so we\u2019re excited [&hellip;]<\/p>\n","protected":false},"author":27203,"featured_media":29930,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[274,255,3913,119,271,3914,3494,163,3915,3911,276],"class_list":["post-29926","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cplusplus","tag-c-extension","tag-clang","tag-clang-tidy","tag-code-analysis","tag-cpp","tag-cpptools","tag-linter","tag-static-analysis","tag-tidy","tag-vs-code","tag-vscode"],"acf":[],"blog_post_summary":"<p>The latest insiders release of the C++ extension is here, bringing clang-tidy support to VS Code! Clang-tidy is a clang-based C++ linter tool that detects common errors in your code, like style violations and bugs that can be deduced via static analysis. Clang-tidy integration was one of our top asks on GitHub, so we\u2019re excited [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/29926","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/users\/27203"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/comments?post=29926"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/29926\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media\/29930"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media?parent=29926"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/categories?post=29926"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/tags?post=29926"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}