Skip to main content

CLI tool to assert that no linter config files exist

Project description

assert-no-linter-config-files

A command-line tool that asserts there are no configuration files (or embedded configuration sections) for common linters in your codebase. This is useful for enforcing that linter configurations are managed centrally rather than in individual repositories.

Usage

assert-no-linter-config-files --linters LINTERS [OPTIONS] DIRECTORY [DIRECTORY ...]

Required Arguments

  • --linters LINTERS - Comma-separated linters to check: jscpd,mypy,pylint,pytest,yamllint
  • DIRECTORY - One or more directories to scan

Optional Arguments

  • --exclude PATTERN - Glob pattern to exclude paths (repeatable)
  • --quiet - Suppress output, exit code only
  • --count - Print finding count only
  • --json - Output findings as JSON
  • --fail-fast - Exit on first finding
  • --warn-only - Always exit 0, report only

Exit Codes

  • 0 - No linter configuration found (or --warn-only)
  • 1 - One or more linter configurations found
  • 2 - Usage/runtime error (invalid args, unreadable files)

Examples

Check for pylint and mypy configs in the current directory:

assert-no-linter-config-files --linters pylint,mypy .

Check specific directories:

assert-no-linter-config-files --linters pylint,mypy src/ tests/

Check all linters:

assert-no-linter-config-files --linters pylint,mypy,pytest,yamllint,jscpd .

Exclude vendor directories:

assert-no-linter-config-files --linters pylint,mypy \
  --exclude "*vendor*" --exclude "*node_modules*" .

Get JSON output for CI integration:

assert-no-linter-config-files --linters pylint --json . | jq .

Use in CI to enforce no local linter configs:

assert-no-linter-config-files --linters pylint,mypy . || exit 1

What It Checks

Dedicated Config Files

The tool flags the presence of these files anywhere in the scanned tree:

jscpd: .jscpd.json, .jscpd.yml, .jscpd.yaml, .jscpd.toml, .jscpdrc, .jscpdrc.json, .jscpdrc.yml, .jscpdrc.yaml

mypy: mypy.ini, .mypy.ini

pylint: .pylintrc, pylintrc, .pylintrc.toml

pytest: pytest.ini

yamllint: .yamllint, .yamllint.yml, .yamllint.yaml

Embedded Config Sections

The tool also checks shared config files for tool-specific sections:

pyproject.toml:

  • [tool.jscpd]
  • [tool.mypy]
  • [tool.pylint] or [tool.pylint.*]
  • [tool.pytest.ini_options]
  • [tool.yamllint]

setup.cfg:

  • [mypy]
  • Any section containing "pylint"
  • [tool:pytest]

tox.ini:

  • [mypy]
  • Any section containing "pylint"
  • [pytest] or [tool:pytest]

Output Format

When findings are detected, each is printed on a separate line:

<path>:<tool>:<reason>

Examples:

./pytest.ini:pytest:config file
./pyproject.toml:mypy:tool.mypy section
./setup.cfg:pylint:pylint.messages_control section

With --json:

[{"path": "./pytest.ini", "tool": "pytest", "reason": "config file"}]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

assert_no_linter_config_files-20260221122627.tar.gz (32.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file assert_no_linter_config_files-20260221122627.tar.gz.

File metadata

File hashes

Hashes for assert_no_linter_config_files-20260221122627.tar.gz
Algorithm Hash digest
SHA256 6304918b6e9452d2566aaa7dd6a13a149b77b50f81cecb065659dbce81624792
MD5 a8a1816a17037ed0805024493f4bf26a
BLAKE2b-256 0dbbba5ab350c79a4a3eb1938d3e0362fa008e1fb543b8b5fea19732ce48d4d2

See more details on using hashes here.

Provenance

The following attestation bundles were made for assert_no_linter_config_files-20260221122627.tar.gz:

Publisher: ci.yml on 10U-Labs/assert-no-linter-config-files

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file assert_no_linter_config_files-20260221122627-py3-none-any.whl.

File metadata

File hashes

Hashes for assert_no_linter_config_files-20260221122627-py3-none-any.whl
Algorithm Hash digest
SHA256 e27b66b302f67e62e7ace7d3d21e925aba1f04a31082bf050089c6dfd71d4e5e
MD5 eef34fdcd9e805564374e7a8e2837c36
BLAKE2b-256 771f2de32908b4a2c0be36bc704cd2b8598f27094824833ef1e093752ed2089a

See more details on using hashes here.

Provenance

The following attestation bundles were made for assert_no_linter_config_files-20260221122627-py3-none-any.whl:

Publisher: ci.yml on 10U-Labs/assert-no-linter-config-files

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page