Rude Clean Code
Clean Code plugin for the Rude Python linter,
exposing 59 Clean Code rules across module structure, functions, classes,
complexity, error handling, naming/literals, same-file DRY, SOLID/coupling
indicators, config-driven architecture and pattern boundaries, and
documentation/comment hygiene (CC001–CC910) through Rude's rude.plugins
entry point.
Quickstart
Install alongside Rude (discovered automatically via rude.plugins):
pip install rude-clean-code
Configure profiles and rule options in pyproject.toml:
[tool.rude]
# Basic (CC0-CC3), Strict heuristics (CC4-CC6), and opt-in Architecture (CC7-CC8)
select = ["CC0", "CC1", "CC2", "CC3"]
[tool.rude.rules.CC101]
max_lines = 30
# Optional architecture rules remain inert until you declare your own paths:
[[tool.rude.rules.CC704.forbidden]]
from_paths = ["src/myapp/domain/"]
forbidden_modules = ["sqlalchemy", "myapp.infra"]
Run Rude from the command line:
rude check --select CC0,CC1,CC2,CC3 src/
Working principles
- Own-scope isolation: Function and class metrics (
CC101–CC104,CC202,CC301–CC303,CC310,CC601) never leak nested functions, classes, or lambdas into an enclosing scope. - No unsafe autofixes: Rules report measured values, limits, and remediation hints rather than rewriting business logic.
- Explicit severity split: Deterministic, structural, boundary, and doc
hygiene rules emit
WARNING(CC002andCC805emitINFO), while subjective smell and comment indicators (CC105–CC106,CC108,CC204–CC206,CC304–CC305,CC307,CC401–CC402,CC503,CC601–CC605,CC902,CC904experimental,CC909) emitINFO. - Inert opt-in architecture checks:
CC7xxandCC8xxemit zero diagnostics unless configured with your modules, classes, and layer paths.
Implemented rules
- Modules (
CC0xx):CC001(max_lines = 400),CC002(__init__.pycontains runtime logic),CC003(__init__.pymissing__all__),CC004(deep relative import,max_relative_depth = 2),CC005(private symbol exported in__all__) - Functions (
CC1xx):CC101(max_lines = 30),CC102(max_parameters = 5),CC103(max_returns = 5),CC104(max_locals = 10),CC105(boolean flag parameter,INFO),CC106(unused parameter,INFO),CC107(unused private helper),CC108(data clump in signatures,INFO) - Classes (
CC2xx):CC201(max_lines = 200),CC202(max_methods = 15),CC204(max_dependencies = 5,INFO),CC205(disjoint responsibility clusters,INFO),CC206(max_public_methods = 10,INFO),CC207(max_bases = 3) - Complexity and error handling (
CC3xx):CC301(max_depth = 4),CC302(max_operands = 3),CC303(max_branches = 10),CC304(complex expression,INFO),CC305(single-impl abstraction,INFO),CC306(nested ternary),CC307(inverted conditional withelse,INFO),CC308(globalstatement),CC309(broad exception swallowed),CC310(missing exception chaining),CC311(max_lines = 20) - In-file heuristics (
CC4xx–CC6xx, Strict profile):CC401(unclear function name),CC402(unclear class/variable name),CC403(repeated magic literal,min_occurrences = 3),CC501(duplicate function body within the same file,min_lines = 5; cross-file duplication is planned asCC502),CC503(repeated validation guards,INFO),CC504(repeated file-scope constants,WARNING),CC601(repeated type switch,INFO),CC602(suspicious override,INFO),CC603(ISP indicator,INFO),CC604(chained access,INFO),CC605(external private member access,INFO) - Architecture and dependencies (
CC7xx, opt-in config):CC701(forbidden concrete imports),CC702(concrete instantiation in domain code),CC704(general forbidden layer dependencies) - Design-pattern boundaries (
CC8xx, opt-in config):CC801(data access outside repository layer),CC802(product instantiated outside factory),CC803(strategy class violating protocol),CC804(handler missing registration decorator),CC805(concrete service construction bypassing dependency injection,INFO) - Documentation and comments (
CC9xx):CC901(public API missing docstring),CC902(commented-out code,INFO),CC903(TODO/FIXME without reference, expiry, or forbidden markers),CC904(comment restating code, experimentalINFO),CC905(empty TODO),CC906(blanket or unexplained suppressions),CC907(placeholder docstring),CC908(docstring parameter drift),CC909(docstring return/yield mismatch,INFO),CC910(dangling body string literal)
The package initializer rude_clean_code exposes only VERSION (read from
installed distribution metadata); plugin rules live in rude_clean_code.plugin.
See the repository README and rule reference for full detection contracts, configuration options, and the backlog roadmap.
Metadata
Release files for rude-clean-code 0.3.1
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 |
|---|---|---|---|---|
| rude_clean_code-0.3.1.tar.gz | 84.5 kB | With provenance | Details for rude_clean_code-0.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rude_clean_code-0.3.1-py3-none-any.whl | Python 3 | none | any | Details for rude_clean_code-0.3.1-py3-none-any.whl |
Total release size: 157.9 kB
Release files / rude_clean_code-0.3.1.tar.gz
| Download URL | rude_clean_code-0.3.1.tar.gz |
|---|---|
| Size | 84.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0de28fe73a30820d142e577b828c8a4eaa3ec90aaf2119a3627bc6c930f1d61f
|
|
BLAKE2b-256 checksum How to use checksums |
54187ee6c95aef559ee762052cd8b4acccad3d1c65a7914212b3863ea97a3563
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.17
|
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 Nov 11, 2026.
Transparency logRelease files / rude_clean_code-0.3.1-py3-none-any.whl
| Download URL | rude_clean_code-0.3.1-py3-none-any.whl |
|---|---|
| Size | 73.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a1b2dcad757fa4bebdc466e428b28ec74357e01275880c0bcba5b4bc4676c11d
|
|
BLAKE2b-256 checksum How to use checksums |
5750a8c020dc7c6ef768b1daf4fbfb78ea23031dfda47728eb8e26f9b233506a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.17
|
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 Nov 11, 2026.
Transparency logSecurity for rude-clean-code 0.3.1
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
Both files in this release have been uploaded with provenance metadata.
Attestation for rude_clean_code-0.3.1.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 Nov 11, 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.