diff --git a/src/main/java/com/cflint/CFLint.java b/src/main/java/com/cflint/CFLint.java index 5e114b537..51e7fb5d7 100644 --- a/src/main/java/com/cflint/CFLint.java +++ b/src/main/java/com/cflint/CFLint.java @@ -206,7 +206,8 @@ public void scan(final File folderOrFile) { final String src = FileUtil.loadFile(folderOrFile); includeFileStack.clear(); try { - stats.addFile(src.length()); + //Report number of lines in the source + stats.addFile(src==null||src.length()==0?0:src.split("\\R").length + 1); process(src, folderOrFile.getAbsolutePath()); } catch (final Exception e) { printException(e); diff --git a/src/main/java/com/cflint/CFLintStats.java b/src/main/java/com/cflint/CFLintStats.java index f1ec8dc10..d917fdb44 100644 --- a/src/main/java/com/cflint/CFLintStats.java +++ b/src/main/java/com/cflint/CFLintStats.java @@ -5,17 +5,19 @@ public class CFLintStats { long fileCount; + //Number of lines BigInteger totalSize = BigInteger.ZERO; - public void addFile(long fileSize){ + public void addFile(long numberOfLines){ fileCount++; - totalSize = totalSize.add(BigInteger.valueOf(fileSize)); + totalSize = totalSize.add(BigInteger.valueOf(numberOfLines)); } public long getFileCount() { return fileCount; } + //Number of lines public BigInteger getTotalSize() { return totalSize; }