Skip to main content

sarj-python-lint

Custom Python lint rules — AST-based, pre-commit-friendly, hypermodern defaults

Package metadata

Field Value
Version 0.59.0
Registry PyPI
License MIT
Runtime Python >=3.14

Command-line reference

Command Entrypoint Help
sarj-python-lint sarj_python_lint.__main__:main sarj-python-lint --help
sarj-ratchet sarj_python_lint._ratchet_cli:main sarj-ratchet --help

Rule catalog

Rule Summary Default Autofix
python:conditional-assertion-in-test Tests should guarantee that at least one assertion runs on every execution path. error none
python:defect-xfail-requires-strict Bug-pinning xfail without strict=True — an XPASS reports as a pass and the pin rots. error none
python:docstring-args-restate-signature Argument documentation must add facts beyond the function signature. error none
python:docstring-returns-restate-signature Return documentation must add facts beyond the function name and annotation. error none
python:duplicate-test-body Similar test bodies should be represented as one named parameterized case table. error none
python:duplicated-override-docstring Remove an override docstring copied verbatim from its local base method. error none
python:fastapi-openapi-contract FastAPI operations must publish explicit request, response, and OpenAPI contracts. error none
python:fixture-returns-bare-tuple Fixture returns a bare multi-field tuple — return a NamedTuple so consumers destructure by name. error none
python:interaction-only-test Tests should verify outcomes, not only mock interaction bookkeeping. error none
python:invalid-pydantic-field-default Require literal Pydantic Field defaults to satisfy their declared contract. error none
python:kwarg-heavy-construction-in-test Object built with many keywords inline in a test — extract a helper with defaults. error none
python:mock-without-spec Mock built without spec=/autospec= — it accepts any attribute and cannot rot loudly. error none
python:no-aggregation-in-store-query Postgres store queries should not perform analytical aggregation. error none
python:no-comment-cruft Comment repeats code, preserves dead code, or adds a decorative section marker. error none
python:no-cors-wildcard-with-credentials Credentialed CORS must not allow a wildcard origin. error none
python:no-duplicate-dunder-all-entry static package __all__ declarations should list each exported name once error none
python:no-fat-try-blocks Keep a try body narrow enough to identify which operation a handler covers. error none
python:no-file-level-escape-hatch-noqa File-level Ruff noqa suppresses an escape-hatch rule across the entire file. error none
python:no-file-level-suppression Unscoped file-level suppressions disable a checker for the entire file, including diagnostics added later. error none
python:no-first-party-private-import Code imports a private name or module from another first-party package. error none
python:no-frozen-after-validator-field-write Do not assign declared fields in after-validators on frozen Pydantic models. error none
python:no-gen-random-uuid-in-sql Embedded SQL calls gen_random_uuid() instead of uuidv7(). error none
python:no-generic-single-export-module A generic module with one public definition should be named after that definition. error none
python:no-hidden-constructor-fallback Constructor option silently falls back to application settings when omitted. error none
python:no-isinstance-union-chain Use exhaustive pattern matching for dispatch over a local closed class union. error none
python:no-long-comment Long docstrings must use deliberate documentation structure or technical anchors. error none
python:no-offset-pagination Store queries should use keyset cursors instead of OFFSET pagination. error none
python:no-optional-tenant-predicate Tenant predicate is added only conditionally, allowing an unscoped query. error none
python:no-query-with-many-joins Store queries should use at most two explicit or implicit joins. error none
python:no-raw-sql-in-tests Tests should seed records through store or service methods instead of raw SQL inserts. error none
python:no-repeated-string-literal Structured string literals repeated across functions should use a module constant. error none
python:no-restated-comment Comment restates the statement immediately below it. error suggestion
python:no-secret-in-log Secret-like value is passed to a logging call under a secret-like keyword. error none
python:no-select-star Store queries should select explicit columns instead of *. error none
python:no-sentinel-return-on-except Exception handler silently converts a failure into a sentinel return value. error none
python:no-sleep-in-test-body Tests should synchronize on observable state instead of waiting a fixed duration. error none
python:no-stdlib-logging Application code imports standard-library logging instead of the configured house logger. error none
python:no-string-concat-in-loop Do not grow one string with repeated concatenation inside a loop. error none
python:no-tautological-expect Assertion outcome is fixed entirely by literal values. error none
python:no-typed-doc-sections Docstring sections must not repeat types already present in a fully typed signature. error none
python:opaque-parametrize-case-needs-id Opaque parametrize case with no ids=/id= — the failing case reports as case0. error none
python:over-mocked-test Tests should not replace more than five distinct collaborators. error none
python:prefer-class-row Use a validated model row instead of Psycopg dict_row. error none
python:prefer-constant-time-secret-compare Secret-like values are compared with timing-sensitive equality operators. error none
python:prefer-fstring-over-concat Build short strings with f-strings instead of concatenating literals and known strings. error none
python:prefer-immutable-module-constant module-level constant collections expose mutable shared state; use tuple, frozenset, or an immutable mapping error none
python:prefer-library-fake Tests should use maintained service fakes or emulators instead of hand-rolled third-party doubles. error none
python:prefer-match-assert-never Closed-set dispatch should fail explicitly when a variant is unhandled. error none
python:prefer-match-type-dispatch Use match for explicit runtime type dispatch instead of branching parser machinery. error none
python:prefer-module-level-constant Literal-only collections and compiled regular expressions built inside a function should be module-level constants. error none
python:prefer-namedtuple-over-tuple-return Public functions should return named records instead of fixed positional tuples. error none
python:prefer-nominal-id-types Production boundaries with multiple ID roles must distinguish them with nominal types. error none
python:prefer-non-nullable-collection Avoid nullable list parameters when local use proves None and an empty list are equivalent. error none
python:prefer-or-pattern Merge adjacent case arms with identical bodies into one or-pattern. error none
python:prefer-real-store-in-tests Tests should exercise the real persistence implementation instead of an in-memory reimplementation. error none
python:prefer-self-documenting-constant Encode a constant's units or HTTP status meaning in its name, type, or value. error none
python:prefer-self-type-annotation Annotate fluent methods and alternate constructors with Self. error none
python:prefer-str-enum Represent corroborated closed string domains with StrEnum or a named Literal alias. error none
python:prefer-struct-over-namedtuple collections.namedtuple creates an untyped, positionally constructed record. error none
python:prefer-timedelta-for-durations Duration-bearing name is typed as a raw integer or float. error none
python:prefer-walrus-comprehension-filter Evaluate a repeated comprehension call once with a named expression. error none
python:prefer-walrus-regex-match Bind a regex result in the if condition that immediately tests it. error none
python:prefer-walrus-stream-loop Bind each stream value in the while condition instead of using an explicit break. error none
python:pydantic-at-boundaries Public function or route returns a fixed-shape untyped dictionary. error none
python:redundant-class-docstring Class docstrings must add information beyond the class name and bases. error none
python:redundant-docstring Docstring only restates the signature — delete the whole docstring or document behavior callers cannot infer. error suggestion
python:redundant-module-docstring Module docstrings must add information beyond the file path. error none
python:require-keyword-only-swap-prone-params Swap-prone parameters with the same primitive type should be keyword-only. error none
python:require-port-for-service Consider a consumer-owned port for a service with a behaviorally used collaborator. error none
python:restated-test-docstring Test docstrings must add information beyond the test name and body. error none
python:sleep-with-computed-arg-in-test Computed sleep() in a test body — synchronize on the signal, don't guess a delay. error none
python:stepdown A private helper used by one caller should be defined below that caller. error none
python:store-insert-requires-on-conflict Embedded SQL inserts in store code must handle conflicts explicitly. error none
python:test-loops-over-literal-cases Test loops over a literal case table — use @pytest.mark.parametrize so cases report separately. error none
python:test-phase-label-comment Tests must not use bare Arrange, Act, Assert, Given, When, or Then phase comments. error none
python:trailing-value-narration Trailing comment restates a literal value and its unit. error suggestion
python:trivially-true-assertion Assertions should depend on behavior rather than echoing values supplied by the test. error none
python:unused-mock-setup Tests should remove mock configuration that cannot affect execution. error none
python:zero-assertion-test Test contains no assertion of any kind — it passes as long as nothing raises. error none

