gocloc
gocloc copied to clipboard
Some file types showing all lines as comments
Steps to reproduce:
go install github.com/hhatto/gocloc/cmd/gocloc git clone https://github.com/hhatto/gocloc.git cd gocloc gocloc Makefile
produces:
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
Makefile 1 4 11 0
-------------------------------------------------------------------------------
TOTAL 1 4 11 0
-------------------------------------------------------------------------------
Relative to 'cloc':
1 text file.
1 unique file.
0 files ignored.
github.com/AlDanial/cloc v 1.82 T=0.02 s (61.8 files/s, 927.2 lines/s)
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
make 1 4 0 11
-------------------------------------------------------------------------------
Suspected cause:
Many of the Languages have the multiline quote definition of [][]string{{"", ""}} for language.multiLines
But the test for marking as code is:
if len(language.multiLines) == 0 {
onCode(clocFile, opts, len(inComments) > 0, line, lineOrg)
continue scannerloop
}
I've noticed this for Makefiles and bash scripts, so I think it's rather pervasive. I did notice some code to try to deal with Makefiles, not sure if that's part of this though. I think it's that the Language definition should be empty for these types of files that don't support multiline comments or the logic for detecting should deal with empty strings as if it were empty.