Forked from ccabanero/Count lines of code in Xcode project
          
        
    
          Last active
          June 30, 2024 21:09 
        
      - 
            
      
        
      
    Star
      
          
          (119)
      
  
You must be signed in to star a gist  - 
              
      
        
      
    Fork
      
          
          (11)
      
  
You must be signed in to fork a gist  
- 
      
 - 
        
Save Tokuriku/f7d6ce5a68d2154c28b0 to your computer and use it in GitHub Desktop.  
    Count lines of code in SWIFT Xcode project
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 1. Open Terminal | |
| 2. cd to your Xcode project | |
| 3. Execute the following when inside your target project: | |
| find . -name "*.swift" -print0 | xargs -0 wc -l | 
You'd just add your test directories into the list of exclude-dirs. Here is an example to actually only count Swift code and Pods and Tests are excluded:
cloc . --exclude-dir=.\*Tests,Pods,Carthage,Frameworks,generated,.idea,output,DerivedData,Fastlane,.\*.xcodeproj,.\*.xcworkspace --include-ext=swift
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
How would you exclude test files?