Hey,
I noticed that nested functions in JavaScript increment cyclomatic complexity of the parent function by 1, but that the parent function also includes the complexity of the nested functions. I don't think this should be the case.
They do not fit the definition of cyclomatic complexity which includes only control-flow statements.
In many cases, JavaScript functions are more analogous to classes in how they are used. Especially in frameworks such as AngularJS, they are used this way. Being a dependency of the UI, most of the nested functions in these are declarations for very simple tasks like switching a boolean on/off or formatting the model to be presented a certain way. If we adhere to normal cyclomatic complexity 10, you end up with a cumbersome FizzBuzz disaster.
Please consider changing the way cyclomatic complexity is computed in JavaScript. Cyclomatic complexity is a good tool for limiting complexity, encouraging maintainability, and facilitating readability, but this particular nuance does not support these three goals and causes more problems than it solves.
Thanks,
Chris