mirror of
https://github.com/github/codeql.git
synced 2025-12-25 13:16:33 +01:00
Some languages have multiple `summary` queries for lines of code, representing different forms of counting (user written, total, etc). When Code Scanning sees results from multiple such summary queries in a single run, it will need to choose one as the primary LoC count to display in the UI. By ensuring only one query per language has the `lines-of-code` tag, in future we can teach Code Scanning to look for this particular tag to identify the primary LoC count. If a "lines of user code" query is available, use that. Otherwise use the total "lines of code". (It is completely fine for multiple queries to be tagged with `summary`.)
12 lines
564 B
Plaintext
12 lines
564 B
Plaintext
/**
|
|
* @id js/summary/lines-of-code
|
|
* @name Total lines of JavaScript and TypeScript code in the database
|
|
* @description The total number of lines of JavaScript or TypeScript code across all files checked into the repository, except in `node_modules`. This is a useful metric of the size of a database. For all files that were seen during extraction, this query counts the lines of code, excluding whitespace or comments.
|
|
* @kind metric
|
|
* @tags summary
|
|
*/
|
|
|
|
import javascript
|
|
|
|
select sum(File f | not f.getATopLevel().isExterns() | f.getNumberOfLinesOfCode())
|