Cyclomatic complexity is one of the multiple measurements of code complexity. For example, in Visual Studio, the maintainability index depends on:
- Cyclomatic complexity,
- Depth of inheritance,
- Class coupling,
- Lines of IL code (IL code being the source code compiled to Intermediary Language which is then JIT-compiled).
Every of those measurements, as well as other complexity measurements, work somehow, but are never the absolute indication that the source code has complexity issues. Some measurements, as LOC, are known to be totally meaningless and misleading; others, like cyclomatic complexity, are slightly better, but still have issues.
This is due to the fact that:
It is too complicated for a computer program to know how really complex the source code would be perceived by a developer.
For example, I often noticed a huge drop of maintainability index when refactoring the code from procedural-style to functional-style through LINQ, transforming a block of highly unreadable source code into a single chaining expression which was extremely explicit.
Another example would be the reflection of programming patterns on the metrics. Often, by introducing programming patterns into your code, you will make it less complex for a developer (assuming this developer is familiar with those patterns), but the maintainability index will drop.
Source code can have different forms.
This limitation doesn't exist only for web apps. In desktop applications, for example, what about the complexity of the UI layout (XAML code in Windows applications)? What about the generated code? Or database access?