Search code examples
pythongitgithubgithub-api

Get number of lines of code modified from GitHub repository


I have a repository on GitHub from which I have to find some statistics, then I have to process this data in a Python script. In particular, the information I have to get is the number of lines of code modified in a certain amount of days, i. e. the number of lines of code added, deleted and modified. I tried to take a look at the bees of GitHub but unfortunately I have not found what I need, would anyone know how to advise me what to do? Thank you.


Solution

  • You can use CLOC(“Count Lines of Code”), which will give you a breakdown of significant and insignificant lines of code by language.

    cloc $(git ls-files)
    

    This git ls-files is same as xargs cloc.

    Or another way to get number of coded line is to use...

    git ls-files | xargs wc -l