Files
codeql/javascript/ql/src/Summary/LinesOfUserCode.ql
2021-06-07 16:41:59 +02:00

22 lines
656 B
Plaintext

/**
* @name Total lines of user written JavaScript and TypeScript code in the database
* @description The total number of lines of JavaScript and TypeScript code from the source code directory,
* excluding auto-generated files and files in `node_modules`. This query counts the lines of code, excluding
* whitespace or comments.
* @kind metric
* @tags summary
* lines-of-code
* @id js/summary/lines-of-user-code
*/
import javascript
import semmle.javascript.GeneratedCode
select sum(File f |
not f.getATopLevel().isExterns() and
exists(f.getRelativePath()) and
not isGeneratedCode(f)
|
f.getNumberOfLinesOfCode()
)