Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

loc considers files with full name as extension as part of a given language #115

Closed
justanotherdot opened this issue Apr 16, 2019 · 3 comments

Comments

@justanotherdot
Copy link

Hi, thanks for the great tool!

Looks like loc won't check for a leading . when inferring a language; is this on purpose? e.g.

$ cd /tmp
$ mkdir loc_test
$ cd loc_test
$ echo "ahhhhhhh" >  rs
$ touch go
$ loc
--------------------------------------------------------------------------------
 Language             Files        Lines        Blank      Comment         Code
--------------------------------------------------------------------------------
 Rust                     1            1            0            0            1
 Go                       1            0            0            0            0
--------------------------------------------------------------------------------
 Total                    2            1            0            0            1
--------------------------------------------------------------------------------

In my own experience this confuses loc when you have scripts that share the name of suffixes.

@justanotherdot justanotherdot changed the title Considers files with full name as extension as part of language loc considers files with full name as extension as part of a given language Apr 16, 2019
@justanotherdot
Copy link
Author

I had a poke around and it seems like we could simply return Unrecognized instead of setting ext to the full filename, which will work for the cases I mentioned above. Would this be an acceptable change?

@cgag
Copy link
Owner

cgag commented May 14, 2019

I'd have to look at it again but I believe that was a hack to make it work for files we want to count that don't have extensions, which might just be makefiles.

@justanotherdot
Copy link
Author

I just raised #116 which seems to work for me. It would seem the lines above take care of cmake, makefiles, etc. unless there are other file formats that still need this suffix-as-file-type approach that I'm not considering?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants