{"id":17030278,"url":"https://github.com/vsoch/codestats","last_synced_at":"2026-05-03T13:38:19.690Z","repository":{"id":45849501,"uuid":"430195046","full_name":"vsoch/codestats","owner":"vsoch","description":"Customizable Go command line tool to generate and visualize repository stats (under development)","archived":false,"fork":false,"pushed_at":"2021-12-03T00:37:29.000Z","size":640,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-28T00:31:57.671Z","etag":null,"topics":["code","github","stats"],"latest_commit_sha":null,"homepage":"https://vsoch.github.io/codestats/","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vsoch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-11-20T19:45:54.000Z","updated_at":"2021-12-15T17:41:37.000Z","dependencies_parsed_at":"2022-09-24T18:50:56.094Z","dependency_job_id":null,"html_url":"https://github.com/vsoch/codestats","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/vsoch%2Fcodestats","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vsoch%2Fcodestats/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vsoch%2Fcodestats/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vsoch%2Fcodestats/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vsoch","download_url":"https://codeload.github.com/vsoch/codestats/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245018628,"owners_count":20548046,"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":["code","github","stats"],"created_at":"2024-10-14T08:05:39.247Z","updated_at":"2026-05-03T13:38:14.671Z","avatar_url":"https://github.com/vsoch.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Code Stats\n\nThis is a small project that will allow for easily calculating stats for all\nrepos across an organization, or a single repository of interest. Other metrics\ncould be added for other entities beyond repository health too!\n\n![docs/codestats.png](docs/codestats.png)\n\n\n## Usage\n\nTo build the library:\n\n```bash\n$ make\n```\n\nThis will compile an executable, `codestats` that you can interact with.\n\n## Commands\n\n### Repository Stats\n\n```bash\n$ ./codestats repo buildsi/build-abi-containers\n```\n\nYou can also save to file:\n\n```bash\n$ ./codestats repo buildsi/build-abi-containers --outfile examples/repo.json\n```\n\nYou can also pretty print json:\n\n```bash\n$ go run main.go repo buildsi/build-abi-containers --pretty\nbuild-abi-containers\n\n[\n    {\n        \"Stats\": [\n            {\n                \"Name\": \"Has-Codeowners\",\n                \"Pass\": false\n            },\n            {\n                \"Name\": \"Has-Maintainers\",\n                \"Pass\": false\n            },\n            {\n                \"Name\": \"Has-GitHub-Actions\",\n                \"Pass\": true\n            },\n            {\n                \"Name\": \"Has-CircleCI\",\n                \"Pass\": false\n            },\n            {\n                \"Name\": \"Has-Travis\",\n                \"Pass\": false\n            },\n            {\n                \"Name\": \"Has-PullApprove\",\n                \"Pass\": false\n            },\n            {\n                \"Name\": \"Has-Glide\",\n                \"Pass\": false\n            },\n            {\n                \"Name\": \"Has-Code-Of-Conduct\",\n                \"Pass\": false\n            },\n            {\n                \"Name\": \"Has-Contributing\",\n                \"Pass\": false\n            },\n            {\n                \"Name\": \"Has-Authors\",\n                \"Pass\": false\n            },\n            {\n                \"Name\": \"Has-Pull-Request-Template\",\n                \"Pass\": false\n            },\n            {\n                \"Name\": \"Has-Issue-Template\",\n                \"Pass\": false\n            },\n            {\n                \"Name\": \"Has-Support.md\",\n                \"Pass\": false\n            },\n            {\n                \"Name\": \"Has-Funding\",\n                \"Pass\": false\n            },\n            {\n                \"Name\": \"Has-Security\",\n                \"Pass\": false\n            }\n        ],\n        \"Name\": \"buildsi/build-abi-containers\",\n        \"Branch\": \"main\",\n        \"Url\": \"https://github.com/buildsi/build-abi-containers\",\n        \"Stars\": 2,\n        \"Forks\": 1,\n        \"Issues\": 3,\n        \"Language\": \"Python\",\n        \"Archived\": false,\n        \"CreatedAt\": \"2021-05-23T20:02:51Z\",\n        \"UpdatedAt\": \"2021-10-16T12:37:19Z\"\n    }\n]\n```\n\n\n### Organization Stats\n\nIf you want to get stats for an org:\n\n```bash\n$ ./codestats org buildsi\n\nbuild-notes\nbuild-si-modeling\nSmeagle\nbuild-abi-tests\nbuild-abi-containers\nbuild-sandbox\n...\n```\n\nYou can also add an optional skip pattern to say - \"Don't parse repos that match this regular expression!\"\n\n```bash\n$ go run main.go org spack --skip spack-search --output example/spack.json\n```\n\nYou can also add an optional pattern to only parse a subset of repos, or add `--pretty` to pretty print the json.\n\n```bash\n$ go run main.go org buildsi --pattern build-abi-containers --pretty\nbuild-abi-containers\nbuild-abi-containers-results\n{\n        {\n            \"Stats\": [\n                {\n                    \"Name\": \"Has-Codeowners\",\n                    \"Pass\": false\n                },\n                {\n                    \"Name\": \"Has-Maintainers\",\n                    \"Pass\": false\n                },\n                {\n                    \"Name\": \"Has-GitHub-Actions\",\n                    \"Pass\": true\n                },\n                {\n                    \"Name\": \"Has-CircleCI\",\n                    \"Pass\": false\n                },\n                {\n                    \"Name\": \"Has-Travis\",\n                    \"Pass\": false\n                },\n                {\n                    \"Name\": \"Has-PullApprove\",\n                    \"Pass\": false\n                },\n                {\n                    \"Name\": \"Has-Glide\",\n                    \"Pass\": false\n                }\n            ],\n            \"Name\": \"buildsi/build-abi-containers\",\n            \"Branch\": \"main\",\n            \"Url\": \"https://github.com/buildsi/build-abi-containers\",\n            \"Stars\": 2,\n            \"Forks\": 1,\n            \"Issues\": 3,\n            \"Language\": \"Python\",\n            \"Archived\": false,\n            \"CreatedAt\": \"2021-05-23T20:02:51Z\",\n            \"UpdatedAt\": \"2021-10-16T12:37:19Z\"\n        },\n        {\n            \"Stats\": [\n                {\n                    \"Name\": \"Has-Codeowners\",\n                    \"Pass\": false\n                },\n                {\n                    \"Name\": \"Has-Maintainers\",\n                    \"Pass\": false\n                },\n                {\n                    \"Name\": \"Has-GitHub-Actions\",\n                    \"Pass\": true\n                },\n                {\n                    \"Name\": \"Has-CircleCI\",\n                    \"Pass\": false\n                },\n                {\n                    \"Name\": \"Has-Travis\",\n                    \"Pass\": false\n                },\n                {\n                    \"Name\": \"Has-PullApprove\",\n                    \"Pass\": false\n                },\n                {\n                    \"Name\": \"Has-Glide\",\n                    \"Pass\": false\n                }\n            ],\n            \"Name\": \"buildsi/build-abi-containers-results\",\n            \"Branch\": \"main\",\n            \"Url\": \"https://github.com/buildsi/build-abi-containers-results\",\n            \"Stars\": 1,\n            \"Forks\": 0,\n            \"Issues\": 0,\n            \"Language\": \"Python\",\n            \"Archived\": false,\n            \"CreatedAt\": \"2021-06-08T23:44:24Z\",\n            \"UpdatedAt\": \"2021-08-29T14:25:50Z\"\n        }\n}\n```\n\nor again, save to output file:\n\n```bash\n$ go run main.go org buildsi --outfile examples/org.json\n```\n\nThe output file is the same format, so you can use the same visualization code in [docs](docs) for a web interface.\n\n### Customize Stats\n\nFor either the org or repo command, you can provide an optional yaml file\nto define a list of stats you want:\n\n```bash\n$ go run main.go repo buildsi/build-abi-containers --config examples/all-stats.yaml \n```\n\nThere is also an example file with known [GitHub health stats](https://docs.github.com/en/communities/setting-up-your-project-for-healthy-contributions/creating-a-default-community-health-file)\n\n```bash\n$ go run main.go repo buildsi/build-abi-containers --config examples/health-stats.yaml\n```\n\nOr save to output file, perhaps for a web interface!\n\n```bash\n$ go run main.go org buildsi --outfile examples/data.json \n```\n\nAnd finally, if you don't want to use a config file and want a quick run of one or more metrics, ask for them on the fly with `--metric`\n\n```bash\n$ go run main.go repo spack/spack --metric has-code-of-conduct\n$ go run main.go repo spack/spack --metric has-code-of-conduct,has-funding\n```\n\n### Web Interface\n\nWhen you generate stats, you can put them in the same directory as the provided [docs](docs)\nto generate a nice interface, which will be organized by type and repository.\nYou can see an example at [https://vsoch.github.io/codestats](https://vsoch.github.io/codestats)\n\n### GitHub Action\n\nThe repository also serves a GitHub action! You can run extractions with the same variables, for either\nan organization or a repository.\n\n```yaml\nname: Codestats Test\non:\n  pull_request: []\n  push:\n    branches:\n      - main \n \njobs:\n  extract-repo:\n    runs-on: ubuntu-latest\n    name: Repository Stats\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v2\n      - name: Codestats for a repository\n        uses: vsoch/codestats@main\n        with:\n          repository: spack/spack\n          metric: has-code-of-conduct\n          outfile: spack.json\n      - name: View Outfile\n        run: cat spack.json\n\n  extract-org:\n    runs-on: ubuntu-latest\n    name: Org Stats\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v2\n      - name: Codestats for an organization\n        uses: vsoch/codestats@main\n        with:\n          org: spack\n          metric: has-code-of-conduct\n          pattern: spack-tutorial\n          outfile: spack-tutorial.json\n      - name: View Outfile\n        run: cat spack-tutorial.json\n```\n\nThe above is a basic example, for each of a repository and an org, and you can\nsee variables in the [action.yml](action.yml). Please don't hesitate to open an issue\nto ask a question or request better documentation.\n\n### Questions?\n\nSo what else would you like to see? Additional stats or interface support? Please [open an issue](https://github.com/vsoch/codestats/issues) and let me know!\n\n### TODO\n\n - IDEA: should there be a common format for a stat, beyond hard coding? E.g., most seem like checking if something exists - this could be YAML\n\n\n## Previous Art\n\nThis was inspired by [bloodorange/oci-stats](https://github.com/bloodorangeio/oci-stats/blob/main/gen-html-for-repo.sh)!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvsoch%2Fcodestats","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvsoch%2Fcodestats","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvsoch%2Fcodestats/lists"}