GitHub Line Count

统计 GitHub 仓库的代码行数

作者
Wybxc
日安装量
0
总安装量
0
评分
0 0 0
版本
1.1.0
创建于
2025-04-12
更新于
2025-04-12
大小
62.3 KB
许可证
GPL-2.0-or-later
适用于

GitHub Line Count

A browser script that adds a total line count badge to GitHub repositories.

Features

  • Displays total lines of code directly on repository pages
  • Works with both public and private repositories
  • Lightweight and non-intrusive

Installation

  1. Install a userscript manager like Tampermonkey
  2. Install the script
  3. (Optional) Open the menu of the userscript manager and configure a GitHub Personal Access Token for higher rate limits:
    • Requires public_repo scope for public repositories
    • Requires repo scope for private repositories
    • For fine-grained personal access tokens, select "Public repositories" or "All repositories" under "Repository access" as needed

How It Works

Since GitHub does not provide a direct API to get the total line count of a repository, the script calculates approximate line counts by combining:

  1. GitHub's file tree metadata
  2. Weekly commit activity statistics

Note:

  • Results may vary slightly from exact counts
  • Very large repositories may not be supported

Roadmap

  • [x] Add support for linguistic detection (i.e., ignore vendored or generated code)
  • [ ] Add support for mobile device views

Credits

  • gloc: The inspiration for this script
  • badgen: A tool for generating badges

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址