cgag / loc

Count lines of code quickly.
MIT License
2.29k stars 126 forks source link

`loc` returns a count of 0 for files without an extension #68

Closed wbthomason closed 5 years ago

wbthomason commented 6 years ago

This may be by design, but:

Write the following to a file named e.g. foo.py:

#!/bin/python

hello = "Count me!"

Run loc foo.py. You'll get the expected result, 1 line of Python. Now run mv foo.py foo and run loc foo. The result shows 0 lines of anything.

This may be out of scope for loc (detecting filetypes without an extension can be hard), but it does mess up counts for codebases with scripts named without extensions, e.g. run_task, etc.

What would be required for loc to return counts for files without extensions?

dicktyr commented 6 years ago

indeed, this certainly limits loc's utility so please at least include an option to read shebang files

cgag commented 5 years ago

i added some basic shebang checking, it's not much but it should cover the case in this issue