{"id":25717,"date":"2020-03-26T19:55:40","date_gmt":"2020-03-26T19:55:40","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/cppblog\/?p=25717"},"modified":"2020-08-06T16:27:12","modified_gmt":"2020-08-06T16:27:12","slug":"intellisense-code-linter-for-cpp","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cppblog\/intellisense-code-linter-for-cpp\/","title":{"rendered":"IntelliSense Code Linter for C++"},"content":{"rendered":"<p><em>[Updated Aug 2020 to show the new way of enabling the experimental capability]<\/em><\/p>\n<p><span class=\"TextRun SCXW29468310 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW29468310 BCX0\" data-wac-het=\"1\">In\u00a0<\/span><\/span><a class=\"Hyperlink SCXW29468310 BCX0\" href=\"https:\/\/visualstudio.microsoft.com\/vs\/preview\/\" target=\"_blank\" rel=\"noreferrer noopener\"><span class=\"TextRun Underlined SCXW29468310 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW29468310 BCX0\" data-ccp-charstyle=\"Hyperlink\" data-wac-het=\"1\">Visual Studio 2019 version 16.6 Preview 2<\/span><\/span><\/a><span class=\"TextRun SCXW29468310 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW29468310 BCX0\" data-wac-het=\"1\">, we&#8217;re excited to announce a new preview feature to help C++ developers identify and fix code defects as they write code. The IntelliSense Code Linter for C++ checks\u00a0<\/span><\/span><span class=\"TextRun SCXW29468310 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW29468310 BCX0\" data-wac-het=\"1\">your code\u00a0<\/span><\/span><span class=\"TextRun SCXW29468310 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW29468310 BCX0\" data-wac-het=\"1\">&#8220;as-you-type<\/span><\/span><span class=\"TextRun SCXW29468310 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW29468310 BCX0\" data-wac-het=\"1\">,<\/span><\/span><span class=\"TextRun SCXW29468310 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun CommentStart SCXW29468310 BCX0\" data-wac-het=\"1\">&#8220;<\/span><\/span><span class=\"TextRun SCXW29468310 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW29468310 BCX0\" data-wac-het=\"1\">\u00a0underlines\u00a0<\/span><\/span><span class=\"TextRun SCXW29468310 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW29468310 BCX0\" data-wac-het=\"1\">problems\u00a0<\/span><\/span><span class=\"TextRun SCXW29468310 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW29468310 BCX0\" data-wac-het=\"1\">in the\u00a0<\/span><\/span><span class=\"TextRun SCXW29468310 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW29468310 BCX0\" data-wac-het=\"1\">editor<\/span><\/span><span class=\"TextRun SCXW29468310 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW29468310 BCX0\" data-wac-het=\"1\">, and Lightbulb actions offer\u00a0<\/span><\/span><span class=\"TextRun SCXW29468310 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun CommentStart SCXW29468310 BCX0\" data-wac-het=\"1\">suggested fixes.<\/span><\/span><\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-25725 size-full\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2020\/03\/Gif-Demo.gif\" alt=\"Linter demo showing a check and applying a suggested fix.\" width=\"1006\" height=\"478\" \/><\/p>\n<p><span data-contrast=\"auto\">This new feature is built on the existing IntelliSense capabilities for C++ in Visual Studio. This mean<\/span><span data-contrast=\"auto\">s<\/span><span data-contrast=\"auto\">\u00a0results are provided more quickly than results from\u00a0<\/span><span data-contrast=\"auto\">Background Code Analysis<\/span><span data-contrast=\"auto\">. In order to ensure that IntelliSense stays as fast as possible, the linter checks are focused on eas<\/span><span data-contrast=\"auto\">ily detected<\/span><span data-contrast=\"auto\">\u00a0issues. The\u00a0<\/span><span data-contrast=\"auto\">new\u00a0<\/span><span data-contrast=\"auto\">linter checks complement existing code analysis tools (like\u00a0<\/span><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/in-editor-code-analysis-in-visual-studio-2019-preview-2\/\"><span data-contrast=\"none\">Background Code Analysis<\/span><\/a><span data-contrast=\"auto\">\u00a0using MSVC or\u00a0<\/span><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/code-analysis-with-clang-tidy-in-visual-studio\/\"><span data-contrast=\"none\">Clang-Tidy<\/span><\/a><span data-contrast=\"auto\">) which handle complex analysis.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\" data-wac-het=\"1\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">You can try out the linter today by enabling i<\/span><span data-contrast=\"auto\">t from the Experimental pane <\/span><span data-contrast=\"auto\">in\u00a0<\/span><span data-contrast=\"auto\">the<\/span><span data-contrast=\"auto\">\u00a0Tools<\/span><span data-contrast=\"auto\">\u00a0<\/span><span data-contrast=\"auto\">&gt;<\/span><span data-contrast=\"auto\">\u00a0<\/span><span data-contrast=\"auto\">Options<\/span><span data-contrast=\"auto\"> menu, under Text Editor &gt; C\/C++.<\/span><\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-26354\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2020\/03\/Tools-Options-Linter-option.png\" alt=\"Image shows Tools Options dialog with the Linter option selected\" width=\"740\" height=\"427\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2020\/03\/Tools-Options-Linter-option.png 740w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2020\/03\/Tools-Options-Linter-option-300x173.png 300w\" sizes=\"(max-width: 740px) 100vw, 740px\" \/><\/p>\n<h3 aria-level=\"2\"><span data-contrast=\"none\">Design Goals<\/span><\/h3>\n<p><span data-contrast=\"auto\">When deciding what would make a good linter check,<\/span><span data-contrast=\"auto\">\u00a0<\/span><span data-contrast=\"auto\">we\u00a0<\/span><span data-contrast=\"auto\">ke<\/span><span data-contrast=\"auto\">pt<\/span><span data-contrast=\"auto\">\u00a0a few\u00a0<\/span><span data-contrast=\"auto\">goals\u00a0<\/span><span data-contrast=\"auto\">in mind.<\/span><\/p>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"22\" aria-setsize=\"-1\" data-aria-posinset=\"1\" data-aria-level=\"1\"><span data-contrast=\"auto\"><span data-wac-het=\"1\">I<\/span><\/span><span data-contrast=\"auto\"><span data-wac-het=\"1\">dentify defects that surprise C++ developers\u00a0<\/span><\/span><span data-contrast=\"auto\"><span data-wac-het=\"1\">\u2013\u00a0<\/span><\/span><span data-contrast=\"auto\"><span data-wac-het=\"1\">especially polyglot developers coming from other languages.\u00a0<\/span><\/span><span data-contrast=\"auto\"><span data-wac-het=\"1\">The l<\/span><\/span><span data-contrast=\"auto\"><span data-wac-het=\"1\">inter<\/span><\/span><span data-contrast=\"auto\"><span data-wac-het=\"1\">\u00a0checks<\/span><\/span><span data-contrast=\"auto\"><span data-wac-het=\"1\">\u00a0will\u00a0<\/span><\/span><span data-contrast=\"auto\"><span data-wac-het=\"1\">smooth\u00a0<\/span><\/span><span data-contrast=\"auto\"><span data-wac-het=\"1\">the learning curve for some C++ language features<\/span><\/span><span data-contrast=\"auto\"><span data-wac-het=\"1\">.<\/span><\/span><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"22\" aria-setsize=\"-1\" data-aria-posinset=\"2\" data-aria-level=\"1\"><span data-contrast=\"auto\"><span data-wac-het=\"1\">O<\/span><\/span><span data-contrast=\"auto\"><span data-wac-het=\"1\">ffer suggested fix<\/span><\/span><span data-contrast=\"auto\"><span data-wac-het=\"1\">es<\/span><\/span><span data-contrast=\"auto\"><span data-wac-het=\"1\">\u00a0for the problem<\/span><\/span><span data-contrast=\"auto\"><span data-wac-het=\"1\">s<\/span><\/span><span data-contrast=\"auto\"><span data-wac-het=\"1\">. Just as IntelliSense errors can help you identify when code will fail to build due to syntactic errors, the linter help<\/span><\/span><span data-contrast=\"auto\"><span data-wac-het=\"1\">s<\/span><\/span><span data-contrast=\"auto\"><span data-wac-het=\"1\">\u00a0you identify and fix logic and runtime errors before\u00a0<\/span><\/span><span data-contrast=\"auto\"><span data-wac-het=\"1\">the code even builds<\/span><\/span><span data-contrast=\"auto\"><span data-wac-het=\"1\">.<\/span><\/span><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"22\" aria-setsize=\"-1\" data-aria-posinset=\"3\" data-aria-level=\"1\"><span data-contrast=\"auto\"><span data-wac-het=\"1\">I<\/span><\/span><span data-contrast=\"auto\"><span data-wac-het=\"1\">dentify problems that make sense to fix. This ends up being a matter of code style and philosophy, but in general<\/span><\/span><span data-contrast=\"auto\"><span data-wac-het=\"1\">\u00a0they\u2019re<\/span><\/span><span data-contrast=\"auto\"><span data-wac-het=\"1\">\u00a0focu<\/span><\/span><span data-contrast=\"auto\"><span data-wac-het=\"1\">sed<\/span><\/span><span data-contrast=\"auto\"><span data-wac-het=\"1\">\u00a0on the kinds of defects that cause real bugs<\/span><\/span><span data-contrast=\"auto\"><span data-wac-het=\"1\">.<\/span><\/span><\/li>\n<\/ul>\n<h3 aria-level=\"2\"><span data-contrast=\"none\">New Checks<\/span><\/h3>\n<p><span data-contrast=\"auto\">With these g<\/span><span data-contrast=\"auto\">oals\u00a0<\/span><span data-contrast=\"auto\">in mind, we have implemented the following checks\u00a0<\/span><span data-contrast=\"auto\">in\u00a0<\/span><span data-contrast=\"auto\">Preview 2.<\/span><\/p>\n<h4 aria-level=\"3\"><span data-contrast=\"none\">Arithmetic Overflow<\/span><\/h4>\n<p><span data-contrast=\"auto\">This check f<\/span><span data-contrast=\"auto\">inds cases where<\/span><span data-contrast=\"auto\">\u00a0<\/span><span data-contrast=\"auto\">arithmetic is evaluated with 32-bit types and then\u00a0<\/span><span data-contrast=\"auto\">assigned to a wider type. Assigning to a wider type is a good indication that the developer expected the expression value to exceed the range of a 32-bit type<\/span><span data-contrast=\"auto\">.<\/span><span data-contrast=\"auto\">\u00a0<\/span><span data-contrast=\"auto\">I<\/span><span data-contrast=\"auto\">n C++ the expression\u00a0<\/span><span data-contrast=\"auto\">will be<\/span><span data-contrast=\"auto\">\u00a0evaluated as 32-bit<\/span><span data-contrast=\"auto\">,<\/span><span data-contrast=\"auto\">\u00a0which may overflow,\u00a0<\/span><span data-contrast=\"auto\">and\u00a0<\/span><i><span data-contrast=\"auto\">then<\/span><\/i><span data-contrast=\"auto\"> widened for assignment.<\/span><\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-25723\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2020\/03\/Arithmetic-Overflow.png\" alt=\"Arithmetic Overflow Check and Suggested Fix.\" width=\"1170\" height=\"383\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2020\/03\/Arithmetic-Overflow.png 1170w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2020\/03\/Arithmetic-Overflow-300x98.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2020\/03\/Arithmetic-Overflow-1024x335.png 1024w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2020\/03\/Arithmetic-Overflow-768x251.png 768w\" sizes=\"(max-width: 1170px) 100vw, 1170px\" \/><\/p>\n<h4 aria-level=\"3\"><span data-contrast=\"none\">Integer Division Assigned to Floating Point<\/span><\/h4>\n<p><span data-contrast=\"auto\">This\u00a0<\/span><span data-contrast=\"auto\">check finds places where\u00a0<\/span><span data-contrast=\"auto\">integer division\u00a0<\/span><span data-contrast=\"auto\">is<\/span><span data-contrast=\"auto\">\u00a0assigned to a\u00a0<\/span><span data-contrast=\"auto\">floating-point<\/span><span data-contrast=\"auto\">\u00a0type. Assigning to a\u00a0<\/span><span data-contrast=\"auto\">floating-point<\/span><span data-contrast=\"auto\">\u00a0type is a good indication that the developer wanted the fractional part of the result<\/span><span data-contrast=\"auto\">. I<\/span><span data-contrast=\"auto\">n C++, the integer division will be\u00a0<\/span><span data-contrast=\"auto\">evaluated,<\/span><span data-contrast=\"auto\">\u00a0and the fractional part will be truncated before<\/span><span data-contrast=\"auto\">\u00a0the result is<\/span><span data-contrast=\"auto\">\u00a0assign<\/span><span data-contrast=\"auto\">ed<\/span><span data-contrast=\"auto\">\u00a0to the\u00a0<\/span><span data-contrast=\"auto\">floating-point<\/span><span data-contrast=\"auto\">\u00a0type.<\/span><\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-25726\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2020\/03\/Int-Division-to-Float.png\" alt=\"Int Division to Float Check and Suggested Check\" width=\"1122\" height=\"381\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2020\/03\/Int-Division-to-Float.png 1122w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2020\/03\/Int-Division-to-Float-300x102.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2020\/03\/Int-Division-to-Float-1024x348.png 1024w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2020\/03\/Int-Division-to-Float-768x261.png 768w\" sizes=\"(max-width: 1122px) 100vw, 1122px\" \/><\/p>\n<h4 aria-level=\"3\"><span data-contrast=\"none\">Logical\/Bitwise Mismatch<\/span><\/h4>\n<p><span data-contrast=\"auto\">This check finds cases where\u00a0<\/span><span data-contrast=\"auto\">logical operators\u00a0<\/span><span data-contrast=\"auto\">are used\u00a0<\/span><span data-contrast=\"auto\">with integer<\/span><span data-contrast=\"auto\">\u00a0values<\/span><span data-contrast=\"auto\">\u00a0or using bitwise operators with\u00a0<\/span><span data-contrast=\"auto\">Boolean values. C++ allows this because of implicit conversions, but the practice is<\/span><span data-contrast=\"auto\">\u00a0error prone and hurts code readability.<\/span><\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-25727\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2020\/03\/Logical-Bitwise-Mismatch.png\" alt=\"Logical Bitwise Mismatch Check and Suggested Fix.\" width=\"1002\" height=\"355\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2020\/03\/Logical-Bitwise-Mismatch.png 1002w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2020\/03\/Logical-Bitwise-Mismatch-300x106.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2020\/03\/Logical-Bitwise-Mismatch-768x272.png 768w\" sizes=\"(max-width: 1002px) 100vw, 1002px\" \/><\/p>\n<h4 aria-level=\"2\"><span data-contrast=\"none\">Assignment\/Equality Mismatch<\/span><\/h4>\n<p><span data-contrast=\"auto\">Using the assignment operator in conditional expressions is syntactically correct but\u00a0<\/span><span data-contrast=\"auto\">may be<\/span><span data-contrast=\"auto\">\u00a0a logical error. This check looks for cases where variables are being assigned\u00a0<\/span><span data-contrast=\"auto\">from\u00a0<\/span><span data-contrast=\"auto\">constants in conditions<\/span><span data-contrast=\"auto\">. This<\/span><span data-contrast=\"auto\">\u00a0is almost always incorrect because it forces the condition to always be true or false.<\/span><\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-25724\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2020\/03\/Assignment-Mismatch.png\" alt=\"Assignment Equality Mismatch Check and Suggested Fix.\" width=\"965\" height=\"332\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2020\/03\/Assignment-Mismatch.png 965w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2020\/03\/Assignment-Mismatch-300x103.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2020\/03\/Assignment-Mismatch-768x264.png 768w\" sizes=\"(max-width: 965px) 100vw, 965px\" \/><\/p>\n<h4 aria-level=\"3\"><span data-contrast=\"none\">Accidental Copy<\/span><\/h4>\n<p><span data-contrast=\"auto\">The <code>auto<\/code> keyword in C++ is a great feature, especially when interacting with templated code. It has one subtle behavior that can be confusing or easily overlooked by C++ developers of all skill levels. <code>auto<\/code> does not deduce references so in cases where a declared variable is being assigned from an expression that returns a reference, a copy is made. This isn&#8217;t\u00a0<span data-contrast=\"auto\">always<\/span><span data-contrast=\"auto\">\u00a0a bug, but we wanted to help developers be aware that a copy is being made, when maybe it wasn&#8217;t desired.<\/span><\/span><\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-25722\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2020\/03\/Accidental-Copy.png\" alt=\"Accidental Copy Check and Suggested Fix.\" width=\"1183\" height=\"409\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2020\/03\/Accidental-Copy.png 1183w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2020\/03\/Accidental-Copy-300x104.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2020\/03\/Accidental-Copy-1024x354.png 1024w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2020\/03\/Accidental-Copy-768x266.png 768w\" sizes=\"(max-width: 1183px) 100vw, 1183px\" \/><\/p>\n<h4 aria-level=\"3\"><span data-contrast=\"none\">Uninitialized Local<\/span><\/h4>\n<p><span data-contrast=\"auto\">Primitive variables in C++ are not initialized to any value by default. This can lead to non-deterministic behaviors at runtime. The current implementation of this check is very aggressive and will warn on any declaration that doesn&#8217;t have an initializer.<\/span><\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-25729\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2020\/03\/Uninitialized-Local.png\" alt=\"Uninitialized Local check and suggested fix.\" width=\"904\" height=\"304\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2020\/03\/Uninitialized-Local.png 904w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2020\/03\/Uninitialized-Local-300x101.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2020\/03\/Uninitialized-Local-768x258.png 768w\" sizes=\"(max-width: 904px) 100vw, 904px\" \/><\/p>\n<h3 aria-level=\"2\"><span data-contrast=\"none\">Coming Soon<\/span><\/h3>\n<p><span data-contrast=\"auto\">The new linter is still<\/span><span data-contrast=\"auto\">\u00a0a work in progress<\/span><span data-contrast=\"auto\">, but we\u00a0<\/span><span data-contrast=\"auto\">are<\/span><span data-contrast=\"auto\">\u00a0<\/span><span data-contrast=\"auto\">excited to be able to ship\u00a0<\/span><span data-contrast=\"auto\">a<\/span><span data-contrast=\"auto\">\u00a0preview release\u00a0<\/span><span data-contrast=\"auto\">that developers\u00a0<\/span><span data-contrast=\"auto\">c<\/span><span data-contrast=\"auto\">an<\/span><span data-contrast=\"auto\">\u00a0try out<\/span><span data-contrast=\"auto\">.<\/span><span data-contrast=\"auto\">\u00a0Here are a few features that will be coming in\u00a0<\/span><span data-contrast=\"auto\">future releases.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335551550&quot;:1,&quot;335551620&quot;:1,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\" data-wac-het=\"1\">\u00a0<\/span><\/p>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"3\" aria-setsize=\"-1\" data-aria-posinset=\"4\" data-aria-level=\"1\"><span data-contrast=\"auto\">Configuration<\/span><span data-contrast=\"auto\">:<\/span><span data-contrast=\"auto\">\u00a0currently the feature is either enabled or disabled. There isn&#8217;t a way in the current version to enable\/disable or change the severity of individual checks.<\/span><span data-ccp-props=\"{&quot;134233279&quot;:true,&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\" data-wac-het=\"1\">\u00a0<\/span><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"3\" aria-setsize=\"-1\" data-aria-posinset=\"5\" data-aria-level=\"1\"><span data-contrast=\"auto\">Suppression<\/span><span data-contrast=\"auto\">:<\/span><span data-contrast=\"auto\">\u00a0many code analysis tools\u00a0<\/span><span data-contrast=\"auto\">can<\/span><span data-contrast=\"auto\">\u00a0suppress warnings on a per-instance basis. This is typically done in the source code with\u00a0<\/span><span data-contrast=\"auto\">an<\/span><span data-contrast=\"auto\">\u00a0annotation<\/span><span data-contrast=\"auto\">\u00a0(e.g. #pragma or a code comment)<\/span><span data-contrast=\"auto\">. The linter does not support suppression currently.<\/span><span data-ccp-props=\"{&quot;134233279&quot;:true,&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\" data-wac-het=\"1\">\u00a0<\/span><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"3\" aria-setsize=\"-1\" data-aria-posinset=\"6\" data-aria-level=\"1\"><span data-contrast=\"auto\">Integration with\u00a0<\/span><span data-contrast=\"auto\">other code\u00a0<\/span><span data-contrast=\"auto\">analysis tools<\/span><span data-contrast=\"auto\">:<\/span><span data-contrast=\"auto\">\u00a0<\/span><span data-contrast=\"auto\">t<\/span><span data-contrast=\"auto\">he<\/span><span data-contrast=\"auto\">\u00a0<\/span><span data-contrast=\"auto\">linter checks only run in the IDE\u00a0<\/span><span data-contrast=\"auto\">so\u00a0<\/span><span data-contrast=\"auto\">currently cannot be used as<\/span><span data-contrast=\"auto\">\u00a0part of a CI or build.\u00a0<\/span><span data-contrast=\"auto\">The compiler-based tools (MSVC and Clang-Tidy<\/span><span data-contrast=\"auto\">) should\u00a0<\/span><span data-contrast=\"auto\">continue to be used. When Background Code Analy<\/span><span data-contrast=\"auto\">sis is enabled, you may get green squiggles\u00a0<\/span><span data-contrast=\"auto\">from MSVC or Clang-Tidy\u00a0<\/span><span data-contrast=\"auto\">that<\/span><span data-contrast=\"auto\">\u00a0overlap with the linter\u00a0<\/span><span data-contrast=\"auto\">results in the editor.\u00a0<\/span><span data-ccp-props=\"{&quot;134233279&quot;:true,&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\" data-wac-het=\"1\">\u00a0<\/span><\/li>\n<\/ul>\n<p><span data-contrast=\"auto\">We&#8217;ve been working hard to make an editor that helps developers &#8220;shift left&#8221; and find bugs earlier in the development loop. We hope that you find the new IntelliSense Code Linter for C++ useful. Please try it out and let us know what you think.<\/span><span data-contrast=\"auto\">\u00a0We can be reached via the comments below, email (<\/span><a href=\"mailto:visualcpp@microsoft.com\"><span data-contrast=\"none\">visualcpp@microsoft.com<\/span><\/a><span data-contrast=\"auto\">), and Twitter (<\/span><a href=\"https:\/\/twitter.com\/visualc\"><span data-contrast=\"none\">@VisualC<\/span><\/a><span data-contrast=\"auto\">). The best way to file a bug or suggest a feature is via\u00a0<\/span><a href=\"https:\/\/developercommunity.visualstudio.com\/spaces\/8\/index.html\"><span data-contrast=\"none\">Developer Community<\/span><\/a><span data-contrast=\"auto\">.\u00a0<\/span><span data-contrast=\"auto\">Happy coding!<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introducing the IntelliSense Code Linter for C++; a preview of &#8220;as-you-type&#8221; code analysis with fixups. Try it out today in Visual Studio 2019 16.6 Preview 2.<\/p>\n","protected":false},"author":2869,"featured_media":25725,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[140,119,3493,14,3494],"class_list":["post-25717","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cplusplus","tag-c","tag-code-analysis","tag-code-linter","tag-intellisense","tag-linter"],"acf":[],"blog_post_summary":"<p>Introducing the IntelliSense Code Linter for C++; a preview of &#8220;as-you-type&#8221; code analysis with fixups. Try it out today in Visual Studio 2019 16.6 Preview 2.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/25717","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\/2869"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/comments?post=25717"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/25717\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media\/25725"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media?parent=25717"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/categories?post=25717"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/tags?post=25717"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}