Giter Site home page Giter Site logo

darvid7 / github-source-lines-of-code Goto Github PK

View Code? Open in Web Editor NEW
9.0 3.0 1.0 45 KB

Python/bash script to count all source lines of code :page_facing_up: for a Github user :octocat:

License: MIT License

Shell 3.49% Python 96.51%
python sloc cloc lines-of-code count-code github repositories

github-source-lines-of-code's Introduction

Python/bash script to count all sloc for a github user

Usage

download/clone repo and extract contents

cd into folder

run using $python3 user-sloc [username]

  • username is your github username

  • owner specifies the script to only look at repos you own

eg: $ python3 user-sloc.py darvid7 owner

Flags

192-168-1-2:github-user-all-sloc David$ python3 user-sloc.py darvid7 -h
usage: user-sloc.py [-h] [-l SORT_BY_LANGUAGE] [-c COUNT_DESCENDING]
                    [-o ONLY_OWNER] [-v VERBOSITY]
                    username

Script to count all source lines of code for a Github user.

positional arguments:
  username              String, Github username

optional arguments:
  -h, --help            show this help message and exit
  -l SORT_BY_LANGUAGE, --sort_by_language SORT_BY_LANGUAGE
                        Boolean, sort results by language.
  -c COUNT_DESCENDING, --count_descending COUNT_DESCENDING
                        Boolean, sort results by SLOC count descending, if
                        False sorts in ascending order.
  -o ONLY_OWNER, --only_owner ONLY_OWNER
                        Boolean, only check repositories that the user owns.
  -v VERBOSITY, --verbosity VERBOSITY
                        Integer, level of verbosity. 0: Only show progress
                        bar. 1: Print out repository being processed. 2: Print
                        every UPDATE and INSERT to db.

Sample output

192-168-1-2:github-user-all-sloc David$ python3 user-sloc.py darvid7 -o=True -l=True
Password: 
 64% (29 of 45) |############################################################################                                           | Elapsed Time: 0:20:31 ETA: 0:22:42
Finished processing repositories...

Language | SLOC | Num Files
('JavaScript', 743657, 6415)
('Markdown', 142645, 1244)
('Python', 139684, 960)
('JSON', 132866, 1291)
('XML', 84705, 254)
('CSS', 39598, 134)
('HTML', 31157, 264)
('PHP', 11044, 162)
('Java', 10349, 233)
('LESS', 7272, 87)
('XSLT', 4238, 29)
('CoffeeScript', 2588, 16)
('C', 2452, 53)
('YAML', 2444, 210)
('XSD', 2208, 6)
('SASS', 1787, 17)
('Assembly', 1371, 17)
('Swift', 962, 37)
('make', 848, 72)
('Bourne Again Shell', 365, 3)
('Groovy', 335, 18)
('INI', 308, 10)
('Bourne Shell', 300, 28)
('DOS Batch', 192, 3)
('C/C++ Header', 123, 31)
('ERB', 112, 2)
('TypeScript', 104, 2)
('Prolog', 83, 5)
('C++', 77, 2)
('Handlebars', 67, 4)
('Arduino Sketch', 65, 2)
('Go', 52, 4)
('C Shell', 17, 1)
('Ruby', 16, 2)
('Lisp', 12, 2)
('PowerShell', 4, 1)

Requires

$ pip install PyGithub
  • progressbar lib
$ pip install progressbar2

To do:

  • add ignore language option

  • add quiet option

  • add ignore file lists

  • add ignore extension

  • nicer formatting of results

  • ignore frameworks

notes:

Note: This also counts private repositories.

github-source-lines-of-code's People

Contributors

darvid7 avatar gammmaf avatar patrickshaw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

danielschulz

github-source-lines-of-code's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.