scc icon indicating copy to clipboard operation
scc copied to clipboard

Differentiate normal source files from test files

Open serkonda7 opened this issue 5 years ago • 3 comments

In my eyes it would be a nice metric to see how many lines my program code has and how big my testing suite is.

In some languages this might be already possible when all test files are located in a tests folder but I mainly use V, where tests and source files are next to each other.

I would expect something like

───────────────────────────────────────────────────────────────────────────────
Language                 Files     Lines   Blanks  Comments     Code Complexity
───────────────────────────────────────────────────────────────────────────────
V                           15      1550      115        65     1370        189
V Test                       2       157       45         0      112          0

Maybe another flag could be added for this.

V has extension .v V tests end with _test.v

serkonda7 avatar Dec 29 '20 15:12 serkonda7

This is something I had considered... however it falls down where some languages have the tests inline such as rust.

I was looking though the V test code and annoyingly there isn't any import or such I can see that would allow you to do this sort of remap either using --remap-all which in theory would all you to do this.

I think the ability to remap via filename regex or some such might be worthwhile though... I just need to think about the implementation some more.

boyter avatar Dec 30 '20 04:12 boyter

I have a similar problem. My test files are Typescript with extension .test.ts and are counted as Typescript files. I run 3.1.0 on Windows. I don't have found a command line option to remap file extensions to a Typescript (test) language that is equal to Typescript but counted separately. Anyway, just a nice-to-have. Thanks for this useful tool! mario

crystalfp avatar Jan 22 '23 08:01 crystalfp

I think this is possible for some languages, but inline would be problematic, due to inline tests. However that might also be possible...

Its something I am considering adding in, although it might need language specific code to achieve and not the generic one that is currently implemented.

boyter avatar Jan 24 '23 03:01 boyter