Is there a way to determine how many lines of code an Xcode project contains? I promise not to use such information for managerial measurement or employee benchmarking purp
Steps to implement CLOC library in Mac as below:
Open terminal
Install Homebrew using command as below,
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Copy & paste this command, including double quotes in terminal
Enter system password & click enter.
You will see the terminal screen as below,
System will popup so many permissions, please allow all the permissions
If everything goes fine, you will see terminal screen as below,
Redirect to project folder using cd drag & drop project folder path to terminal
Now its time to install CLOC using below command
cloc . --exclude-dir=Pods used to exclude pod files
cloc . including pod files
If everything goes fine, it will display the number of lines of code as below,
Hope it will help someone.
Sorry for repeating. That's the easiest way IMHO:
find /users/<#username#>/documents/folderWithProject/ -type f -exec cp {} /users/<#username#>/documents/folderWithProject/newFolder/ \;
This will copy all files from project folder to newFolder
.
newFolder
I see this floating around and use it myself:
find . "(" -name "*.m" -or -name "*.mm" -or -name "*.cpp" -or -name "*.swift" ")" -print0 | xargs -0 wc -l
In terminal, change into the project directory and run:
find . -type f -print0 | xargs -0 cat | wc -l
If you want only certain file types, try something like
find . -type f -name \*.[ch]* -print0 | xargs -0 cat | wc -l
Check out Xcode Statistician, it does exactly what you want. It also provides other interesting statistics so is worth a run for fun now and then.
Note that it will not look inside real folders, though it will look in groups. Odds are you aren't using real folders so it'll work great. If you are using folders then you just have to do the count in each folder and add them together.
Note: As of June, 2012, it seems this does not work properly with the latest versions of Xcode.
Nozzi's version doesn't work for me, but this one:
find . -type f -print0 | xargs -0 cat | wc -l