W.r.t to one of the java projects, we recently started using SonarLint. Output of the code analysis shows too many critical code smell alerts.
Critical code smell: Refactor this method to reduce its Cognitive Complexity.
I have heard about Cyclomatic Complexity but not about Cognitive Complexity. My questions to the group:
- Is Cognitive Complexity an industry standard?
- Impacts of Cognitive Complexity on code apart from readability and maintainability.
- Does Cognitive Complexity apply only to methods or any other parts of code?
- Any specific criteria on which Cognitive Complexity depends on?
- Best practices to improve Cognitive Complexity of a code.
I have gone through this link but could not get answers to all my questions.
Thanks in advance.