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
1
vote
1 answer

Counting number of lines in test classes

I'm developing a tool that recognizes test classes and counts the number of lines in those classes. The tool will also count the lines of the business code and compare the both results, here is my code: for (File f : list) { if…
user5923402
  • 217
  • 3
  • 12
1
vote
6 answers

Counting number of comments in java

I'm developing a tool to analyse and give some statistics about other people's source code, the tool will be able to recognize many things in the code! Right now am stuck at counting the number of comments on the code, my current code is: public…
user5923402
  • 217
  • 3
  • 12
1
vote
0 answers

Count Lines of Code in Xcode Targets

I thought this question would have been asked a million times, but to my surprise I found no answer. I have an Xcode project that has 3 targets. I use Perl's cloc to count the lines of code for the whole .xcodeproj. I want to count the lines in the…
Henry F
  • 4,960
  • 11
  • 55
  • 98
1
vote
0 answers

CLOC- count lines of code, exclude everything in a dir except for certain files

I am using cloc to count our code. We need to exclude everything in a directory, except for files with a specific form like *instru.c. Is it possible to use the exclude and include files to do this?
user442920
  • 857
  • 4
  • 21
  • 49
1
vote
1 answer

--diff doesn’t appear to compute deltas properly when comparing directories

We are using cloc.pl for analysis purpose. And cloc was proved very useful so far when we were just counting lines of code. But now we are trying to get diff between two branches. Using the documentation mentioned in the link above, I am trying to…
Sagar
  • 173
  • 5
  • 8
0
votes
4 answers

Identify LOC for each file in iOS project - ObjectiveC based application development

Is there tool that will give me a detailed report on number lines each file/class in project has? I tried CLOC. All that I get is that the project level and that is nice to start with. I want a detailed drill down on each class. Do we have any open…
Krishnan Sriram
  • 5,037
  • 5
  • 21
  • 31
0
votes
1 answer

.blade.php being counted as blade instead of php files

I just noticed the strange behavior from cloc as per below $ll total 112 -rw-r--r-- 1 chaoshi staff 6271 Jul 4 15:14 admin.blade.php -rw-r--r-- 1 chaoshi staff 6821 Jul 4 15:14 email.blade.php -rw-r--r-- 1 chaoshi staff 14762 Jul 4…
sqr
  • 365
  • 2
  • 12
  • 29
0
votes
0 answers

Unable to write a file when running the cloc command via Docker

I am trying to run a command, in particular the cloc tool, via docker like this docker run --rm -v $PWD:/tmp aldanial/cloc . --vcs=git Everything works fine and I see the results on the screen. Now I want to write the results on a file and…
Picci
  • 16,775
  • 13
  • 70
  • 113
0
votes
0 answers

Cloc check files that include text

Cloc has a way to exclude files that contain text using --exclude-content=. I’m looking for a way to do the opposite. How can I check files that only include certain phrases? I've tried cloc . --exclude-content='/^((?!import).)*$/s' but it…
Richard Witherspoon
  • 4,082
  • 3
  • 17
  • 33
0
votes
1 answer

How to get a list of files ignored or skipped by cloc

If the beginning of my cloc --vcs git output is something like the following: 1826 text files. 1780 unique files. 384 files ignored. Question 1: Is there a way to get a list of all the files…
Akaisteph7
  • 5,034
  • 2
  • 20
  • 43
0
votes
0 answers

tar: Cannot connect to C: resolve failed fatal: Not a valid object name C in gitbash

i need to run below command in gitbash $ loc_count="$(cloc-1.92.exe --git --diff ${start_commit} ${end_commit})" but i am getting this error tar: Cannot connect to C: resolve failed fatal: Not a valid object name C how resolve this?
0
votes
1 answer

Get cloc (count lines of code ) difference between 2 commits by date Git

i tried the below command in git to get cloc difference between two commits using commit ids and i got the result in beautiful table. cloc --git --diff But i need a CLOC difference between commits but instead of using…
0
votes
0 answers

Run CLI tool on a github repo without cloning

This is probably a very silly question but I'm going to ask it anyway. I am writing a Node app which gives a user a bunch of stats about their repos. I wanted to use codetabs but I would prefer to not have a limit. Usually you would just clone the…
ariv797
  • 43
  • 7
0
votes
1 answer

Can I get git stat to show me proper-lines-of-code?

The git stat subcommand (or git log --stat etc.) shows us the numbers of lines added and removed. This is obviously useful, but - sometimes you don't care about whitespace and comment additions and removals. Is it possible to get git to compute its…
einpoklum
  • 118,144
  • 57
  • 340
  • 684
0
votes
2 answers

Is there a tool that shows a distribution of lines of code per file of a folder?

I want to know how big files are within my repository in terms of lines of code, to see the 'health' of a repository. In order to answer this, I would like to see a distribution (visualised or not) of the number of files for a specific range (can be…
Jonathan N
  • 41
  • 6