Skip to content

matkoch/resharper-cognitivecomplexity

Repository files navigation

CognitiveComplexity for Rider and ReSharper

Rider ReSharper

This plugin implements live calculation of the Cognitive Complexity metric, which was proposed by G. Ann Campbell in Cognitive Complexity - A new way of measuring understandability (c) SonarSource S.A. 2016-2018, Switzerland.

Abstract: Cyclomatic Complexity was initially formulated as a measurement of the "testability and maintainability" of the control flow of a module. While it excels at measuring the former, its underlying mathematical model is unsatisfactory at producing a value that measures the latter. This white paper describes a new metric that breaks from the use of mathematical models to evaluate code in order to remedy Cyclomatic Complexity’s shortcomings and produce a measurement that more accurately reflects the relative difficulty of understanding, and therefore of maintaining methods, classes, and applications.

Configuration

A options page is located under Frameworks & Languages | Cognitive Complexity, which allows to configure the visual representation.

⚠️ Changing a value might require focusing another input to apply it. This is currently a bug on Rider side.

The language specific threshold indicates what you consider the maximum allowed value for the Cognitive Complexity metric. Code Vision thresholds define how the value is represented in the UI:

Depending on your individual preferences, you can disable for instance the simple enough interval, by changing it's percentage threshold to the same as mildly complex. Setting simple enough to a value of 0 would remove the simple gray diamond.