Project links

Package metadata is generated from pyproject.toml.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sarj_python_lint-0.59.0-py3-none-any.whl (364.4 kB view details)

Uploaded Python 3

File details

Details for the file sarj_python_lint-0.59.0-py3-none-any.whl.

File metadata

File hashes

Hashes for sarj_python_lint-0.59.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d1f24229ded446ba96237cd827f38a0dd9e2bae5fb60c014e27138f619d8fd26
MD5 00d33a7a279d65e4ec2cecbde9f044b1
BLAKE2b-256 1fbb92447649f3ba1cf55b7b84e2ec48eaf2d75e671b02f1eab2ed69ffcf7b56

See more details on using hashes here.

Provenance

The following attestation bundles were made for sarj_python_lint-0.59.0-py3-none-any.whl:

Publisher: release.yml on sarj-ai/standards

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.77.1

2 files

0.77.0

2 files

0.76.0

2 files

0.75.0

2 files

0.74.0

2 files

0.73.2

2 files

0.73.1

2 files

0.73.0

2 files

0.72.0

2 files

0.71.0

2 files

0.70.1

2 files

0.70.0

2 files

0.69.1

2 files

0.69.0

2 files

0.68.0

2 files

0.67.14

2 files

0.67.13

2 files

0.67.12

2 files

