Questions tagged [cloc]

cloc (Count Lines of Code) counts lines of code, blank lines, and comment lines in source code in many different programming languages.

cloc (Count Lines of Code) is an open source Perl program that counts lines of code, blank lines, and comment lines in source code in many different programming languages. It can also determine differences in lines of code, blank lines, and comment lines between two files or even between two directory trees.

cloc runs on a variety of operating systems, including Linux, FreeBSD, Windows and OSX.

Documentation: https://github.com/AlDanial/cloc

Cloc is available for installation through homebrew on macs: brew install cloc

50 questions
0
votes
0 answers

Is there a way to differentiate "comments" when making a git diff?

I would like to know if a refactor went fine diffing the code, but most commits remove duplicated code but also adds documentation, so the diff stats are not that useful. Is there a way to make diff stats differentiate comments?
eloyesp
  • 3,135
  • 1
  • 32
  • 47
0
votes
1 answer

Running .exe file in Git Bash

I want Git bash to execute a .exe file just by writing git filename.exe. Indeed, I've got the cloc.exe file (which counts code lines) and I want to run it from Git Bash instead of from Windows CMD.
iviivi
  • 33
  • 1
  • 7
0
votes
1 answer

Why is cloc just one big file?

I was just browsing through cloc's GitHub page when I noticed that the whole script consists of just one file with a whopping ~15000 lines of code. Do they patch multiple source files together or just use a really good ide? Having just one big…
0
votes
1 answer

CLOC for difference between two versions of source code by include only "c/c++","h" extensions an exclude other file extension

When Cloc --diff command is executed, it lists differences between all the extensions. Source code consists c,h,xml,yaml files. Can we get the diff for only specific extensions like ".c",".cpp",".h"? Provides difference for all extension types
0
votes
0 answers

How can I get the project size of a jar file?

for a current project I try to characterize packages (.whl, .jar, ...) by project size. For packages like .whl files this is quite easy, I just run cloc against the unpacked archive. Doing the same for .jar files is not that easy since there isn't…
pinas
  • 2,708
  • 4
  • 21
  • 33
0
votes
1 answer

sum of the cloc blank, comment , code in csv output

by typing cloc --vcs git i can get following output, 12 text files. 12 unique files. 3 files ignored. github.com/AlDanial/cloc v 1.78 T=0.06 s (140.8 files/s, 10839.6…
Sadzone
  • 73
  • 2
  • 13
0
votes
1 answer

Is it possible to get --exclude-ext work only for some specific directories?

I need to exclude *.c files only from some specific directory/sub_directory. Is this possible?
user5326167
0
votes
2 answers

CLOC --diff and --exclude-dir don't seem to work together

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…
user5326167
0
votes
1 answer

how do I output the difference in source files with cloc?

I am counting lines with cloc using this command: cloc --ignore-case --ignore-whitespace --diff src-copy/file.c src/file.c and it tells me that I added 103 lines. When I count the same file with 'git diff' it tells me that I have added 136…
Nulik
  • 6,748
  • 10
  • 60
  • 129
0
votes
0 answers

How to write only unique values into CSV file?

I'm developing a CLOC program, that traverse into other program's source code and takes the values from them!, where its saving some values into CSV file using: out.write the problem is that as much as I run the program as much as the values will…
user5923402
  • 217
  • 3
  • 12
0
votes
1 answer

How to get the total line alone using cloc?

I am running following command: "C:\Software\cloc 1.62\cloc-1.62.exe" "ProjectPath" --xml --exclude-dir=packages,bin,obj >> CodeCounttest.xml It shows result like below: 100 files 135 text files. classified 135 files Duplicate file check 135…
Samselvaprabu
  • 16,830
  • 32
  • 144
  • 230
0
votes
1 answer

Use cloc on 2 different commits. Only see actual lines of code, no Comments or blank rows

I already know how to get the difference between 2 commits, also get them file by file. I also know (thanks to this thread Count number of lines in a git repository ) That you can use Cloc to only get the actual lines of code instead of all…
anders
  • 1,535
  • 5
  • 19
  • 43
0
votes
1 answer

trouble passing parameters to console application

I have trouble with correctly launching cloc 1.62 from windows command line using qprocess. Here is what i have: A QStringList with all the languages cloc recognizes; QStringList…
0
votes
2 answers

How to count lines of code and compare the LOC difference in one command?

I'm using cloc 1.60 . I'm wondering if that's possible to run the following two commands in one "cloc" command? > cloc-1.60.exe --diff file1 file2 # returns the difference > cloc-1.60.exe file2 I have to calculate the % of changed lines. I can…
Tamir Gefen
  • 1,128
  • 2
  • 18
  • 35
0
votes
2 answers

How can I make a batch file to run the same cloc command with one click?

To run the command: cloc-1.08.exe wizardry Obviously I don't want to go into DOS every time I want to do a line count.
Iain
  • 9,432
  • 11
  • 47
  • 64