检查用户写了多少%的代码库

发布于 2025-01-26 04:58:46 字数 98 浏览 2 评论 0原文

我只是想知道是否有任何库,脚本或任何方法来计算用户在存储库中编写的代码行。我一直在寻找类似的东西,但我什么都没找到。

如果没有这样的东西,也许您知道如何完成这样的脚本?

I'm just wondering if there is any library, script, or any way to count the lines of code written by the user in a repo. I was looking for something like that for a while but I didn't find anything.

If there is nothing like this, maybe you have any idea how a script like this could be done?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

折戟 2025-02-02 04:58:46

好吧,我已经在这里找到了它 - &gt; < git存储库中特定作者更改的行?

总结一下,最好的解决方案是使用此命令

git log --format='%aN' | sort -u | while read name; do echo -en "$name\t"; git log --author="$name" --pretty=tformat: --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s, removed lines: %s, total lines: %s\n", add, subs, loc }' -; done

,因为您不需要使用任何外部库,并且您仍然可以轻松地获得有关该线路变化的统计信息项目

Okay I already found it right here -> How to count total lines changed by a specific author in a Git repository?

Summing it up, the best solution is to use this command

git log --format='%aN' | sort -u | while read name; do echo -en "$name\t"; git log --author="$name" --pretty=tformat: --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s, removed lines: %s, total lines: %s\n", add, subs, loc }' -; done

because you do not need to use any external libraries, and you can still easily get statistics about line changes in the project

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文