CLI tool to assert that files contain no inline directives
Project description
assert-no-inline-directives
A CLI tool to assert that files contain no inline directives for clang-diagnostic, clang-format, clang-tidy, coverage, markdownlint, mypy, pylint, and yamllint.
Usage
assert-no-inline-directives --tools TOOLS [OPTIONS] PATH [PATH ...]
Required Arguments
--tools TOOLS- Comma-separated list of tools:clang-diagnostic,clang-format,clang-tidy,coverage,markdownlint,mypy,pylint,yamllintPATH- One or more file paths, directory paths, or glob patterns to scan (directories are scanned recursively, globs support hidden directories)
Optional Arguments
--allow PATTERNS- Comma-separated patterns to allow--count- Print finding count only--exclude PATTERNS- Comma-separated glob patterns to exclude files--fail-fast- Exit on first finding--quiet- Suppress output, exit code only-v, --verbose- Show tools, files scanned, findings, and summary--warn-only- Always exit 0, report only
Examples
# Check all clang tools
assert-no-inline-directives --tools clang-tidy,clang-format,clang-diagnostic src/
# Check for clang-tidy NOLINT directives in C++ files
assert-no-inline-directives --tools clang-tidy "**/*.cpp" "**/*.h"
# Check for coverage pragmas
assert-no-inline-directives --tools coverage src/
# Check for markdownlint suppressions in markdown files
assert-no-inline-directives --tools markdownlint "**/*.md"
# 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 Python/YAML 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
# 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 found1- One or more inline directives found2- Usage or runtime error (e.g., file not found, invalid tool)
Output Formats
Default format (one finding per line):
config.yaml:5:yamllint:yamllint disable
README.md:3:markdownlint:markdownlint-disable
src/example.py:10:pylint:pylint: disable
src/example.py:15:mypy:type: ignore
src/example.py:20:coverage:pragma: no cover
src/main.cpp:8:clang-tidy:NOLINT
Count format (--count):
2
Detected Directives
clang-diagnostic (suppressions only)
#pragma clang diagnostic ignored
clang-format (suppressions only)
clang-format off
clang-tidy (suppressions only)
NOLINT(including check-specific forms likeNOLINT(bugprone-*))NOLINTBEGINNOLINTNEXTLINE
coverage
pragma: no branchpragma: no cover
markdownlint (suppressions only)
markdownlint-capturemarkdownlint-configure-filemarkdownlint-disable(including rule-specific forms likemarkdownlint-disable MD001)markdownlint-disable-filemarkdownlint-disable-linemarkdownlint-disable-next-line
mypy (suppressions only)
mypy: ignore-errorstype: ignore(including bracketed forms liketype: ignore[attr-defined])
pylint (suppressions only)
pylint: disablepylint: disable-linepylint: disable-nextpylint: skip-file
yamllint (suppressions only)
yamllint disableyamllint disable-fileyamllint disable-line
Matching Behavior
- Case-insensitive matching
- Tolerates extra whitespace (e.g.,
pylint: disable,type: ignore) - Only detects directives in comments
(after
#for Python/YAML,//and/* */for C/C++), not in string literals clang-diagnosticmatches#pragmapreprocessor directives on the full linemarkdownlintmatches<!-- markdownlint-... -->HTML comment directives on the full line- Does not flag "enable" directives
(e.g.,
clang-format on,markdownlint-enable,markdownlint-restore,NOLINTEND,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:
clang-diagnostic:.c,.cc,.cpp,.cxx,.h,.hpp,.hxx,.m,.mmclang-format:.c,.cc,.cpp,.cxx,.h,.hpp,.hxx,.m,.mmclang-tidy:.c,.cc,.cpp,.cxx,.h,.hpp,.hxx,.m,.mmcoverage:.py,.tomlmarkdownlint:.mdmypy:.py,.tomlpylint:.py,.tomlyamllint:.yaml,.yml,.toml
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file assert_no_inline_directives-20260221023510.tar.gz.
File metadata
- Download URL: assert_no_inline_directives-20260221023510.tar.gz
- Upload date:
- Size: 44.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ec29ef91262c1baf135261147a963c4c2ef0292575f1192b1d95e279cb212393
|
|
| MD5 |
96647c4e41b06f1bee07ad2ea1e1d4bb
|
|
| BLAKE2b-256 |
fd65f50725279b71816b3b8130fd935cdf5fc3dc10978f1e6529c646c07a60d7
|
Provenance
The following attestation bundles were made for assert_no_inline_directives-20260221023510.tar.gz:
Publisher:
ci.yml on 10U-Labs/assert-no-inline-directives
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
assert_no_inline_directives-20260221023510.tar.gz -
Subject digest:
ec29ef91262c1baf135261147a963c4c2ef0292575f1192b1d95e279cb212393 - Sigstore transparency entry: 975325723
- Sigstore integration time:
-
Permalink:
10U-Labs/assert-no-inline-directives@5c8c3ae514d44196a16ec684327e9b71b7604e26 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/10U-Labs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@5c8c3ae514d44196a16ec684327e9b71b7604e26 -
Trigger Event:
push
-
Statement type:
File details
Details for the file assert_no_inline_directives-20260221023510-py3-none-any.whl.
File metadata
- Download URL: assert_no_inline_directives-20260221023510-py3-none-any.whl
- Upload date:
- Size: 14.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8417b3d08905fb86f230f6d5f1a1d2c9abe2c7a08abc0c18b518b9f9df734dc8
|
|
| MD5 |
d9160252bb5df0cbf9205cc1ba2348f2
|
|
| BLAKE2b-256 |
1ef88f46fbaa32456de63c2433606fde5dc721f68317c0e3c723444c0ceccfc9
|
Provenance
The following attestation bundles were made for assert_no_inline_directives-20260221023510-py3-none-any.whl:
Publisher:
ci.yml on 10U-Labs/assert-no-inline-directives
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
assert_no_inline_directives-20260221023510-py3-none-any.whl -
Subject digest:
8417b3d08905fb86f230f6d5f1a1d2c9abe2c7a08abc0c18b518b9f9df734dc8 - Sigstore transparency entry: 975325724
- Sigstore integration time:
-
Permalink:
10U-Labs/assert-no-inline-directives@5c8c3ae514d44196a16ec684327e9b71b7604e26 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/10U-Labs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@5c8c3ae514d44196a16ec684327e9b71b7604e26 -
Trigger Event:
push
-
Statement type: