{"id":3257,"date":"2023-06-13T16:01:08","date_gmt":"2023-06-13T20:01:08","guid":{"rendered":"https:\/\/blog.wholetomato.com\/?p=3257"},"modified":"2023-06-13T16:01:08","modified_gmt":"2023-06-13T20:01:08","slug":"everything-you-need-to-know-about-code-inspections","status":"publish","type":"post","link":"https:\/\/stage.wholetomato.com\/blog\/everything-you-need-to-know-about-code-inspections\/","title":{"rendered":"Everything you need to know about code inspections"},"content":{"rendered":"<p><span style=\"font-weight: 400;\">By now you might have heard about Visual Assist\u00e2\u20ac\u2122s code inspections\u00e2\u20ac\u201dit has been a staple of almost all recent updates and we hosted two webinars discussing it. This article sums it all in an easy to read and convenient way.<\/span><\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_76 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\r\n<div class=\"ez-toc-title-container\"><p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\r\n<\/div><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/stage.wholetomato.com\/blog\/everything-you-need-to-know-about-code-inspections\/#What_are_code_inspections\" >What are code inspections?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/stage.wholetomato.com\/blog\/everything-you-need-to-know-about-code-inspections\/#What_issues_can_it_detect\" >What issues can it detect?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/stage.wholetomato.com\/blog\/everything-you-need-to-know-about-code-inspections\/#Why_use_code_inspections_to_fix_issues_and_refactor_code\" >Why use code inspections to fix issues and refactor code?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/stage.wholetomato.com\/blog\/everything-you-need-to-know-about-code-inspections\/#How_to_use_code_inspections_to_eliminate_code_smells\" >How to use code inspections to eliminate code smells<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/stage.wholetomato.com\/blog\/everything-you-need-to-know-about-code-inspections\/#Visual_Assist_by_Whole_Tomato_Filling_Gaps_in_Visual_Studio_for_CC_and_C_Developers\" >Visual Assist by Whole Tomato: Filling Gaps in Visual Studio for C\/C++ and C# Developers<\/a><\/li><\/ul><\/nav><\/div>\r\n<h2><span class=\"ez-toc-section\" id=\"What_are_code_inspections\"><\/span><span style=\"font-weight: 400;\">What are code inspections?<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><a href=\"https:\/\/www.wholetomato.com\/features\/feature-code-inspection#:~:text=The%20Code%20Inspection%20feature%20of,be%20deduced%20via%20static%20analysis.\"><span style=\"font-weight: 400;\">Code inspections<\/span><\/a><span style=\"font-weight: 400;\"> is a feature in Visual Assist that automatically checks source code for issues and code smells, and suggests the appropriate fix. The main benefit of using code inspection is better overall code quality with minimal effort.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Code inspections work by utilizing code checkers, sometimes referred to as static analyzers. These are tools that analyze your source code passively\u00e2\u20ac\u201dit happens as you type your code. You do not need to actually compile and execute your code to detect a problem (i.e. finding bugs and errors <\/span><span style=\"font-weight: 400;\">using run-time techniques such as testing).<\/span><\/p>\n<div id=\"attachment_3262\" style=\"width: 1034px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2023\/06\/Code-Inspections-Slides-1-e1686685396446.png?ssl=1\"><img decoding=\"async\" aria-describedby=\"caption-attachment-3262\" data-attachment-id=\"3262\" data-permalink=\"https:\/\/stage.wholetomato.com\/blog\/everything-you-need-to-know-about-code-inspections\/code-inspections-slides-1\/\" data-orig-file=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2023\/06\/Code-Inspections-Slides-1-e1686685396446.png?fit=1761%2C806&amp;ssl=1\" data-orig-size=\"1761,806\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Code Inspections Visual Assist\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2023\/06\/Code-Inspections-Slides-1-e1686685396446.png?fit=300%2C137&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2023\/06\/Code-Inspections-Slides-1-e1686685396446.png?fit=1024%2C469&amp;ssl=1\" class=\"wp-image-3262 size-large\" src=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2023\/06\/Code-Inspections-Slides-1-e1686685396446-1024x469.png?resize=1024%2C469&#038;ssl=1\" alt=\"\" width=\"1024\" height=\"469\" srcset=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2023\/06\/Code-Inspections-Slides-1-e1686685396446.png?resize=1024%2C469&amp;ssl=1 1024w, https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2023\/06\/Code-Inspections-Slides-1-e1686685396446.png?resize=300%2C137&amp;ssl=1 300w, https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2023\/06\/Code-Inspections-Slides-1-e1686685396446.png?resize=768%2C352&amp;ssl=1 768w, https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2023\/06\/Code-Inspections-Slides-1-e1686685396446.png?resize=1536%2C703&amp;ssl=1 1536w, https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2023\/06\/Code-Inspections-Slides-1-e1686685396446.png?resize=360%2C165&amp;ssl=1 360w, https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2023\/06\/Code-Inspections-Slides-1-e1686685396446.png?w=1761&amp;ssl=1 1761w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" data-recalc-dims=\"1\" \/><\/a><p id=\"caption-attachment-3262\" class=\"wp-caption-text\">Code issues are underlined in blue. Line information and a description of the issue is also shown in the VA Code Inspection Results window.<\/p><\/div>\n<p><span style=\"font-weight: 400;\">It looks for common patterns, broken coding conventions, and potential bugs in the code using algorithms and special techniques. The purpose of code checkers is to catch problems early in the development process, which can save a lot of time and effort later on.\u00c2\u00a0<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"What_issues_can_it_detect\"><\/span><span style=\"font-weight: 400;\">What issues can it detect?<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">The issues and code smells that can be detected vary widely from stylistic infractions on coding convention, all the way to system critical errors.\u00c2\u00a0 Here are some of the common fixable issues:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Detecting and updating obsolete coding syntax<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Highlights possible readability issues and broken coding conventions<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Checking type-related errors (such as making invalid type conversions or assigning values of incompatible types, using uninitialized variables, or.)<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Wasted resources due to inefficient memory allocation\/deallocation.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Other issues of non-obvious, but potentially dangerous, incorrectness<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Visual Assist\u00e2\u20ac\u2122s code inspection feature is based on <\/span><a href=\"https:\/\/stage.wholetomato.com\/blog\/2021\/01\/08\/a-brief-introduction-to-clang-tidy-and-its-role-in-visual-assist\/\"><span style=\"font-weight: 400;\">LLVM\u00e2\u20ac\u2122s \/Clang-Tidy code analysis engine<\/span><\/a><span style=\"font-weight: 400;\"> so you can be sure that it covers a variety of checks targeted at finding security and API usage bugs, dead code, and other logic errors. Additionally, we extend the functionality through the use of \u00e2\u20ac\u02dcevaluated\u00e2\u20ac\u2122 checkers (more below).<\/span><\/p>\n<p><a href=\"https:\/\/stage.wholetomato.com\/blog\/2021\/04\/01\/how-to-modernize-with-visual-assist-part-2\/\"><b>READ: More examples from a blog by Bartek from C++ Stories<\/b><\/a><\/p>\n<p><b>Evaluated and unevaluated checkers<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Code checkers are added gradually to the <\/span><a href=\"https:\/\/docs.wholetomato.com\/default.asp?W761\"><span style=\"font-weight: 400;\">list of Visual Assist code inspections<\/span><\/a><span style=\"font-weight: 400;\">. All checkers that are in the list are thoroughly evaluated, checked, and tested. Evaluated checkers often include changed functionality that is not in the base clang-tidy, making them more reliable and safe. This is a key part of the value of the checkers we include. Using evaluated checkers guarantees that the code will be refactored properly and any suggested fix will not break anything.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">On the other hand, unevaluated checkers are still based on Clang-Tidy\u00e2\u20ac\u2122s extensive list but have not undergone the same quality assurance tests as its counterparts. Almost a hundred unevaluated checkers have been added in <\/span><a href=\"https:\/\/stage.wholetomato.com\/blog\/2023\/05\/17\/visual-assist-2023-2-released\/\"><span style=\"font-weight: 400;\">Visual Assist 2023.2<\/span><\/a><span style=\"font-weight: 400;\">.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Note that unevaluated checkers will still suggest the recommended fix and behave like normal checks, but users are advised to manually ensure that everything is working correctly. The benefit that this brings is that developers can know what and where a potential issue lies\u00e2\u20ac\u201dwhich is oftentimes the bulk of the work.<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Why_use_code_inspections_to_fix_issues_and_refactor_code\"><\/span><span style=\"font-weight: 400;\">Why use code inspections to fix issues and refactor code?<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<div id=\"attachment_1874\" style=\"width: 762px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2021\/03\/image1.png?ssl=1\"><img decoding=\"async\" aria-describedby=\"caption-attachment-1874\" data-attachment-id=\"1874\" data-permalink=\"https:\/\/stage.wholetomato.com\/blog\/everything-you-need-to-know-about-code-inspections\/image1\/\" data-orig-file=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2021\/03\/image1.png?fit=752%2C382&amp;ssl=1\" data-orig-size=\"752,382\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image1\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2021\/03\/image1.png?fit=300%2C152&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2021\/03\/image1.png?fit=752%2C382&amp;ssl=1\" class=\"wp-image-1874 size-full\" src=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2021\/03\/image1.png?resize=752%2C382&#038;ssl=1\" alt=\"\" width=\"752\" height=\"382\" srcset=\"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2021\/03\/image1.png?w=752&amp;ssl=1 752w, https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2021\/03\/image1.png?resize=300%2C152&amp;ssl=1 300w, https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2021\/03\/image1.png?resize=360%2C183&amp;ssl=1 360w\" sizes=\"(max-width: 752px) 100vw, 752px\" data-recalc-dims=\"1\" \/><\/a><p id=\"caption-attachment-1874\" class=\"wp-caption-text\">Running code inspections lists down issues in a window for you to examine before implementing fixes.<\/p><\/div>\n<p><span style=\"font-weight: 400;\">Code inspections read source code line by line, analyzing the structure, logic, and syntax. It pays attention to specific patterns or coding conventions that may indicate potential issues. As they encounter a line of code, it uses a set of rules and algorithms to determine if the code adheres to best practices or if there are any deviations.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Using code inspections automates a lot of the manual checking and verification that developers would traditionally do. With it, it no longer matters how familiar a developer is on a project, or how large a solution is\u00e2\u20ac\u201dit all goes under the same level of scrutiny.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">it provides some of the following benefits as well:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Be able to utilize modern coding practices without actually knowing them.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Improve code quality with minimal refactoring risk.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Detecting potential code issues early.<\/span><\/li>\n<\/ul>\n<p><b>WATCH: <\/b><a href=\"https:\/\/youtu.be\/uaQp69bUeQ4?t=869\"><b>Understand how code inspections are evaluated<\/b><\/a><\/p>\n<h2><span class=\"ez-toc-section\" id=\"How_to_use_code_inspections_to_eliminate_code_smells\"><\/span><span style=\"font-weight: 400;\">How to use code inspections to eliminate code smells<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">First, make sure to enable it by navigating to<\/span><i><span style=\"font-weight: 400;\"> Extensions -&gt; VAssistX -&gt; Code Inspection (beta) -&gt; Enable code inspection.\u00c2\u00a0<\/span><\/i><\/p>\n<p><span style=\"font-weight: 400;\">Then you can either click on detected issues underlined in blue, use the Quick Refactoring Menu (<\/span><i><span style=\"font-weight: 400;\">Shift + Alt + Q<\/span><\/i><span style=\"font-weight: 400;\">) while on the highlighted issue, or use the code inspection dialogue to implement changes in batches.<\/span><\/p>\n<p><b>WATCH: Code inspections in action<\/b><\/p>\n<p><iframe title=\"YouTube video player\" src=\"https:\/\/www.youtube.com\/embed\/6NWgB0D_UdM\" width=\"560\" height=\"315\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Visual_Assist_by_Whole_Tomato_Filling_Gaps_in_Visual_Studio_for_CC_and_C_Developers\"><\/span><span style=\"font-weight: 400;\">Visual Assist by Whole Tomato: Filling Gaps in Visual Studio for C\/C++ and C# Developers<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Visual Assist is a productivity extension for Visual Studio development work. It provides a set of intelligent refactoring, navigation, code highlighting and generation features for C, C++, and C# development. With its highly-efficient memory management and minimal UI, Visual Assist gives developers uninterrupted access to advanced features without slowing down the IDE.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Visual Assist is one of the definitive plugins that conceptualized and shaped most of the current features you see now in Visual Studio. And to this day it continues to develop user-centric design for maximum productivity and usability.<\/span><\/p>\n<p><a href=\"https:\/\/www.wholetomato.com\/downloads\">Download Visual Assist here.<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>By now you might have heard about Visual Assist\u00e2\u20ac\u2122s code inspections\u00e2\u20ac\u201dit has been a staple of almost all recent updates and we hosted two webinars discussing it. This article sums it all in an easy&#8230;<\/p>\n","protected":false},"author":213500340,"featured_media":3261,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","_jetpack_newsletter_access":"","_jetpack_newsletter_tier_id":0,"footnotes":""},"categories":[672],"tags":[2426,4458826,726359793,726359786,726359827,1981,12004844],"class_list":["post-3257","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tips-and-tricks","tag-c","tag-code-inspection","tag-productivity","tag-refactoring","tag-time-savings","tag-tools","tag-visual-assist"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/stage.wholetomato.com\/blog\/wp-content\/uploads\/2023\/06\/Code-Inspection-Blog-Header.png?fit=960%2C540&ssl=1","jetpack_likes_enabled":true,"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pfhqii-Qx","amp_enabled":true,"_links":{"self":[{"href":"https:\/\/stage.wholetomato.com\/blog\/wp-json\/wp\/v2\/posts\/3257","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/stage.wholetomato.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/stage.wholetomato.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/stage.wholetomato.com\/blog\/wp-json\/wp\/v2\/users\/213500340"}],"replies":[{"embeddable":true,"href":"https:\/\/stage.wholetomato.com\/blog\/wp-json\/wp\/v2\/comments?post=3257"}],"version-history":[{"count":7,"href":"https:\/\/stage.wholetomato.com\/blog\/wp-json\/wp\/v2\/posts\/3257\/revisions"}],"predecessor-version":[{"id":3266,"href":"https:\/\/stage.wholetomato.com\/blog\/wp-json\/wp\/v2\/posts\/3257\/revisions\/3266"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/stage.wholetomato.com\/blog\/wp-json\/wp\/v2\/media\/3261"}],"wp:attachment":[{"href":"https:\/\/stage.wholetomato.com\/blog\/wp-json\/wp\/v2\/media?parent=3257"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/stage.wholetomato.com\/blog\/wp-json\/wp\/v2\/categories?post=3257"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/stage.wholetomato.com\/blog\/wp-json\/wp\/v2\/tags?post=3257"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}