boyter / scc

Sloc, Cloc and Code: scc is a very fast accurate code counter with complexity calculations and COCOMO estimates written in pure Go
MIT License
6.79k stars 267 forks source link

failing to use `.sccignore` #550

Closed janpfeifer closed 3 weeks ago

janpfeifer commented 3 weeks ago

Describe the bug Follow up of #549 , but the issue now is that .sccignore is not processed.

Example: my project has all the .proto and generated code in a sub-directory internal/protos:

$ cat .sccignore
internal/protos
$ scc
───────────────────────────────────────────────────────────────────────────────
Language                 Files     Lines   Blanks  Comments     Code Complexity
───────────────────────────────────────────────────────────────────────────────
Go                          15      5339      553       827     3959        632
Protocol Buffers             3      1186      190       691      305          0
Jupyter                      2       512        0         0      512          0
Markdown                     2        20        7         0       13          0
License                      1       201       32         0      169          0
gitignore                    1        29        7        11       11          0
───────────────────────────────────────────────────────────────────────────────
Total                       24      7287      789      1529     4969        632
───────────────────────────────────────────────────────────────────────────────
Estimated Cost to Develop (organic) $145,437
Estimated Schedule Effort (organic) 6.610459 months
Estimated People Required (organic) 1.954619
───────────────────────────────────────────────────────────────────────────────
Processed 288291 bytes, 0.288 megabytes (SI)
───────────────────────────────────────────────────────────────────────────────

$ scc --by-file | grep internal/protos
~internal/protos/onnx-ml.pb.go      3208      345       522     2341        316
internal/protos/protos.go              4        1         2        1          0
~internal/protos/onnx-ml.proto       895      132       524      239          0
internal/protos/README.md             11        4         0        7          0

Expected behavior The same it does with .ignore which is currently working:

$ mv .sccignore .ignore
$ cat .ignore 
internal/protos

$ scc
───────────────────────────────────────────────────────────────────────────────
Language                 Files     Lines   Blanks  Comments     Code Complexity
───────────────────────────────────────────────────────────────────────────────
Go                          11      1139      100       139      900        228
Jupyter                      2       512        0         0      512          0
License                      1       201       32         0      169          0
Markdown                     1         9        3         0        6          0
gitignore                    1        29        7        11       11          0
ignore                       1         1        0         0        1          0
───────────────────────────────────────────────────────────────────────────────
Total                       17      1891      142       150     1599        228
───────────────────────────────────────────────────────────────────────────────
Estimated Cost to Develop (organic) $44,221
Estimated Schedule Effort (organic) 4.204901 months
Estimated People Required (organic) 0.934321
───────────────────────────────────────────────────────────────────────────────
Processed 68864 bytes, 0.069 megabytes (SI)
───────────────────────────────────────────────────────────────────────────────

$ scc --by-file | grep internal/protos
# no output

Desktop (please complete the following information):

apocelipes commented 3 weeks ago

You should install scc with: go install github.com/boyter/scc/v3@master, not the go install github.com/boyter/scc@master. image

github.com/boyter/scc@master gives you an ancient version of scc: image

I tested the correct version of scc and the '.sccignore' works well to me.

I think the README should be updated, since we now only support Go1.22+.

janpfeifer commented 3 weeks ago

Thank you @apocelipes

Yes, indeed the README was telling me to use the version I used:

image

Maybe worth a fix to the README ?

apocelipes commented 3 weeks ago

My pleasure, I'm glad it helped.

Maybe worth a fix to the README ?

I've sent a PR to update this, you can take a look at #551.

boyter commented 3 weeks ago

Sorry about the issue you encountered @janpfeifer but thanks to @apocelipes this should hopefully be resolved.