0

Whenever I run code analysis on my solution, a whole bunch of code files that have deviations from the configured rule set get checked out with pragma statements around the rogue line. Is there a way to get the code analysis errors/warnings outside of those files, instead of getting them checked out?

It is a pain to check back in all those files which we have no intention to correct, at least at this time.

Zoe
  • 27,060
  • 21
  • 118
  • 148
DiligentKarma
  • 5,198
  • 1
  • 30
  • 33
  • As a guess, Visual Studio 2017 will be checking out the files because you've told it to fix all the issues, not just find them. In normal use, Code Analysis rules just generate Errors/Warnings/Hints that you can choose to ignore or not (in fact, I'd encourage you to configure an appropriate ruleset to focus on the rules you want to apply). The other possibility is to add the exclusions to a separate supressions file, allowing you to ignore the violations without modifying the original files. – Bevan Apr 03 '17 at 22:54
  • @Bevan, I wanted to see deviations from the inbuilt rulesets to see what are the standard coding practices MS suggests, so that then I can choose the ones that make a good case. I will try to find out if there is a way so that all such suggestions are displayed in a window like the Error List, allowing us to go to each line in violation and fix it if needed, than VS doing it for us. – DiligentKarma Apr 04 '17 at 18:37
  • In Visual Studio 2017 select `Analyze | Run Code Analysis | On Solution` to run it across your entire solution. Any issues found will be listed in the **Error List** for you to review. – Bevan Apr 07 '17 at 03:21
  • I'm wondering whether you (originally) inadvertently selected `Analyse | Run Code And Suppress Active Issues | For Solution`, which would have the behavior you describe of modifying all the files with `#pragma` statements. – Bevan Apr 15 '17 at 02:55
  • @Bevan, I knowingly did the analysis step as mentioned by you. I had the impression that the violations will be listed somewhere instead of checking the files out. There was, however, another xml file created noting all the deviations. – DiligentKarma Apr 17 '17 at 16:01

0 Answers0