Skip to main content

open-harness-scopelens

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/scopelens) and on Packagist (open-harness/scopelens). Identical binary, identical config; pick the registry that matches your stack.

Install

pip install open-harness-scopelens

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

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

Configuration

Place a scopelens.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 scopelens.json

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

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

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

Integrations

# Husky pre-commit
scopelens check --fail
# lefthook.yml
pre-commit:
  commands:
    scopelens:
      run: scopelens check --fail --no-color
# GitHub Actions
- name: Run scopelens
  run: npx @open_harness/scopelens 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-scopelens

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

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

Configuración

Colocá un scopelens.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 scopelens.json

Si preferís no tener un scopelens.json separado, agregá una key scopelens en tu package.json con la misma forma del archivo dedicado. Precedencia: --config <path> > scopelens.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-scopelens 0.2.2

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-scopelens 0.2.2
File Actions
open_harness_scopelens-0.2.2-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for open_harness_scopelens-0.2.2-py3-none-win_amd64.whl
open_harness_scopelens-0.2.2-py3-none-manylinux2014_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64 Details for open_harness_scopelens-0.2.2-py3-none-manylinux2014_x86_64.whl
open_harness_scopelens-0.2.2-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details for open_harness_scopelens-0.2.2-py3-none-macosx_11_0_arm64.whl
open_harness_scopelens-0.2.2-py3-none-macosx_10_9_x86_64.whl Python 3 none macOS 10.9+ x86-64 Details for open_harness_scopelens-0.2.2-py3-none-macosx_10_9_x86_64.whl

Total release size: 6.6 MB

Release files / open_harness_scopelens-0.2.2-py3-none-win_amd64.whl

Download URL open_harness_scopelens-0.2.2-py3-none-win_amd64.whl
Size 2.7 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
705986e181da1dabd27ff2351be593007714204bdd90b8413af97cf814576d1c
BLAKE2b-256 checksum
How to use checksums
7e4d7983cb05212afdf358f0e3f467b5485a2a5ab45e1b16cee7036465de298b
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_scopelens-0.2.2-py3-none-manylinux2014_x86_64.whl

Download URL open_harness_scopelens-0.2.2-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
50ce7a552788cdf6847e82bd785af82e0aef7a2986b929c7e4d8bcabff458c17
BLAKE2b-256 checksum
How to use checksums
05be17fe8b1d673a8c50c4fc0d9b28585665de8f24d7bd53b8cb7b074a1f3a7e
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_scopelens-0.2.2-py3-none-macosx_11_0_arm64.whl

Download URL open_harness_scopelens-0.2.2-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
42df15ba7487b900d0d2dbabeed49b68b95e9d6d86d126b90d6b98e609610371
BLAKE2b-256 checksum
How to use checksums
12783dbe9f0ee42420319d33dcb8fa44e7d92d174184789c0f4285bacd80765b
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_scopelens-0.2.2-py3-none-macosx_10_9_x86_64.whl

Download URL open_harness_scopelens-0.2.2-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
88311cc376f2ecd7e8bea3f5f0f547cf72515a0b3519b1d43093e3d1bbb509c5
BLAKE2b-256 checksum
How to use checksums
fad9cf6d2b1bd286c9c46f8194aca23d36fffdca63ceb76f7f6e0b55a5a35a09
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-scopelens 0.2.2

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