Closed BrianL-STCU closed 1 year ago
Can you recommend a repo to clone that has such entries?
I've got a couple at brianary/webcoder or brianary/scripts, but there are a lot of others.
It looks like linguist-generated=true
can be just linguist-generated
now.
Take a shot at the update I just pushed, only test on Linux so far.
I added this .gitattributes file:
./cloc linguist-generated=true
./Unix/cloc linguist-vendored
The failure was caused by the spurious ./
in the path defined by the pattern. Once I expanded it to a canonical path I got the expected behavior.
However...
I took a closer look at the Text::Glob
module I vendored in for this issue and saw it is rudimentary and won't handle **
recursive matches and is also confused by quoted paths. I'll need to come up with my own way to deal with these meaning it will take a while.
ea192f1 is my next attempt at this, please give it a try
Unfortunately, I still don't see a difference when adding that .gitattributes.
Are you using --git --no-autogen
? Without these switches the first few lines of output I see are
github.com/AlDanial/cloc v 1.97 T=2.33 s (335.9 files/s, 169801.5 lines/s) ---------------------------------------------------------------------------------------- Language files blank comment code ---------------------------------------------------------------------------------------- Perl 36 23797 49078 265666 Text 47 2330 0 17361 YAML 370 12 372 9075 Markdown 4 305 40 2862
However with --git --no-autogen
the two Perl files are omitted:
github.com/AlDanial/cloc v 1.97 T=1.74 s (446.6 files/s, 208591.7 lines/s) ---------------------------------------------------------------------------------------- Language files blank comment code ---------------------------------------------------------------------------------------- Perl 34 21624 44084 241342 Text 47 2330 0 17361 YAML 370 12 372 9075 Markdown 4 305 40 2862
I did have the wrong options, but retrying on Windows with the right ones, both still start with:
github.com/AlDanial/cloc v 1.97 T=1.68 s (420.2 files/s, 41535.8 lines/s)
----------------------------------------------------------------------------------------
Language files blank comment code
----------------------------------------------------------------------------------------
Perl 8 2326 5113 26552
YAML 365 12 367 8830
Markdown 3 305 40 2860
TableGen 1 241 128 1124
Something seems way off for us to be getting such different results in either case.
Couple of things: I had a bunch of extra files in my dir that inflated my count. Also the glitch had to do with file path separators, I wasn't treating \ and / consistently in this code branch. The latest push should fix it. Here are my results on Windows, using extra filters to just narrow it down to the 8 or 10 Perl files:
C:>perl cloc --git --no-autogen --by-file --include-lang=Perl . 834 text files. 721 unique files. 839 files ignored. github.com/AlDanial/cloc v 1.97 T=2.00 s (5.0 files/s, 26986.6 lines/s) ----------------------------------------------------------------------------------- File blank comment code ----------------------------------------------------------------------------------- .\cloc-1.96.pl 1485 3656 12103 .\cloc-1.92.pl 1481 3628 11998 .\cloc.ok 1484 3635 11950 .\Unix\t\00_C.t 3 3 1282 .\Unix\t\01_opts.t 86 28 697 .\Unix\t\02_git.t 15 1 134 .\tests\inputs\issues\380\wrapper.pl 44 72 71 .\sqlite_formatter 5 15 42 .\tests\inputs\issues\420\mixed_case_ext.Pl 5 1 14 .\tests\inputs\diff\B\extra_file.pl 0 0 2 ----------------------------------------------------------------------------------- SUM: 4608 11039 38293 -----------------------------------------------------------------------------------
If I don't include --no-autogen
it won't apply the rules in .gitattributes
and I'll see two extra Perl files:
C:>perl cloc --git --by-file --include-lang=Perl . 834 text files. 721 unique files. 837 files ignored. github.com/AlDanial/cloc v 1.97 T=2.02 s (5.9 files/s, 42343.3 lines/s) ----------------------------------------------------------------------------------- File blank comment code ----------------------------------------------------------------------------------- .\cloc 1488 3666 12290 .\cloc-1.96.pl 1485 3656 12103 .\Unix\cloc 685 1328 12041 .\cloc-1.92.pl 1481 3628 11998 .\cloc.ok 1484 3635 11950 .\Unix\t\00_C.t 3 3 1282 .\Unix\t\01_opts.t 86 28 697 .\Unix\t\02_git.t 15 1 134 .\tests\inputs\issues\380\wrapper.pl 44 72 71 .\sqlite_formatter 5 15 42 .\tests\inputs\issues\420\mixed_case_ext.Pl 5 1 14 .\tests\inputs\diff\B\extra_file.pl 0 0 2 ----------------------------------------------------------------------------------- SUM: 6781 16033 62624 -----------------------------------------------------------------------------------
Your file lists may be smaller but if you do the two runs one should produce two fewer files than the other.
I think that has done it! :)
Glad to hear it, thanks for your patience with testing.
GitHub supports specifying vendor-created code and generated code in a repository using Lingust extensions in the .gitattributes file, which it uses to optimally fold files in diff views. It would be nice if these were excluded with the
--no-autogen
option, since this is already being maintained in repos.Example