scc icon indicating copy to clipboard operation
scc copied to clipboard

scc handle .gitignore are unexpected

Open chenyanchen opened this issue 2 years ago • 1 comments

Describe the bug scc handle .gitignore are not same as git.

To Reproduce

  1. Different result between cloc and scc

    ad-track on  master via 🐹 v1.21.1
    ❯ cloc --vcs=git --include-ext=go
         186 text files.
         181 unique files.
          22 files ignored.
    
    github.com/AlDanial/cloc v 1.98  T=0.17 s (974.2 files/s, 83685.8 lines/s)
    -------------------------------------------------------------------------------
    Language                     files          blank        comment           code
    -------------------------------------------------------------------------------
    Go                             164           1696           1406          10986
    -------------------------------------------------------------------------------
    SUM:                           164           1696           1406          10986
    -------------------------------------------------------------------------------
    
    ad-track on  master via 🐹 v1.21.1
    ❯ scc -i go
    ───────────────────────────────────────────────────────────────────────────────
    Language                 Files     Lines   Blanks  Comments     Code Complexity
    ───────────────────────────────────────────────────────────────────────────────
    Go                         145     10607     1313      1139     8155       1046
    ───────────────────────────────────────────────────────────────────────────────
    Total                      145     10607     1313      1139     8155       1046
    ───────────────────────────────────────────────────────────────────────────────
    Estimated Cost to Develop (organic) $244,675
    Estimated Schedule Effort (organic) 8.06 months
    Estimated People Required (organic) 2.70
    ───────────────────────────────────────────────────────────────────────────────
    Processed 318377 bytes, 0.318 megabytes (SI)
    ───────────────────────────────────────────────────────────────────────────────
    
  2. But the sum of each sub directory is equal to cloc. 131 + 94 + 10761 = 10986

    ad-track on  master via 🐹 v1.21.1
    ❯ for d in $(ls) ; do (scc $d -i go -c | grep Go); done
    Go                               2         171         32           8       131
    Go                               2         129         21          14        94
    Go                             160       13790       1634        1395     10761
    
  3. There is log/* in .gitignore, when I remove log/*, scc result are same as cloc.

  4. In sure, there are some sub directory named log in the project, but not in root.

    ad-track on  master via 🐹 v1.21.1
    ❯ tree -d -f | grep log
        │   │   └── ./pkg/handle/public/log
        │   │   ├── ./pkg/handle/zplus/log
    
  5. git only exclude the ./log/* if log/* be add to .gitignore, but scc exlude all */log/*.

Expected behavior scc shoulde have same behavior as git. In other words, scc should only exclude the ./log/* if log/* be add to .gitignore.

Desktop (please complete the following information):

  • OS: macOS
  • Version: 13.5.2 (22G91)

chenyanchen avatar Sep 12 '23 06:09 chenyanchen

Yep aware. This is currently being worked on hence the creation of https://github.com/boyter/gocodewalker/

This is a good use case though, thanks for the excellent report.

I am pretty sure the above repo should walk correctly and respect things as expected.

boyter avatar Sep 13 '23 21:09 boyter

Should work now as expected with the latest release.

boyter avatar May 09 '24 06:05 boyter