pythoncloc

How do I run cloc to check all python files of a directory including subdirectories but ignore any subdirectories that have the word migrations?


I installed cloc using brew.

I like to check number of lines of code for a Django project.

I definitely don't want to count those that inside migrations and only restrict to python files.

I tried cloc --not-match-d=migrations --include-lang=python . and cloc --not-match-d=migrations --include-lang=py . at the project root, but they got ignored.

this is the result:

± cloc --not-match-d=migrations --include-lang=python .
   18714 text files.
   13100 unique files.
   18771 files ignored.

Solution

  • You're almost there... language name is case sensitive. This should work

    cloc --not-match-d=migrations --include-lang=Python .
    

    The language name must match one of the entries of cloc --show-lang. If there's a space in the name, wrap it in quotes, eg --include-lang="Visual Basic".