{"id":17973210,"url":"https://github.com/darvid7/github-source-lines-of-code","last_synced_at":"2025-03-25T12:33:16.960Z","repository":{"id":83694006,"uuid":"75195555","full_name":"darvid7/Github-source-lines-of-code","owner":"darvid7","description":"Python/bash script to count all source lines of code :page_facing_up: for a Github user :octocat:","archived":false,"fork":false,"pushed_at":"2017-07-31T23:41:36.000Z","size":45,"stargazers_count":8,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-20T08:44:58.879Z","etag":null,"topics":["cloc","count-code","github","lines-of-code","python","repositories","sloc"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/darvid7.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-11-30T14:38:54.000Z","updated_at":"2025-02-04T02:13:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"8885744f-5c64-4f1e-9f76-09113b2f03c4","html_url":"https://github.com/darvid7/Github-source-lines-of-code","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darvid7%2FGithub-source-lines-of-code","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darvid7%2FGithub-source-lines-of-code/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darvid7%2FGithub-source-lines-of-code/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darvid7%2FGithub-source-lines-of-code/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/darvid7","download_url":"https://codeload.github.com/darvid7/Github-source-lines-of-code/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245463053,"owners_count":20619602,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cloc","count-code","github","lines-of-code","python","repositories","sloc"],"created_at":"2024-10-29T16:28:02.290Z","updated_at":"2025-03-25T12:33:16.945Z","avatar_url":"https://github.com/darvid7.png","language":"Python","readme":"# Python/bash script to count all sloc for a github user\n\n## Usage\n\ndownload/clone repo and extract contents\n\ncd into folder\n\nrun using $python3 user-sloc [username]\n\n- username is your github username\n\n- owner specifies the script to only look at repos you own\n\neg: $ python3 user-sloc.py darvid7 owner\n\n## Flags\n\n```\n192-168-1-2:github-user-all-sloc David$ python3 user-sloc.py darvid7 -h\nusage: user-sloc.py [-h] [-l SORT_BY_LANGUAGE] [-c COUNT_DESCENDING]\n                    [-o ONLY_OWNER] [-v VERBOSITY]\n                    username\n\nScript to count all source lines of code for a Github user.\n\npositional arguments:\n  username              String, Github username\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -l SORT_BY_LANGUAGE, --sort_by_language SORT_BY_LANGUAGE\n                        Boolean, sort results by language.\n  -c COUNT_DESCENDING, --count_descending COUNT_DESCENDING\n                        Boolean, sort results by SLOC count descending, if\n                        False sorts in ascending order.\n  -o ONLY_OWNER, --only_owner ONLY_OWNER\n                        Boolean, only check repositories that the user owns.\n  -v VERBOSITY, --verbosity VERBOSITY\n                        Integer, level of verbosity. 0: Only show progress\n                        bar. 1: Print out repository being processed. 2: Print\n                        every UPDATE and INSERT to db.\n\n```\n\n## Sample output\n\n```\n192-168-1-2:github-user-all-sloc David$ python3 user-sloc.py darvid7 -o=True -l=True\nPassword: \n 64% (29 of 45) |############################################################################                                           | Elapsed Time: 0:20:31 ETA: 0:22:42\nFinished processing repositories...\n\nLanguage | SLOC | Num Files\n('JavaScript', 743657, 6415)\n('Markdown', 142645, 1244)\n('Python', 139684, 960)\n('JSON', 132866, 1291)\n('XML', 84705, 254)\n('CSS', 39598, 134)\n('HTML', 31157, 264)\n('PHP', 11044, 162)\n('Java', 10349, 233)\n('LESS', 7272, 87)\n('XSLT', 4238, 29)\n('CoffeeScript', 2588, 16)\n('C', 2452, 53)\n('YAML', 2444, 210)\n('XSD', 2208, 6)\n('SASS', 1787, 17)\n('Assembly', 1371, 17)\n('Swift', 962, 37)\n('make', 848, 72)\n('Bourne Again Shell', 365, 3)\n('Groovy', 335, 18)\n('INI', 308, 10)\n('Bourne Shell', 300, 28)\n('DOS Batch', 192, 3)\n('C/C++ Header', 123, 31)\n('ERB', 112, 2)\n('TypeScript', 104, 2)\n('Prolog', 83, 5)\n('C++', 77, 2)\n('Handlebars', 67, 4)\n('Arduino Sketch', 65, 2)\n('Go', 52, 4)\n('C Shell', 17, 1)\n('Ruby', 16, 2)\n('Lisp', 12, 2)\n('PowerShell', 4, 1)\n```\n\n\n**Requires**\n\n- Python3\n\n- unix like environment\n\n- cloc http://cloc.sourceforge.net/\n\n- PyGithub https://github.com/PyGithub/PyGithub\n\n```\n$ pip install PyGithub\n```\n\n- progressbar lib \n\n```\n$ pip install progressbar2\n```\n\n**To do:**\n\n- add ignore language option\n\n- add quiet option\n\n- add ignore file lists\n\n- add ignore extension\n\n- nicer formatting of results\n\n- ignore frameworks\n\nnotes:\n\n-  git clone https://github.com/darvid7/FIT2043.git -q\n\n- ignore node modules, virtual env, flask, framework files etc\n\nNote: This also counts private repositories.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarvid7%2Fgithub-source-lines-of-code","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdarvid7%2Fgithub-source-lines-of-code","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarvid7%2Fgithub-source-lines-of-code/lists"}