How to find out how many lines of code there are in an Xcode project?

前端 未结 15 1639
闹比i
闹比i 2020-11-30 16:32

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

15条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-30 16:39

    line-counter is a good alternative. It's lighter than CLOC and much more powerful and easier to use than other commands.

    A quick overview

    This is how you get the tool

    $ pip install line-counter
    

    Use line command to get the file count and line count under current directory (recursively)

    $ line
    Search in /Users/Morgan/Documents/Example/
    file count: 4
    line count: 839
    

    If you want more detail, just use line -d.

    $ line -d
    Search in /Users/Morgan/Documents/Example/
    Dir A/file C.c                                             72
    Dir A/file D.py                                           268
    file A.py                                                 467
    file B.c                                                   32
    file count: 4
    line count: 839
    

    And the best part of this tool is, you can add .gitignore like configure file to it. You can set up rules to select or ignore what kind of files to count just like what you do in '.gitignore'. Yes, this tool is just invented to make knowing how many lines I have easier.

    More description and usage is here: https://github.com/MorganZhang100/line-counter

    I'm the author of this simple tool. Hope it can help somebody.

提交回复
热议问题