cgag / loc

Count lines of code quickly.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

wbthomason opened this issue · comments

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?

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

commented

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