Skip to content

Commit

Permalink
#303 fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
ryaneberly committed Jun 25, 2017
1 parent 662a297 commit 49ad30f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/main/java/com/cflint/CFLint.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/com/cflint/CFLintStats.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 49ad30f

Please sign in to comment.