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

Counting files with multiple extensions #531

Open
gms8994 opened this issue Oct 1, 2024 · 1 comment
Open

Counting files with multiple extensions #531

gms8994 opened this issue Oct 1, 2024 · 1 comment

Comments

@gms8994
Copy link

gms8994 commented Oct 1, 2024

Describe the bug
I'm trying to use --count-as to convert file.test.js to Javascript Tests, but maybe scc is only looking at the actual extension (.js) on the files when performing this conversion.

To Reproduce

> brew update && brew upgrade scc && scc --version
scc version 3.4.0

> touch blah.test.js && scc --format csv --count-as test.js:"Javascript Tests" blah.test.js
Language,Lines,Code,Comments,Blanks,Complexity,Bytes,Files,ULOC
JavaScript,0,0,0,0,0,0,1,0

This also performs the same when using the docker image

> docker run --rm -it -v "$PWD:/pwd" ghcr.io/lhoupert/scc:master scc --format csv --count-as "test.js":"Javascript Tests" /pwd/blah.test.js
Language,Lines,Code,Comments,Blanks,Complexity,Bytes
JavaScript,0,0,0,0,0,0

Expected behavior
The file and lines inside blah.test.js and any other files named like .test.js would be counted as Javascript Tests.

Desktop (please complete the following information):

  • OS: macos
  • Version 14.6.1
@boyter
Copy link
Owner

boyter commented Oct 1, 2024

The use of "multi" extensions is an odd one to deal with. Note that the count as you have there wouldn't work anyway because it tries to match based on the language and then the extension if possible. A custom mapping like this "Javascript Tests" would do nothing because nothing would match it

$ scc --languages | rg -i javascript
JavaScript (js,mjs)

However such a mapping could be useful and fits into the ideas I am working on in #462 where you can supply a custom language type which would resolve this.

It would require more work to deal with the .test.js example you have here however but it might be worth it. I am linking the two together to keep track of it.

@boyter boyter moved this to DONE in Scc Release 3.5.0 Oct 1, 2024
@boyter boyter moved this from DONE to DOING in Scc Release 3.5.0 Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: DOING
Development

No branches or pull requests

2 participants