I've reviewed code that passed every check we had. Functions were short, lint was clean, coverage was north of ninety percent. And I still had to read it four times to understand what it did. The metrics were green and the code was a fog. That gap, between code that scores well and code a human can actually follow, is the whole reason cognitive complexity is worth talking about.
Most of us learned cyclomatic complexity first, which counts the number of independent paths through a piece of code. It's fine for knowing how many test cases you need, but it's a poor model of how hard code is to read. A flat switch with twelve cases has high cyclomatic complexity and is trivial to understand. Three levels of nested conditionals have fewer paths and are miserable.
Cognitive complexity, introduced by SonarSource and largely credited to G. Ann Campbell, tries to measure the second thing: how much effort a person