{"id":20674639,"url":"https://github.com/nyg123/go_unit","last_synced_at":"2026-04-12T09:45:16.265Z","repository":{"id":57692706,"uuid":"483542880","full_name":"nyg123/go_unit","owner":"nyg123","description":null,"archived":false,"fork":false,"pushed_at":"2022-06-27T07:35:25.000Z","size":27,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-17T14:39:24.775Z","etag":null,"topics":["coverage","git","golang","gotest","php","phpunit"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nyg123.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}},"created_at":"2022-04-20T07:00:20.000Z","updated_at":"2022-06-16T12:13:11.000Z","dependencies_parsed_at":"2022-09-26T21:01:00.665Z","dependency_job_id":null,"html_url":"https://github.com/nyg123/go_unit","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nyg123%2Fgo_unit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nyg123%2Fgo_unit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nyg123%2Fgo_unit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nyg123%2Fgo_unit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nyg123","download_url":"https://codeload.github.com/nyg123/go_unit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242901476,"owners_count":20203949,"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":["coverage","git","golang","gotest","php","phpunit"],"created_at":"2024-11-16T21:06:31.563Z","updated_at":"2026-04-12T09:45:11.243Z","avatar_url":"https://github.com/nyg123.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"## 统计一个分支每人开发的代码行数,及单测覆盖率\n\n- 统计某个分支基于基础分支(master)的提交\n- 不统计空行，空格的变动\n- 可指定需统计的文件扩展名，如php,go\n- 可排除不需要统计的文件夹，如vendor\n- 代码提交后又删除的，不计入统计\n- 目前覆盖率解析只支持golang php\n\n\n## 使用方法\n\u003e go_unit -c unitConf.json\n\n```-c``` 指定配置文件 默认是unitConf.json\n\n执行的结果如下\n```txt\n提交人:aaa@email.com  变更行数1681    可测试代码行数1051      单元测试覆盖行数933     覆盖率88.77%\n提交人:aaa@email.com  变更行数52      可测试代码行数27        单元测试覆盖行数26      覆盖率96.30%\n提交人:aaa@email.com  变更行数129     可测试代码行数104       单元测试覆盖行数32      覆盖率30.77%\n提交人:aaa@email.com  变更行数1       可测试代码行数1         单元测试覆盖行数1       覆盖率100.00%\n            合计：    变更行数1863    可测试代码行数1183      单元测试覆盖行数992     覆盖率83.85%\n\n```\n\n## 配置说明,以go项目为例\n```json\n{\n    \"lang\" : \"go\",\n    \"path\" : \"./\",\n    \"coverage_path\" : \"./coverage.out\",\n    \"coverage_prefix\" : \"go_unit/\",\n    \"diff_commit\" : \"master\",\n    \"diff_exclude\" : [\n        \"/protobuf/\",\n        \".pb.go$\",\n        \".pb.gw.go$\",\n        \"_test.go$\"\n    ],\n    \"unit_exclude\" : [\n        \"main.go\"\n    ],\n    \"ext\" : [\n        \"go\"\n    ],\n    \"show_detail\" : true\n}\n```\n- lang: 指定语言，目前支持go,php\n- path: 指定项目目录，默认是当前目录\n- coverage_path: 指定覆盖率输出文件路径，默认是coverage.out\n- coverage_prefix: 指定覆盖率输出文件前缀，覆盖率文件中的文件路径会加的有项目名称，\n  例如 `go_unit/main.go:32.9,35.25 1 0` 需要指定前缀为 `go_unit/`\n- diff_commit 用当前分支与哪个分支进行比较，一般是与`master`对比\n- diff_exclude: 指定不需要统计代码变更的文件，支持正则 例如 `/protobuf/` 一些自动生成的文件、外部包、或者是测试文件我们不需要统计为代码变更\n- unit_exclude: 指定不需要统计覆盖率的文件，支持正则 例如 `main.go` \n- ext: 指定统计的文件扩展名 例如 `go`\n- show_detail: 是否输出每个人的单测未覆盖的代码详情，默认是true","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnyg123%2Fgo_unit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnyg123%2Fgo_unit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnyg123%2Fgo_unit/lists"}