Skip to main content

assert-no-inline-directives

A CLI tool to assert that files contain no inline directives for yamllint, pylint, mypy, and coverage.

Installation

pip install assert-no-inline-directives

Usage

assert-no-inline-directives --tools TOOLS [OPTIONS] PATH [PATH ...]

Required Arguments

  • --tools TOOLS - Comma-separated list of tools: coverage,mypy,pylint,yamllint
  • PATH - One or more file paths, directory paths, or glob patterns to scan (directories are scanned recursively, globs support hidden directories)

Optional Arguments

  • --exclude PATTERNS - Comma-separated glob patterns to exclude files
  • --quiet - Suppress output, exit code only
  • --count - Print finding count only
  • -v, --verbose - Show tools, files scanned, findings, and summary
  • --fail-fast - Exit on first finding
  • --warn-only - Always exit 0, report only
  • --allow PATTERNS - Comma-separated patterns to allow

Examples

# Check for pylint and mypy suppressions in files
assert-no-inline-directives --tools pylint,mypy src/*.py

# Scan a directory recursively
assert-no-inline-directives --tools pylint,mypy src/

# Use glob patterns (including hidden directories like .github)
assert-no-inline-directives --tools yamllint "**/*.yml" "**/*.yaml"

# Check all tools, exclude vendor files
assert-no-inline-directives --tools coverage,mypy,pylint,yamllint \
    --exclude "*vendor*" src/ config/

# Allow specific type: ignore patterns
assert-no-inline-directives --tools mypy \
    --allow "type: ignore[import]" src/*.py

# Check for coverage pragmas
assert-no-inline-directives --tools coverage src/

# CI mode: quiet, just exit code
assert-no-inline-directives --tools pylint,mypy --quiet src/

# Verbose mode: show progress
assert-no-inline-directives --tools pylint,mypy --verbose src/

# Non-blocking check (always exit 0)
assert-no-inline-directives --tools mypy --warn-only src/

Exit Codes

  • 0 - No inline directives found
  • 1 - One or more inline directives found
  • 2 - Usage or runtime error (e.g., file not found, invalid tool)

Output Formats

Default format (one finding per line):

src/example.py:10:pylint:pylint: disable
src/example.py:15:mypy:type: ignore
src/example.py:20:coverage:pragma: no cover
config.yaml:5:yamllint:yamllint disable

Count format (--count):

2

Detected Directives

coverage

  • pragma: no cover
  • pragma: no branch

mypy (suppressions only)

  • type: ignore (including bracketed forms like type: ignore[attr-defined])
  • mypy: ignore-errors

pylint (suppressions only)

  • pylint: disable
  • pylint: disable-next
  • pylint: disable-line
  • pylint: skip-file

yamllint (suppressions only)

  • yamllint disable-line
  • yamllint disable
  • yamllint disable-file

Matching Behavior

  • Case-insensitive matching
  • Tolerates extra whitespace (e.g., pylint: disable, type: ignore)
  • Only detects directives in comments (after #), not in string literals
  • Does not flag "enable" directives (e.g., yamllint enable)
  • Files are scanned in alphabetical order for consistent output
  • Glob patterns support hidden directories (e.g., .github)
  • Tools only check files with matching extensions:
    • coverage: .py, .toml
    • mypy: .py, .toml
    • pylint: .py, .toml
    • yamllint: .yaml, .yml, .toml

License

Apache 2.0 - see LICENSE.txt

Metadata

Release files for assert-no-inline-directives 20260104142245

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

Source distribution (sdist)

Source distribution for assert-no-inline-directives 20260104142245
File Size Uploaded Provenance
assert_no_inline_directives-20260104142245.tar.gz 33.8 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for assert-no-inline-directives 20260104142245
File Interpreter ABI Platform
assert_no_inline_directives-20260104142245-py3-none-any.whl Python 3 none any Details

Total release size: 46.9 kB

Release files / assert_no_inline_directives-20260104142245.tar.gz

Download URL assert_no_inline_directives-20260104142245.tar.gz
Size 33.8 kB
Tags Source
SHA-256 checksum
How to use checksums
a35df3ec6ff82da4469914f3c8db5d4f52ff07c89fc96478827776c9f68c7f19
BLAKE2b-256 checksum
How to use checksums
6af96d876b7ce5bfab6c110fefc5d29aaf7dfc751abfbed1a09cb77c623858e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 4, 2026.

Transparency log

Release files / assert_no_inline_directives-20260104142245-py3-none-any.whl

Download URL assert_no_inline_directives-20260104142245-py3-none-any.whl
Size 13.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eff10509a160629541f419a340da46a1e0d6bb19dc5db2bb52a2d19a0484d8f5
BLAKE2b-256 checksum
How to use checksums
1300ec355fb0e6609d5f3ad230d987898775c80154bcf8e2586c5d1fc79b66a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 4, 2026.

Transparency log

Security for assert-no-inline-directives 20260104142245

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for assert_no_inline_directives-20260104142245.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 4, 2026.

Transparency log

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