colint
colint is an MIT-licensed Rust command-line linter for opinionated Python
code reviews. It parses Python with Tree-sitter, so diagnostics include stable
source locations even for multiline expressions.
Install
Once published, install the ColinKennedy PyPI distribution with:
python -m pip install colint
cargo run -- path\to\project
cargo run -- --strict --json src
cargo run -- --include-header src
Contributors can run the same quality gates as CI with cargo fmt --check,
cargo clippy --all-targets -- -D warnings, and cargo test --all-targets.
Rules have stable codes in the GRP-NNN form, grouped by check category
(API, DOC, STY, GUI — see Checks below). A line may
suppress all findings
with # noqa, or selected findings with # noqa: STY-001,API-005 or
# colint: ignore[STY-001,API-005]. Rule names work too, e.g.
# colint: ignore[nested-import], and both forms may be mixed in the same
list. Codes are matched case-insensitively and spacing is flexible
(#colint:ignore[ sty-001 ]). # noqa: E501, which names only another
linter's codes, does not suppress colint findings. Suppressions must be real
comments on the finding's first line; text inside a string literal is ignored.
For a nested import (STY-001), use # NOTE: reason immediately above the
import or contiguous import group; blank lines do not split that group. Use
this NOTE form for any intentional nested import, especially generated code.
Pass --include-header to prepend this suppression guidance to ordinary
human-readable output. The header is not included by default and is never
included in --json output.
The complete agreed rule and behavior contract is in DESIGN.md.
Checks
Rule codes are grouped by check category. Each group's number restarts at 1.
API — Function Design & Correctness
| Code | Rule | Severity | Justification |
|---|---|---|---|
| API-001 | predicate-in-function | warning | A conditional no-op hides control flow the caller should own. |
| API-002 | loft-from-caller | warning | Passing a whole object hides the one value the callee needs. |
| API-003 | redundant-type-hint | error | A duplicated annotation can silently drift from the real type. |
| API-004 | empty-string-return | error | An empty string return is easily confused with a real value. |
| API-005 | assert-in-production | error | python -O strips asserts, silently disabling the check. |
| API-006 | none-polymorphism | warning | Treating None as falsy avoids a second, redundant check. |
DOC — Documentation
| Code | Rule | Severity | Justification |
|---|---|---|---|
| DOC-001 | docstring-convention | warning | Inconsistent parameter markup breaks generated documentation. |
| DOC-002 | direct-raises-only | error | Documenting inherited raises hides which errors this call owns. |
STY — Style & Organization
| Code | Rule | Severity | Justification |
|---|---|---|---|
| STY-001 | nested-import | error | Nested imports hide dependencies and cost every call to reload. |
| STY-002 | pytest-expected-left | warning | Expected-first assertions give clearer, consistent failures. |
| STY-003 | logging-dynamic-quote | warning | Unquoted placeholders hide whitespace or empty values in logs. |
| STY-004 | module-order | warning | A fixed layout makes every module easier to scan and navigate. |
GUI — Qt/PySide Widgets
| Code | Rule | Severity | Justification |
|---|---|---|---|
| GUI-001 | widget-tooltip | warning | A missing tooltip leaves users without in-app guidance. |
| GUI-002 | qt-model-parent | error | Without a parent, Qt cannot manage the model's lifetime. |
Rule details
- Test code (API-005 allows
assert, STY-002 applies) is a file namedtest_*.py,*_test.py,test.py,tests.py, orconftest.py, or any file below atest,tests, ortestingdirectory. Names that merely contain "test", such aslatest.pyorcontest/, are production code. - API-001 reports a function whose first statement (after any docstring)
is an
ifwithoutelif/elsewhose only body statement isreturn. - API-002 counts real references to each parameter (not text in strings
or comments) and handles defaults, annotations, and multi-line calls when
naming the consumer. Methods decorated with
@overrideare skipped because their signatures are fixed by the base class. - API-003 compares annotations ignoring whitespace, comments, trailing
commas, and quoting.
self.method()/cls.method()calls are compared with methods; plain calls with functions.awaitis unwrapped. - API-004 recognizes any empty
strliteral ("",'',u"",r"", ``, parenthesized or implicitly concatenated) and ignores returns in nested functions.Optional[...]/`Union[..., None]` count as including `None`. - API-006 reports
x is None/x is not Noneinif/elifconditions whenxis a parameter or annotated local declaredX | None,None | X,Optional[X], orUnion[X, None]. - DOC-001 checks the function's own docstring (including raw strings) for
*parameter*or**parameter**markup. - DOC-002 reads the Google-style
Raises:section of the function's own docstring and reports each documented exception that the function does not raise directly. A bareraisere-raises the enclosingexcepttypes, and a documented base class covers a raised subclass defined in the same module. - STY-001 applies only inside functions and classes; module-level
if TYPE_CHECKING:andtry:/except ImportError:imports are not nested. A justification comment must start withNOTE(any case). - STY-003 checks the message argument of
debug/info/warning/error/exception/critical/logcalls onlogging,logger,log,LOGGER,self._log,logging.getLogger(...), and similar receivers.%sand%(name)smust be wrapped in matching quotes;%ralready shows quotes, and%%is a literal percent sign. - STY-004 expects globals, then classes, then functions. Decorated
definitions are classified by what they decorate, comments are ignored, and
an
if __name__ == "__main__":block may close the module. - GUI-001 reports each widget assignment (named
*Widget,*Button,*Label,*ComboBox, or a localQWidgetsubclass) that has no reachablesetToolTip(...)and no non-emptytoolTip=keyword. Within a class, every method reachable throughself.calls from, or leading to, the constructing method counts. A# no tooltip: reasoncomment exempts the scope. - GUI-002 treats
parent=selfor any non-literal positional argument as a parent. Constructing a project model subclass also requires a parent. Subclass initializers may forwardparentby position, keyword,*args/**kwargs,super(Class, self).__init__, orBase.__init__(self, ...).
Configuration
Create .colint.toml in the working directory (or a parent directory):
warnings_as_errors = false
docstring_convention = "mkdocs"
# API-002 skips private definitions by default. Private means an underscore-
# prefixed function or method, or any member of an underscore-prefixed class.
api002_skip_private_definitions = true
# Additional Python package roots used to resolve imported Qt model/proxy bases.
# Relative paths are resolved from this configuration file.
import_paths = ["../shared-python", "C:/work/company-python"]
[rules]
STY-001 = true
GUI-001 = false
Every rule is enabled by default. --strict enables every rule regardless of
configuration and treats warnings as errors. Exit status is 0 for clean runs
and ordinary warnings, 1 for warnings escalated to errors, and 2 whenever
an error-level finding exists.
docstring_convention = "mkdocs" enables the MkDocs parameter-markup check.
api002_skip_private_definitions = false makes API-002 lint private functions,
methods, and class members too.
import_paths supplements PYTHONPATH when GUI-002 resolves imported
project classes. These roots are used for inheritance discovery only; colint
does not emit findings for files that were loaded solely from an import path.
Metadata
Release files for colint 0.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| colint-0.6.0.tar.gz | 44.8 kB | With provenance | Details for colint-0.6.0.tar.gz |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| colint-0.6.0-py3-none-win_amd64.whl | Python 3 | none | Windows x86-64 | Details for colint-0.6.0-py3-none-win_amd64.whl |
| colint-0.6.0-py3-none-manylinux_2_34_x86_64.whl | Python 3 | none | Linux glibc 2.34+ x86-64 | Details for colint-0.6.0-py3-none-manylinux_2_34_x86_64.whl |
| colint-0.6.0-py3-none-macosx_11_0_arm64.whl | Python 3 | none | macOS 11.0+ ARM64 | Details for colint-0.6.0-py3-none-macosx_11_0_arm64.whl |
Total release size: 4.0 MB
Release files / colint-0.6.0.tar.gz
| Download URL | colint-0.6.0.tar.gz |
|---|---|
| Size | 44.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e7162b34ade8706908d72befc183ac9c75a4d03d369062e5107e9eb088362738
|
|
BLAKE2b-256 checksum How to use checksums |
2f4f5e322c1d5a6c7aa697a746d9590052c45691e83333cd1ade2f4cc16eb46e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 4, 2026.
Transparency logRelease files / colint-0.6.0-py3-none-win_amd64.whl
| Download URL | colint-0.6.0-py3-none-win_amd64.whl |
|---|---|
| Size | 1.3 MB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
9c081ff592f363c43c4b26959abea97f729ac9d4f73fac000be89587b3297cdb
|
|
BLAKE2b-256 checksum How to use checksums |
397e24fcf3c7075cce6b1e97182914005e1f2da72a79ce6882ead369de3dab4a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 4, 2026.
Transparency logRelease files / colint-0.6.0-py3-none-manylinux_2_34_x86_64.whl
| Download URL | colint-0.6.0-py3-none-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | Linux glibc 2.34+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
2afd6f73085f1eed3bd85e98557dc72c98da6718034f88618793afd1660ffff9
|
|
BLAKE2b-256 checksum How to use checksums |
4ca7db51ac4fa74344194feb6a3d28a51ae73dbb0517e4f5c45fc8295fff4750
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 4, 2026.
Transparency logRelease files / colint-0.6.0-py3-none-macosx_11_0_arm64.whl
| Download URL | colint-0.6.0-py3-none-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.3 MB |
| Tags | Python 3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
7ab4d8dba17fc76f84a6db068c28e78c09d4df0ef2c2ff0cc0316eedccf67b40
|
|
BLAKE2b-256 checksum How to use checksums |
50ae90801f9cb7225cb3de182cbae478d50eac51630917a5007074d26362e7f1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 4, 2026.
Transparency logSecurity for colint 0.6.0
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 4 files in this release have been uploaded with provenance metadata.
Attestation for colint-0.6.0.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 Oct 4, 2026.
Transparency logA 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.