Files
codeql/javascript/ql/src/Metrics/FCyclomaticComplexity.ql
2020-02-27 09:41:01 +00:00

24 lines
518 B
Plaintext

/**
* @name Average cyclomatic complexity of files
* @description The average cyclomatic complexity of the functions in a file.
* @kind treemap
* @treemap.warnOn highValues
* @metricType file
* @metricAggregate avg max
* @precision very-high
* @tags testability
* @id js/cyclomatic-complexity-per-file
*/
import javascript
from File f, float n
where
n =
avg(Function fun, int toAvg |
fun.getTopLevel().getFile() = f and toAvg = fun.getCyclomaticComplexity()
|
toAvg
)
select f, n