0.67.11

2 files

0.67.10

2 files

0.67.9

2 files

0.67.8

2 files

0.67.7

2 files

0.67.6

2 files

0.67.5

2 files

0.67.4

2 files

0.67.3

2 files

0.67.2

2 files

0.67.0

1 file

0.66.0

1 file

0.65.0

1 file

0.64.0

1 file

0.63.0

1 file

0.62.0

1 file

0.61.0

1 file

0.60.0

1 file

This release

0.59.0 This release

1 file

0.58.0

1 file

0.57.0

1 file

0.56.0

1 file

0.55.0

1 file

0.54.1

1 file

0.54.0

1 file

0.53.0

1 file

0.52.1

1 file

0.52.0

1 file

0.51.3

1 file

0.51.1

1 file

0.51.0

1 file

0.50.0

1 file

0.49.0

1 file

0.48.0

1 file

0.47.1

1 file

0.47.0

1 file

0.46.0

2 files

0.45.0

2 files

0.44.0

2 files

0.43.2

2 files

0.43.0

2 files

0.42.0

2 files

0.41.0

2 files

0.40.0

2 files

0.39.0

2 files

0.38.0

2 files

0.37.0

2 files

0.36.1

2 files

0.36.0

2 files

0.35.0

2 files

0.34.0

2 files

0.33.0

2 files

0.32.0

2 files

0.31.0

2 files

0.30.0

2 files

0.29.0

2 files

0.28.0

2 files

0.27.0

2 files

0.26.0

2 files

0.25.0

2 files

0.24.0

2 files

0.23.0

2 files

0.21.0

2 files

0.20.0

2 files

0.19.0

2 files

0.18.1

2 files

0.18.0

2 files

0.17.0

2 files

0.16.0

2 files

0.15.1

2 files

0.15.0

2 files

0.14.0

2 files

0.13.1

2 files

0.12.2

2 files

0.12.1

2 files

0.12.0

2 files

0.11.1

2 files

0.11.0

2 files

0.10.1

2 files

0.10.0

2 files

0.9.0

2 files

0.8.0

2 files

0.7.0

2 files

0.6.0

2 files

0.5.0

2 files

0.4.1

2 files

0.4.0

2 files

0.3.0

2 files

0.2.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page