Cleaning code with code analysis tools
VS 2022 includes a series of C# or Visual Basic code analyzers that allow us to maintain good code quality and consistent style in the source code. To use this feature by default, projects must be configured on a framework version of .NET 5 or higher. To differentiate compilation errors, analysis violations will appear with the CA
prefix in the case of a code quality analysis violation and IDE
in the case of a style analysis violation.
The code analysis tools correspond to code quality analysis and code style analysis, so we will see what they are, how they can help us, and learn how to set up and run code cleanup profiles. First, let’s look at how to take advantage of code quality analysis.
Code quality analysis
Code quality involves having secure source code, with the best possible performance and good design, among other characteristics. Fortunately, VS can help us to maintain high-quality code through rules enabled by default...