sarj-python-lint 0.12.1__tar.gz → 0.12.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sarj_python_lint-0.12.1 → sarj_python_lint-0.12.2}/PKG-INFO +1 -1
- {sarj_python_lint-0.12.1 → sarj_python_lint-0.12.2}/pyproject.toml +1 -1
- {sarj_python_lint-0.12.1 → sarj_python_lint-0.12.2}/src/sarj_python_lint/rules/no_comment_cruft.py +35 -0
- {sarj_python_lint-0.12.1 → sarj_python_lint-0.12.2}/.gitignore +0 -0
- {sarj_python_lint-0.12.1 → sarj_python_lint-0.12.2}/README.md +0 -0
- {sarj_python_lint-0.12.1 → sarj_python_lint-0.12.2}/src/sarj_python_lint/__init__.py +0 -0
- {sarj_python_lint-0.12.1 → sarj_python_lint-0.12.2}/src/sarj_python_lint/__main__.py +0 -0
- {sarj_python_lint-0.12.1 → sarj_python_lint-0.12.2}/src/sarj_python_lint/_secret_names.py +0 -0
- {sarj_python_lint-0.12.1 → sarj_python_lint-0.12.2}/src/sarj_python_lint/_version.py +0 -0
- {sarj_python_lint-0.12.1 → sarj_python_lint-0.12.2}/src/sarj_python_lint/py.typed +0 -0
- {sarj_python_lint-0.12.1 → sarj_python_lint-0.12.2}/src/sarj_python_lint/rule_base.py +0 -0
- {sarj_python_lint-0.12.1 → sarj_python_lint-0.12.2}/src/sarj_python_lint/rules/__init__.py +0 -0
- {sarj_python_lint-0.12.1 → sarj_python_lint-0.12.2}/src/sarj_python_lint/rules/_logging.py +0 -0
- {sarj_python_lint-0.12.1 → sarj_python_lint-0.12.2}/src/sarj_python_lint/rules/_registry.py +0 -0
- {sarj_python_lint-0.12.1 → sarj_python_lint-0.12.2}/src/sarj_python_lint/rules/_sql.py +0 -0
- {sarj_python_lint-0.12.1 → sarj_python_lint-0.12.2}/src/sarj_python_lint/rules/inefficient_string_concat_in_loop.py +0 -0
- {sarj_python_lint-0.12.1 → sarj_python_lint-0.12.2}/src/sarj_python_lint/rules/no_aggregation_in_store_query.py +0 -0
- {sarj_python_lint-0.12.1 → sarj_python_lint-0.12.2}/src/sarj_python_lint/rules/no_cors_wildcard_with_credentials.py +0 -0
- {sarj_python_lint-0.12.1 → sarj_python_lint-0.12.2}/src/sarj_python_lint/rules/no_fat_try_blocks.py +0 -0
- {sarj_python_lint-0.12.1 → sarj_python_lint-0.12.2}/src/sarj_python_lint/rules/no_fstring_in_log.py +0 -0
- {sarj_python_lint-0.12.1 → sarj_python_lint-0.12.2}/src/sarj_python_lint/rules/no_isinstance_union_chain.py +0 -0
- {sarj_python_lint-0.12.1 → sarj_python_lint-0.12.2}/src/sarj_python_lint/rules/no_offset_pagination.py +0 -0
- {sarj_python_lint-0.12.1 → sarj_python_lint-0.12.2}/src/sarj_python_lint/rules/no_query_with_many_joins.py +0 -0
- {sarj_python_lint-0.12.1 → sarj_python_lint-0.12.2}/src/sarj_python_lint/rules/no_repeated_string_literal.py +0 -0
- {sarj_python_lint-0.12.1 → sarj_python_lint-0.12.2}/src/sarj_python_lint/rules/no_secret_in_log.py +0 -0
- {sarj_python_lint-0.12.1 → sarj_python_lint-0.12.2}/src/sarj_python_lint/rules/no_select_star.py +0 -0
- {sarj_python_lint-0.12.1 → sarj_python_lint-0.12.2}/src/sarj_python_lint/rules/no_sentinel_return_on_except.py +0 -0
- {sarj_python_lint-0.12.1 → sarj_python_lint-0.12.2}/src/sarj_python_lint/rules/no_sequential_await.py +0 -0
- {sarj_python_lint-0.12.1 → sarj_python_lint-0.12.2}/src/sarj_python_lint/rules/no_sleep_in_test_body.py +0 -0
- {sarj_python_lint-0.12.1 → sarj_python_lint-0.12.2}/src/sarj_python_lint/rules/no_unreachable_after_terminal.py +0 -0
- {sarj_python_lint-0.12.1 → sarj_python_lint-0.12.2}/src/sarj_python_lint/rules/prefer_class_row.py +0 -0
- {sarj_python_lint-0.12.1 → sarj_python_lint-0.12.2}/src/sarj_python_lint/rules/prefer_constant_time_secret_compare.py +0 -0
- {sarj_python_lint-0.12.1 → sarj_python_lint-0.12.2}/src/sarj_python_lint/rules/prefer_namedtuple_over_tuple_return.py +0 -0
- {sarj_python_lint-0.12.1 → sarj_python_lint-0.12.2}/src/sarj_python_lint/rules/prefer_str_enum.py +0 -0
- {sarj_python_lint-0.12.1 → sarj_python_lint-0.12.2}/src/sarj_python_lint/rules/prefer_struct_over_namedtuple.py +0 -0
- {sarj_python_lint-0.12.1 → sarj_python_lint-0.12.2}/src/sarj_python_lint/rules/prefer_timedelta_for_durations.py +0 -0
- {sarj_python_lint-0.12.1 → sarj_python_lint-0.12.2}/src/sarj_python_lint/rules/pydantic_at_boundaries.py +0 -0
- {sarj_python_lint-0.12.1 → sarj_python_lint-0.12.2}/src/sarj_python_lint/rules/single_public_export.py +0 -0
- {sarj_python_lint-0.12.1 → sarj_python_lint-0.12.2}/src/sarj_python_lint/rules/stepdown.py +0 -0
- {sarj_python_lint-0.12.1 → sarj_python_lint-0.12.2}/src/sarj_python_lint/rules/store_insert_requires_on_conflict.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sarj-python-lint
|
|
3
|
-
Version: 0.12.
|
|
3
|
+
Version: 0.12.2
|
|
4
4
|
Summary: Custom Python lint rules — AST-based, pre-commit-friendly, hypermodern defaults
|
|
5
5
|
Project-URL: Homepage, https://github.com/sarj-ai/standards/tree/main/packages/python
|
|
6
6
|
Project-URL: Repository, https://github.com/sarj-ai/standards
|
{sarj_python_lint-0.12.1 → sarj_python_lint-0.12.2}/src/sarj_python_lint/rules/no_comment_cruft.py
RENAMED
|
@@ -99,6 +99,26 @@ _ASSIGN_OR_CALL_RE = re.compile(r"^[A-Za-z_][\w.\[\]]*\s*(?:=|:=|\+=|-=|\*=|/=)\
|
|
|
99
99
|
# illustration inside a doc comment, not a line that was once executed.
|
|
100
100
|
_PSEUDOCODE_RE = re.compile(r"%[^%\s]+%|\[opt\]|<[^<>]+>|\.\.\.")
|
|
101
101
|
|
|
102
|
+
# Step-narration lead-ins ("First, ...", "Then, ...", "Finally, ...", "Step 2:").
|
|
103
|
+
# A trailing comma/colon is required so English adverbs ("finally the invariant
|
|
104
|
+
# holds") aren't mistaken for an enumeration marker.
|
|
105
|
+
_STEP_NARRATION_RE = re.compile(
|
|
106
|
+
r"^(?:first(?:ly)?|second(?:ly)?|third(?:ly)?|then|next|after(?:wards| that)?"
|
|
107
|
+
r"|finally|lastly|now)\s*[,:]\s*\S|^step\s+\d+\b",
|
|
108
|
+
re.IGNORECASE,
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
# Self-admitted meta-commentary — the "why later", not the why. Owner-tagged
|
|
112
|
+
# directive markers are handled elsewhere (as directives) and kept.
|
|
113
|
+
_META_COMMENTARY_RE = re.compile(
|
|
114
|
+
r"\b(?:for now|keeping (?:it|this) simple|could be (?:refactored|improved|cleaned up|simplified)"
|
|
115
|
+
r"|refactor(?:ed|ing)? (?:later|this)|not sure (?:if|whether|why|how)"
|
|
116
|
+
r"|quick[- ](?:and[- ]dirty|fix)|(?:a |bit of a )?hacky|is a hack"
|
|
117
|
+
r"|temporary (?:solution|workaround|fix|hack)|revisit (?:this|later|below)"
|
|
118
|
+
r"|clean (?:this|it) up|not ideal|placeholder for now)\b",
|
|
119
|
+
re.IGNORECASE,
|
|
120
|
+
)
|
|
121
|
+
|
|
102
122
|
|
|
103
123
|
def _comment_body(raw: str) -> str:
|
|
104
124
|
return raw.lstrip("#").strip()
|
|
@@ -120,6 +140,19 @@ def _is_directive(body: str) -> bool:
|
|
|
120
140
|
return False
|
|
121
141
|
|
|
122
142
|
|
|
143
|
+
def _is_redundant_narration(body: str) -> bool:
|
|
144
|
+
"""Whether a comment merely narrates the code (step markers, meta-commentary).
|
|
145
|
+
|
|
146
|
+
Returns:
|
|
147
|
+
True for step-narration lead-ins and self-admitted meta-commentary.
|
|
148
|
+
|
|
149
|
+
"""
|
|
150
|
+
c = body.strip()
|
|
151
|
+
if not c or _looks_like_code(c):
|
|
152
|
+
return False
|
|
153
|
+
return bool(_STEP_NARRATION_RE.search(c) or _META_COMMENTARY_RE.search(c))
|
|
154
|
+
|
|
155
|
+
|
|
123
156
|
def _is_banner(body: str) -> bool:
|
|
124
157
|
if not body:
|
|
125
158
|
return False
|
|
@@ -227,6 +260,8 @@ class NoCommentCruft(Rule):
|
|
|
227
260
|
if prev_body is not None and _is_prose_line(prev_body):
|
|
228
261
|
return None
|
|
229
262
|
return "Commented-out code — delete it; git history remembers."
|
|
263
|
+
if _is_redundant_narration(body):
|
|
264
|
+
return "Comment narrates the code — delete it or say why, not what. Code is self-documenting."
|
|
230
265
|
return None
|
|
231
266
|
|
|
232
267
|
def _flag_leading_preamble(
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sarj_python_lint-0.12.1 → sarj_python_lint-0.12.2}/src/sarj_python_lint/rules/no_fat_try_blocks.py
RENAMED
|
File without changes
|
{sarj_python_lint-0.12.1 → sarj_python_lint-0.12.2}/src/sarj_python_lint/rules/no_fstring_in_log.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sarj_python_lint-0.12.1 → sarj_python_lint-0.12.2}/src/sarj_python_lint/rules/no_secret_in_log.py
RENAMED
|
File without changes
|
{sarj_python_lint-0.12.1 → sarj_python_lint-0.12.2}/src/sarj_python_lint/rules/no_select_star.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sarj_python_lint-0.12.1 → sarj_python_lint-0.12.2}/src/sarj_python_lint/rules/prefer_class_row.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sarj_python_lint-0.12.1 → sarj_python_lint-0.12.2}/src/sarj_python_lint/rules/prefer_str_enum.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|