Skip to content

Commit 15289db

Browse files
committed
simplify File.getNumberOfLines
1 parent cc5bbfc commit 15289db

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

ql/src/codeql/files/FileSystem.qll

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,7 @@ class File extends Container, @file {
183183
}
184184

185185
/** Gets the number of lines in this file. */
186-
int getNumberOfLines() {
187-
if exists(this.getAToken())
188-
then result = max(this.getAToken().getLocation().getEndLine())
189-
else result = 0
190-
}
186+
int getNumberOfLines() { result = max([0, this.getAToken().getLocation().getEndLine()]) }
191187

192188
/** Gets the number of lines of code in this file. */
193189
int getNumberOfLinesOfCode() { result = count(int line | this.line(line, false)) }

0 commit comments

Comments
 (0)