From 5c9579e0eb15151e0b5948222332de15b47db5af Mon Sep 17 00:00:00 2001 From: tupe12334 Date: Mon, 20 Jul 2026 03:52:07 +0300 Subject: [PATCH] chore: adopt linecheck for per-file line-count enforcement MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds linecheck.yml (rust files warn at 200 lines, error at 1100 — a buffer above the current largest file so CI stays green) and a linecheck CI job that installs via cargo and runs `linecheck .`. Closes #183 --- .github/workflows/ci.yml | 25 +++++++++++++++++++++++++ linecheck.yml | 12 ++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 linecheck.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3532ab5..e3418a4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -90,6 +90,31 @@ jobs: with: manifest-path: core/Cargo.toml + linecheck: + name: Line count check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + + - name: Install Rust stable + uses: dtolnay/rust-toolchain@stable + + - name: Cache cargo registry + uses: actions/cache@v6 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + key: ${{ runner.os }}-cargo-linecheck-${{ hashFiles('core/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-linecheck- + + - name: Install linecheck + run: cargo install linecheck --locked + + - name: Run linecheck + run: linecheck . + coverage: name: Code coverage (cargo-llvm-cov) runs-on: ubuntu-latest diff --git a/linecheck.yml b/linecheck.yml new file mode 100644 index 0000000..5bc9927 --- /dev/null +++ b/linecheck.yml @@ -0,0 +1,12 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/tupe12334/linecheck/main/schema/linecheck.schema.json + +rules: + - pattern: "**/*.rs" + warn: 200 + warn_message: "Getting long — consider splitting into submodules" + error: 1100 + error_message: "File exceeds the adoption-day gate; split before merging or lower the gate" + +exclude: + - "**/target/**" + - "**/Cargo.lock"