Skip to main content

open-harness-linelens

File length linter for any language. Reports files that exceed a configured line limit. Single native binary, zero runtime dependencies.

Part of the open-harness monorepo. Español abajo.

Same tool, other ecosystems: also available on npm (@open_harness/linelens) and on Packagist (open-harness/linelens). Identical binary, identical config; pick the registry that matches your stack.

Install

pip install open-harness-linelens

pip picks the right native wheel for your platform automatically (Linux x86_64, macOS arm64, macOS x86_64, Windows x86_64). Each wheel embeds the Go binary — no runtime deps.

Usage

linelens check               # scan current directory
linelens check --fail        # exit 1 on violations (CI / git hooks)
linelens check --dir ./src   # scan a specific directory
linelens check --max 200     # override the line limit
linelens check --no-color    # plain output for logs
linelens init                # generate a default linelens.json
linelens version             # print version

Configuration

Place a linelens.json at the repo root:

{
  "default": { "maxLines": 100 },
  "rules": [
    { "pattern": "**/*_test.go",     "maxLines": 300 },
    { "pattern": "**/*.spec.*",      "maxLines": 300 },
    { "pattern": "**/migrations/**", "skip": true }
  ],
  "exclude": ["node_modules", "vendor", ".git", "dist"]
}

Pattern semantics follow .gitignore style. The first matching rules entry wins; if no rule matches, default.maxLines applies.

Alternative: configure inside pyproject.toml or the dedicated linelens.json

If you prefer not to keep a separate linelens.json, add a linelens key in your package.json with the same shape:

{
  "name": "my-project",
  "linelens": {
    "default": { "maxLines": 100 },
    "rules": [{ "pattern": "**/*_test.go", "maxLines": 300 }],
    "exclude": ["node_modules", "dist"]
  }
}

Precedence: --config <path> > linelens.json > package.json key > built-in defaults. CLI flags (--max, --no-color, etc.) always win.

Integrations

# Husky pre-commit
linelens check --fail
# lefthook.yml
pre-commit:
  commands:
    linelens:
      run: linelens check --fail --no-color
# GitHub Actions
- name: Run linelens
  run: npx @open_harness/linelens check --fail

Why a line limit?

Large files concentrate too many responsibilities and become hard to read, test, and refactor. A soft cap (e.g. 100 lines, with exceptions for tests) keeps modules focused and forces responsibility-split decisions early — when they are cheap.

Exit codes

Code Meaning
0 No violations (or --fail not passed)
1 Violations found and --fail was passed, or config error

Español

Linter de longitud de archivos, agnóstico al lenguaje. Reporta los archivos que superan un límite de líneas configurable. Un solo binario nativo, cero dependencias en tiempo de ejecución.

Parte del monorepo open-harness.

Instalación

pip install open-harness-linelens

pip elige automáticamente la wheel nativa correcta para tu plataforma (Linux x86_64, macOS arm64, macOS x86_64, Windows x86_64). Cada wheel embebe el binario Go — sin deps en runtime.

Uso

linelens check               # escanea el directorio actual
linelens check --fail        # exit 1 si hay violaciones (CI / git hooks)
linelens check --dir ./src   # escanea un directorio específico
linelens check --max 200     # sobrescribe el límite de líneas
linelens check --no-color    # salida sin colores
linelens init                # genera un linelens.json por defecto
linelens version             # imprime la versión

Configuración

Colocá un linelens.json en la raíz del repo. Ver ejemplo arriba. La semántica de patrones sigue el estilo .gitignore. La primera regla coincidente en rules gana; si ninguna coincide, aplica default.maxLines.

Alternativa: configurar dentro de pyproject.toml o linelens.json

Si preferís no tener un linelens.json separado, agregá una key linelens en tu package.json con la misma forma del archivo dedicado. Precedencia: --config <path> > linelens.json > key en package.json > defaults del binario. Los flags CLI (--max, --no-color, etc.) siempre ganan.

Integraciones

Mismos snippets que arriba — sirven con Husky (.husky/pre-commit), lefthook (lefthook.yml) o GitHub Actions.

Por qué un límite de líneas

Los archivos grandes concentran demasiadas responsabilidades y son difíciles de leer, testear y refactorizar. Un tope blando (por ejemplo 100 líneas, con excepciones para tests) mantiene los módulos enfocados y obliga a tomar decisiones de partición temprano — cuando son baratas.

Códigos de salida

Código Significado
0 Sin violaciones (o no se pasó --fail)
1 Hubo violaciones con --fail, o error de configuración

License

MIT — see the main repository.

Metadata

Release files for open-harness-linelens 0.3.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for open-harness-linelens 0.3.4
File Actions
open_harness_linelens-0.3.4-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for open_harness_linelens-0.3.4-py3-none-win_amd64.whl
open_harness_linelens-0.3.4-py3-none-manylinux2014_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64 Details for open_harness_linelens-0.3.4-py3-none-manylinux2014_x86_64.whl
open_harness_linelens-0.3.4-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details for open_harness_linelens-0.3.4-py3-none-macosx_11_0_arm64.whl
open_harness_linelens-0.3.4-py3-none-macosx_10_9_x86_64.whl Python 3 none macOS 10.9+ x86-64 Details for open_harness_linelens-0.3.4-py3-none-macosx_10_9_x86_64.whl

Total release size: 6.3 MB

Release files / open_harness_linelens-0.3.4-py3-none-win_amd64.whl

Download URL open_harness_linelens-0.3.4-py3-none-win_amd64.whl
Size 2.6 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
936ff395887bbc10ba1dd9a5dfbd3fb3f76b2229566cdcd66b699c5af2259023
BLAKE2b-256 checksum
How to use checksums
d99095366658cd6d171a4af6200e9c4cf669736269250a0d8bc338828135a6ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.7

Release files / open_harness_linelens-0.3.4-py3-none-manylinux2014_x86_64.whl

Download URL open_harness_linelens-0.3.4-py3-none-manylinux2014_x86_64.whl
Size 1.3 MB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
9d3ab7eaea58e3f1a98e29a2464cd0dec7b2da0d5e747a4417a68ca22f5fec28
BLAKE2b-256 checksum
How to use checksums
2a2b9c70d19aec07570d562ce48fb9b265964c0ea1728fb1cb2d00cf47f205e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.7

Release files / open_harness_linelens-0.3.4-py3-none-macosx_11_0_arm64.whl

Download URL open_harness_linelens-0.3.4-py3-none-macosx_11_0_arm64.whl
Size 1.2 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
4b9d2cf83a2816c20b46ed5891eaec1d5a90c7e34ae1345e11c7657f175d4ecd
BLAKE2b-256 checksum
How to use checksums
2c848bbdf3dbe1bf4ac02dc81299c17a350ea745c7beb0781607d8afaf55a036
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.7

Release files / open_harness_linelens-0.3.4-py3-none-macosx_10_9_x86_64.whl

Download URL open_harness_linelens-0.3.4-py3-none-macosx_10_9_x86_64.whl
Size 1.3 MB
Tags Python 3 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
e3d7596b64ba8756a14febac6102ca80fda54c2634b3bf9e0938c20d1a3a0f41
BLAKE2b-256 checksum
How to use checksums
e93e1c1788e8fb780c8841086b39a1feb4b7159ba29e623b94aedcc18eb265c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.7

Security for open-harness-linelens 0.3.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page