mirror of
https://github.com/github/codeql.git
synced 2026-04-29 18:55:14 +02:00
JS: Count lines of code correctly
This commit is contained in:
@@ -511,7 +511,7 @@ public class FileExtractor {
|
||||
new TextualExtractor(
|
||||
trapwriter, locationManager, source, config.getExtractLines(), metrics, extractedFile);
|
||||
LoCInfo loc = extractor.extract(textualExtractor);
|
||||
int numLines = textualExtractor.getNumLines();
|
||||
int numLines = textualExtractor.isSnippet() ? 0 : textualExtractor.getNumLines();
|
||||
int linesOfCode = loc.getLinesOfCode(), linesOfComments = loc.getLinesOfComments();
|
||||
trapwriter.addTuple("numlines", fileLabel, numLines, linesOfCode, linesOfComments);
|
||||
trapwriter.addTuple("filetype", fileLabel, fileType.toString());
|
||||
|
||||
@@ -52,6 +52,13 @@ public class TextualExtractor {
|
||||
return extractedFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the extracted file and the source location files are different.
|
||||
*/
|
||||
public boolean isSnippet() {
|
||||
return !extractedFile.equals(locationManager.getSourceFile());
|
||||
}
|
||||
|
||||
public TrapWriter getTrapwriter() {
|
||||
return trapwriter;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user