mirror of
https://github.com/github/codeql.git
synced 2026-02-19 16:33:40 +01:00
rb/summary/lines-of-user-code
This commit is contained in:
@@ -190,4 +190,7 @@ class File extends Container, @file {
|
||||
|
||||
/** Gets the number of lines of comments in this file. */
|
||||
int getNumberOfLinesOfComments() { result = count(int line | this.line(line, true)) }
|
||||
|
||||
/** Holds if this file was extracted from ordinary source code. */
|
||||
predicate fromSource() { files(this, _, _, _, 1) }
|
||||
}
|
||||
|
||||
17
ql/src/queries/summary/LinesOfUserCode.ql
Normal file
17
ql/src/queries/summary/LinesOfUserCode.ql
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* @id rb/summary/lines-of-user-code
|
||||
* @name Lines of authored Ruby code in the database
|
||||
* @description The total number of lines of Ruby code across files, excluding library and generated code.
|
||||
* @kind metric
|
||||
* @tags summary
|
||||
*/
|
||||
|
||||
import ruby
|
||||
|
||||
select sum(File f |
|
||||
f.fromSource() and
|
||||
exists(f.getRelativePath()) and
|
||||
not f.getAbsolutePath().matches("%/vendor/%")
|
||||
|
|
||||
f.getNumberOfLinesOfCode()
|
||||
)
|
||||
Reference in New Issue
Block a user