From 7ff2ca4ffe083d31916d95cf9f84ce68bffe2701 Mon Sep 17 00:00:00 2001 From: Alex Ford Date: Fri, 14 May 2021 15:56:59 +0100 Subject: [PATCH 1/3] improve rb/summary/lines-of-user-code name and description --- ql/src/queries/summary/LinesOfUserCode.ql | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ql/src/queries/summary/LinesOfUserCode.ql b/ql/src/queries/summary/LinesOfUserCode.ql index c7dbb7ee5ba..7f12e3e5a5b 100644 --- a/ql/src/queries/summary/LinesOfUserCode.ql +++ b/ql/src/queries/summary/LinesOfUserCode.ql @@ -1,7 +1,9 @@ /** * @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. + * @name Total Lines of user written Ruby code in the database + * @description The total number of lines of Ruby code from the source code + * directory, excluding external library and auto-generated files. This + * query counts the lines of code, excluding whitespace or comments. * @kind metric * @tags summary */ From 71234155b897d738b736a8870a7d153228b718a0 Mon Sep 17 00:00:00 2001 From: Alex Ford Date: Fri, 14 May 2021 15:59:07 +0100 Subject: [PATCH 2/3] improve rb/summary/lines-of-code description --- ql/src/queries/summary/LinesOfCode.ql | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ql/src/queries/summary/LinesOfCode.ql b/ql/src/queries/summary/LinesOfCode.ql index 958a931a16d..1f2570d06d1 100644 --- a/ql/src/queries/summary/LinesOfCode.ql +++ b/ql/src/queries/summary/LinesOfCode.ql @@ -1,9 +1,10 @@ /** * @id rb/summary/lines-of-code * @name Total lines of Ruby code in the database - * @description The total number of lines of Ruby code across all files, - * including vendored code, tests. This query counts the lines of code, - * excluding whitespace or comments. + * @description The total number of lines of Ruby code from the source code + * directory, including external libraries and auto-generated files. This is a + * useful metric of the size of a database. This query counts the lines of + * code, excluding whitespace or comments. * @kind metric * @tags summary */ From 65b0ce204d2c3c7f73972cf7920c9833a2399906 Mon Sep 17 00:00:00 2001 From: Alex Ford Date: Fri, 14 May 2021 15:59:48 +0100 Subject: [PATCH 3/3] restrict rb/summary/lines-of-code to the source root --- ql/src/queries/summary/LinesOfCode.ql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ql/src/queries/summary/LinesOfCode.ql b/ql/src/queries/summary/LinesOfCode.ql index 1f2570d06d1..2b2980d8e17 100644 --- a/ql/src/queries/summary/LinesOfCode.ql +++ b/ql/src/queries/summary/LinesOfCode.ql @@ -11,4 +11,4 @@ import ruby -select sum(File f | | f.getNumberOfLinesOfCode()) +select sum(File f | exists(f.getRelativePath()) | f.getNumberOfLinesOfCode())