Skip to content

Commit 260ae47

Browse files
authored
Merge pull request github#6031 from asgerf/js/lines-of-user-code
Approved by erik-krogh
2 parents 378a357 + 4cf3c11 commit 260ae47

File tree

5 files changed

+25
-1
lines changed

5 files changed

+25
-1
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/**
2+
* @name Total lines of user written JavaScript and TypeScript code in the database
3+
* @description The total number of lines of JavaScript and TypeScript code from the source code directory,
4+
* excluding auto-generated files and files in `node_modules`. This query counts the lines of code, excluding
5+
* whitespace or comments.
6+
* @kind metric
7+
* @tags summary
8+
* lines-of-code
9+
* @id js/summary/lines-of-user-code
10+
*/
11+
12+
import javascript
13+
import semmle.javascript.GeneratedCode
14+
15+
select sum(File f |
16+
not f.getATopLevel().isExterns() and
17+
exists(f.getRelativePath()) and
18+
not isGeneratedCode(f)
19+
|
20+
f.getNumberOfLinesOfCode()
21+
)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
| 12 |
1+
| 13 |
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
| 12 |
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Summary/LinesOfUserCode.ql

javascript/ql/test/query-tests/Summary/src/foo.min.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)