LineCop

Language-aware file size linter. Patrols your code base to enforce per-language line count limits using tokei.

keep files in line

On Patrol

violation report
$ linecop
--- src/handlers/api.rs: 612 lines (limit: 500, +112 over)
--- src/models/schema.rs: 534 lines (limit: 500, +34 over)

2 file(s) exceed size limits (+146 lines over). Consider refactoring.
clean run
$ linecop
All files within size limits.

Feature Highlights

Language-Aware

Powered by tokei, LineCop recognizes 200+ languages. Set limits per language — 500 lines for Rust, 200 for Markdown, 400 for Python.

Flexible Counting

Count total lines, code-only, or code + comments. Choose the mode that matches your team’s conventions.

Glob Overrides

Need a higher limit for generated files? Exclude vendor code? Per-file glob patterns let you fine-tune enforcement.

JSON Schema

Run linecop schema to get a JSON Schema for your config. Editor auto-completion in VS Code, Zed, and more.

CI-Ready

Use --quiet --format json for machine-readable output. Non-zero exit code on violations, perfect for CI gates.

Zero Config Start

Run linecop init to generate a starter .linecop.yaml with sensible defaults. Tweak from there.

Configuration

# .linecop.yaml
limits:
  Rust: 500
  Markdown: 200
  Python: 400

count_mode: total  # total | code | code-comments

overrides:
  - pattern: "src/generated_*.rs"
    limit: 1000
  - pattern: "RESEARCH.md"
    exclude: true

exclude_dirs:
  - target
  - node_modules

Install

$ cargo install linecop
# Run without installing $ nix run github:mlavrinenko/linecop
# Or add to your flake inputs linecop.url = "github:mlavrinenko/linecop";
# Download from GitHub Releases $ curl -fsSL https://github.com/mlavrinenko/linecop/releases/latest/download/linecop-x86_64-linux.tar.gz | tar xz $ ./linecop --version

Quick Start

getting started
$ linecop init
Created ./.linecop.yaml

$ linecop
All files within size limits.

$ linecop --format json --quiet
[]