0

I am trying to compare two directories with multiple subfolders. This is my CLOC script:

cloc-1.76.exe --diff test_initial test_latest --timeout 60 --exclude-dir=ZC_DATA --out=results.txt

Both folders have a ZC_DATA directory. In test_initial it is empty, in test_latest has several C and XML files, therefore lots of code to count.

What I am experiencing is that with or without the switch exclude-dir=ZC_DATA I am getting exactly the same results, no difference at all.

I need a way to include or exclude this folder in order to get different results. Please advise.

Regards, M.R.

2 Answers2

0

If you do a straight count of one of the input directories, for example,

cloc-1.76.exe --timeout 60 --exclude-dir=ZC_DATA --out=results.txt test_latest

with and without --exclude-dir=ZC_DATA do the counts change? Repeat the two invocations with the second directory, test_initial, and report if there are differences there as well.

AlDanial
  • 419
  • 2
  • 4
  • Thanks AlDanial, mystery solved: I needed to increase timeout in order to get the exclude switch to work correctly. By the way, can you include in the output file a message like "Warning: timeout occurred during count" ? So that one can know straight away there was a problem and the count is inaccurate? –  Feb 20 '18 at 16:01
  • Also: can you implement something like --diff-timeout 0? Setting a zero timeout to tell the program to use an indeterminate amount of time in order to get the calculations right. –  Feb 20 '18 at 16:11
  • I implemented your suggestion with commit https://github.com/AlDanial/cloc/commit/fc96eb49d96323bc87fdb3ee62bc71c91dffe15b – AlDanial Feb 23 '18 at 05:33
-1

I'm trying to execute a cloc command with --diff AND --exclude-list-file and the files including in .clocignore are not ignored in the result.

Here the cmd:

os.system{'cloc --diff {} {} --exclude-list-file=.clocignore --by-file --out={} --csv'.format (directory1, directory2, output.loc)}

.clocignore file content:

/tmp/workspace/directory2/myfile.cpp

NOTE: this particular file (myfile.cpp) appears in directory2 but it does not exist in directory1.

If diff directory1 - directory2 is not successfully because some files in directory1 do not exist, the result are: the lines counted in directory2, which it is fine!

BUT, it does not exclude the files contained in ..clocignore

why the --exclude-list-file=.clocignore is not working in this scenario? Thanks,