Search code examples
visual-studiosonarqubesonarlintsonarlint-vs

Show Cognitive Complexity of method in Visual Studio


While using SonarLint and SonarQube in Visual Studio (2017), is there a way to display the Cognitive Complexity of a method anywhere?

It is shown when it exceeds the maximum value, but I can't seem to find where I can see it once I'm below the threshold.

"Refactor this method to reduce its Cognitive Complexity from 29 to the 15 allowed"


Solution

  • If you have Resharper in Visual Studio you can use the cognitivecomplexity resharper plugin.

    It shows the cognitive complexity even though it is below the (in Resharper options configurable) threshold

    Cognitive Complexity in tooltip