scc icon indicating copy to clipboard operation
scc copied to clipboard

scc includes the .ignore file as part of the project counting

Open csrabak opened this issue 2 years ago • 3 comments

Unexpected behaviour

In a directory where a .ignore file is present, scc includes it as part of the project stats.

My experience

  1. In a project with 54 source files and the .ignore one to exclude no project files.
  2. Using the command scc --no-gen --no-cocomo -x i ./project
  3. scc output is:
───────────────────────────────────────────────────────────────────────────────
Language                 Files     Lines   Blanks  Comments     Code Complexity
───────────────────────────────────────────────────────────────────────────────
C                           54      8444      518      2483     5443        602
C Header                     1         1        0         1        0          0
ignore                       1        10        0         0       10          0
───────────────────────────────────────────────────────────────────────────────
Total                       56      8455      518      2484     5453        602
───────────────────────────────────────────────────────────────────────────────

Expected behavior

Language                 Files     Lines   Blanks  Comments     Code Complexity
───────────────────────────────────────────────────────────────────────────────
C                           54      8444      518      2483     5443        602
C Header                     1         1        0         1        0          0
───────────────────────────────────────────────────────────────────────────────
Total                       55      8445      518      2484     5443        602
───────────────────────────────────────────────────────────────────────────────

Desktop (please complete the following information):

  • OS: Windows 10, Home Ed, single language
  • Version 3.2.0

csrabak avatar Dec 31 '23 01:12 csrabak

Its funny... I added this as a way to assist with counting them since it was not common at the time, along with gitignore and hgignore files...

Perhaps it would be best to exclude them by default allowing people to opt in... either that or respect a dot file in the home directory or some such to change the behavior.

boyter avatar Jan 28 '24 22:01 boyter

Perhaps we can agree in a more specific name .scc_ignore and as you wrote, by default don't include it, except if in some organization the file be considered part of the deliverables that have to maintained or such, and so it would make sense in this case to opt in.

csrabak avatar Jan 29 '24 03:01 csrabak

So I am going to implement support for a scc_ignore file soon, as some want specific behavior for counting itself. The reason for .ignore file support itself was due to wanting drop in compatibility with tools such as ripgrep and ag which support this file, and by extension visual studio code.

boyter avatar Jan 29 '24 05:01 boyter

Done. This is now the default. If you want to count ignore files you must set the flag

--count-ignore                 set to allow .gitignore and .ignore files to be counted

so

scc --count-ignore

for ignore files to be counted.

boyter avatar Apr 30 '24 07:04 boyter