You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cyclomatic Complexity was developed by a Computer Scientist at IBM named Thomas McCabe in an article called ["A Complexity Measurement"](https://ieeexplore.ieee.org/document/1702388). The approach uses Graph Theory to creates a representation of the number of linear paths possible through the execution of an algorithm. It will produce a simple integer value as an assessment. For example, the following code has an objective Complexity of 2:
4
+
5
+
```javascript
6
+
functionmain(a) {
7
+
if (a >0) {
8
+
return"is positive"
9
+
}
10
+
11
+
return"is negative"
12
+
}
13
+
```
14
+
15
+
As code grows, and I'm sure we've all seen it, algorithms can take on a life of their own and grow to contain numerous linear paths that all have to be maintained and amount to the cognitive overhead of a given algorithm.
16
+
17
+
This library provides any JS library the ability to analyze the Cyclomatic Complexity of their functions with a dependency solely on the [abstract-syntax-tree](https://www.npmjs.com/package/abstract-syntax-tree)
0 commit comments