RulesΒΆ
Each rule below reports a pattern that makes code harder to read or review, and most can fix it.
Filter the table by code, name or description, or narrow it to a group or to rules with a fix.
The address bar keeps the filter, so you can share a filtered view as a link.
To choose which rules run, see Choose which rules run and fix.
108 rules
| Code | Name | Checks | Fix | Cross-file |
|---|---|---|---|---|
| Comments | ||||
| SMP001 | section-comment | Comments used as dividers or section headers | π οΈ | β |
| SMP002 | long-paragraph | Comment paragraphs over the word limit | β | |
| SMP003 | suppression-without-reason | noqa, type: ignore and pragma comments with no reason | β | |
| SMP004 | blanket-ignore | Suppression comments that name no error code | β | |
| SMP005 | restating-comment | Comments that only repeat the code below | π οΈ | β |
| SMP006 | string-statement-comment | Bare strings used as comments instead of # comments | π§ | β |
| SMP007 | long-comment-line | Comment and docstring lines over the line length | π οΈ | β |
| Naming | ||||
| SMP101 | single-letter-name | Single-letter names outside comprehensions | β | |
| SMP102 | module-variable-case | Module variables not UPPER_CASE | π§ | β |
| SMP103 | meaningless-name | Variables, parameters and attributes named with a word that says nothing | β | |
| SMP104 | catch-all-module | Modules and packages named for a grab bag of code | β | |
| Module layout | ||||
| SMP201 | definition-before-use | Helpers defined above their first caller, or away from it | π§ | β |
| SMP202 | single-user-constant | Module constants only one function uses | π§ | β |
| SMP203 | class-member-order | Class members defined out of section order, such as a constructor below a method | π§ | β |
| Imports and dependencies | ||||
| SMP301 | future-annotations | from __future__ import annotations on Python 3.14+ | π§ | β |
| SMP302 | absolute-sibling-import | Absolute imports from the same package | π οΈ | β |
| SMP303 | dependency-import-guard | try/except ImportError around a required dependency | π§ | β |
| SMP304 | module-attribute-import | Module attributes reached as module.Name instead of imported | π§ | β |
| SMP305 | up-backport-import | Imports of backports that the standard library replaces | π§ | β |
| SMP306 | up-type-checking-lazy-import | if TYPE_CHECKING: imports that can be lazy imports | π§ | β |
| SMP307 | up-lazy-modules-list | __lazy_modules__ lists that lazy imports replace | π§ | β |
| SMP308 | import-cycle | Runtime imports that close a cycle between modules | β | |
| SMP309 | star-import | import * of a module the project defines, which names can be imported one by one | π§ | β |
| Public API | ||||
| SMP401 | missing-from-all | Names other modules import that __all__ omits | π§ | β |
| SMP402 | unused-export | __all__ entries no other module imports | π§ | β |
| SMP403 | unexported-public-name | Public functions and classes missing from __all__ | π§ | β |
| SMP404 | module-variable-prefix | Module variables whose leading _ does not match their visibility | π§ | β |
| SMP405 | all-format | __all__ not a list with a trailing comma | π οΈ | β |
| SMP406 | all-not-last | __all__ not at the end of the module | π§ | β |
| SMP407 | init-module-content | __init__.py holding more than a docstring | β | |
| SMP408 | test-only-code | Module-level functions and classes only test modules use | β | |
| SMP409 | unused-definition | Functions, classes, methods and class attributes nothing in the run uses | β | |
| SMP410 | test-only-parameter | Parameters only test calls pass, which production calls leave at their default | β | |
| SMP411 | unused-return-value | Return values no production call reads | β | |
| Logic | ||||
| SMP501 | forwarding-function | Private functions that only forward to another call | β | |
| SMP502 | walrus-candidate | An assignment the next if test could absorb with := | π οΈ | β |
| SMP503 | string-concatenation | + between strings | π§ | β |
| SMP504 | single-use-variable | Variables read once, right below their assignment | π οΈ | β |
| SMP505 | single-caller-helper | Private helpers with one short call site, which inlining would keep short | β | |
| SMP506 | unused-default | Parameter defaults that every call passes explicitly | π§ | β |
| SMP507 | error-message-matching | Exceptions told apart by their message text | β | |
| SMP508 | up-comprehension-unpacking | Nested for clauses that only unpack their iterable into the element | π οΈ | β |
| SMP509 | up-traceback-exception-arguments | traceback calls that pass an exception's type and traceback next to it | π οΈ | β |
| SMP510 | up-exc-info-exception | sys.exc_info() reads of the exception being handled | π οΈ | β |
| SMP511 | up-object-sentinel | object() placeholders sentinel would name | π οΈ | β |
| SMP512 | up-context-var-token-reset | ContextVar.set() tokens reset in a finally block | π§ | β |
| SMP513 | up-chdir-restore | Working directories restored in a finally block | π§ | β |
| SMP514 | up-strptime-date | datetime.strptime() results narrowed to a date or time | π§ | β |
| SMP515 | up-event-loop-in-coroutine | asyncio.get_event_loop() calls in coroutines | π§ | β |
| SMP516 | up-asyncio-iscoroutinefunction | asyncio.iscoroutinefunction() calls | π§ | β |
| SMP517 | up-codecs-open | codecs.open() calls | π§ | β |
| SMP518 | up-re-error-alias | re.error references | π οΈ | β |
| SMP519 | up-argparse-suggest-on-error | suggest_on_error=True in ArgumentParser() calls | π§ | β |
| SMP520 | up-removed-ast-node | ast node aliases and visitor methods Python 3.14 removed | π§ | β |
| SMP521 | up-utf8-encoding-default | UTF-8 encoding arguments that Python 3.15 makes the default | π§ | β |
| SMP522 | up-re-prefixmatch | re.match() calls that re.prefixmatch() names | π οΈ | β |
| SMP523 | up-compression-modules | gzip, bz2, lzma and zlib imports that compression names | π§ | β |
| SMP524 | up-warnings-deprecated | Functions and classes that warn with DeprecationWarning where @warnings.deprecated marks them | π§ | β |
| SMP525 | up-deprecated-stdlib-alias | Deprecated standard library names that have a replacement | π§ | β |
| SMP526 | early-assignment | Constants assigned well above their first use | π§ | β |
| SMP527 | super-forwarding-method | Methods that only return the parent's method called with their own arguments | π§ | β |
| SMP528 | long-tuple-return | Functions returning tuples too long to unpack by position | β | |
| SMP529 | cognitive-complexity | Functions whose cognitive complexity is over the limit | β | |
| SMP530 | duplicate-code | Statements that another module repeats | β | |
| SMP531 | collection-built-by-statements | Empty collections filled by the statements right after them | π§ | β |
| SMP532 | unnamed-regex-group | Regular expressions with unnamed capture groups | π§ | β |
| SMP533 | unexplained-regex | Regular expressions with four or more parts and no comments | β | |
| Typing | ||||
| SMP601 | missing-final | Module constants not annotated Final | π§ | β |
| SMP602 | imprecise-annotation | object and Any in annotations | β | |
| SMP603 | callable-ellipsis | Callable[..., T] | β | |
| SMP604 | vars-call | vars() calls | β | |
| Classes | ||||
| SMP701 | dataclass-frozen | Dataclasses without frozen | π οΈ | β |
| SMP702 | dataclass-slots | Dataclasses without slots | π οΈ | β |
| SMP703 | dataclass-kw-only | Dataclasses without kw_only | π οΈ | β |
| SMP704 | indistinct-error-class | Exception classes no handler catches by name | β | |
| Tests | ||||
| SMP801 | test-class | Test classes | π§ | β |
| SMP802 | parametrize-without-id | parametrize rows without pytest.param(..., id=...) | β | |
| SMP803 | conditional-in-test | if, match and conditional expressions in tests | β | |
| SMP804 | constant-assert | Assertions on a truthy constant | π§ | β |
| SMP805 | mock-attribute-assignment | Mock attributes assigned after construction | π§ | β |
| SMP806 | mock-without-spec | Mocks and patches without a spec | β | |
| SMP807 | split-composite-assert | Consecutive asserts comparing fields of one object | π§ | β |
| SMP808 | sleep-in-test | time.sleep and asyncio.sleep calls in tests | β | |
| SMP809 | stdlib-mock | unittest.mock imports in projects that depend on pytest-mock | β | |
| SMP811 | up-unittest-assert-helper | assertTrue and assertFalse on checks that TestCase has a helper for | π§ | β |
| SMP812 | up-unittest-enter-context | Patches started and stopped by hand in TestCase methods | π§ | β |
| SMP813 | loop-in-test | Loops in tests that assert over a table of cases | β | |
| SMP814 | mock-assertion-typo | Mock assertion methods misspelled or missing their assert_ prefix | π οΈ | β |
| SMP815 | unused-fixture | Pytest fixtures no test or fixture requests | β | |
| Docstrings | ||||
| SMP901 | function-docstring | Docstrings on internal functions and classes | π§ | β |
| SMP902 | test-module-docstring | Docstrings on test modules | π§ | β |
| SMP903 | undocumented-public-api | Public functions, classes, methods and variables without documentation | β | |
| SMP904 | long-docstring-paragraph | Docstring paragraphs over the word limit | β | |
| SMP910 | rst-field-syntax | Malformed or misplaced reStructuredText docstring fields | π§ | β |
| SMP911 | rst-inline-markup | Roles without backticks and unclosed inline literals | π§ | β |
| SMP912 | rst-type-field | Types in docstrings, which belong in annotations | π§ | β |
| SMP913 | rst-restating-field | Field descriptions that only repeat the name | β | |
| SMP914 | rst-empty-field | Fields with no description | β | |
| SMP915 | rst-private-field | Public docstrings documenting internal names | π§ | β |
| SMP916 | rst-missing-param | Public API docstrings that leave a parameter undocumented | β | |
| SMP917 | rst-unknown-param | :param: and :type: fields for parameters the signature lacks | π§ | β |
| SMP918 | rst-duplicate-param | Constructor parameters documented in both the class and __init__ docstrings | π§ | β |
| SMP919 | rst-param-order | :param: fields out of the signature's order | β | |
| SMP920 | rst-missing-attribute | Public classes whose docstring leaves an attribute undocumented | β | |
| SMP921 | rst-unknown-attribute | :ivar:, :cvar: and :var: fields for attributes the class lacks | π§ | β |
| SMP922 | rst-attribute-kind | :ivar: on class variables and :cvar: on instance attributes | π§ | β |
| SMP923 | rst-returns | Missing, extraneous or misused :returns: and :yields: fields | π§ | β |
| SMP924 | rst-missing-raises | Public API docstrings that leave a raised exception undocumented | β | |
No rule matches these filters.
Rules marked β under Cross-file read other files of the run; How simplint works explains how. Which fixes count as safe is under Fix safety.