Using C# and VS how to see Cylcomatic complexity in SonarLint

Operating system: Windows
IDE name and flavor/env: VS or VSCode

Using SonarLint can I see while I am coding if my function is exceeding cyclomatic complexity limit?
Or can I see anyhow cylcomatic complexity other than going to VS Metrics?


If you’re in connected mode, then the rules applied at the server will be applied in SonarLint. Thus, if

  • Cyclomatic Complexity is turned on at the server
  • you cross the configured max Cyclomatic Complexity

You should see an issue raised in SonarLint. And once an issue is raised, I believe you should also be able to see where each point of complexity comes from.

IIRC, the Cyclomatic Complexity rule is not on by default, so if you’re not in connected mode, that would explain why you’re not seeing issues from it. However, you do have the ability to choose which rules to run in standalone mode.


1 Like