@neralabs/rerail-pack-python 0.1.3 → 0.1.4

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.
Files changed (138) hide show
  1. package/README.md +704 -0
  2. package/package.json +1 -1
  3. package/rules/bandit-b101-assert-used.json +2 -2
  4. package/rules/bandit-b102-exec-used.json +2 -2
  5. package/rules/bandit-b110-try-except-pass.json +1 -1
  6. package/rules/bandit-b112-try-except-continue.json +1 -1
  7. package/rules/bandit-b113-request-without-timeout.json +2 -2
  8. package/rules/bandit-b301-pickle.json +2 -2
  9. package/rules/bandit-b302-marshal.json +2 -2
  10. package/rules/bandit-b303-md5.json +1 -1
  11. package/rules/bandit-b305-cipher-modes.json +2 -2
  12. package/rules/bandit-b306-mktemp-q.json +2 -2
  13. package/rules/bandit-b307-eval.json +1 -1
  14. package/rules/bandit-b308-mark-safe.json +2 -2
  15. package/rules/bandit-b310-urllib-urlopen.json +1 -1
  16. package/rules/bandit-b311-random.json +1 -1
  17. package/rules/bandit-b312-telnetlib.json +1 -1
  18. package/rules/bandit-b313-xml-bad-celementtree.json +1 -1
  19. package/rules/bandit-b314-xml-bad-elementtree.json +1 -1
  20. package/rules/bandit-b315-xml-bad-expatreader.json +1 -1
  21. package/rules/bandit-b316-xml-bad-expatbuilder.json +1 -1
  22. package/rules/bandit-b317-xml-bad-sax.json +1 -1
  23. package/rules/bandit-b318-xml-bad-minidom.json +1 -1
  24. package/rules/bandit-b319-xml-bad-pulldom.json +1 -1
  25. package/rules/bandit-b321-ftplib.json +2 -2
  26. package/rules/bandit-b323-unverified-context.json +2 -2
  27. package/rules/bandit-b401-import-telnetlib.json +2 -2
  28. package/rules/bandit-b402-import-ftplib.json +2 -2
  29. package/rules/bandit-b405-import-xml-etree.json +1 -1
  30. package/rules/bandit-b407-import-xml-expat.json +1 -1
  31. package/rules/bandit-b408-import-xml-minidom.json +1 -1
  32. package/rules/bandit-b409-import-xml-pulldom.json +1 -1
  33. package/rules/bandit-b411-import-xmlrpclib.json +1 -1
  34. package/rules/bandit-b413-import-pycrypto.json +1 -1
  35. package/rules/bandit-b415-import-pyghmi.json +2 -2
  36. package/rules/bandit-b502-ssl-with-bad-version.json +2 -2
  37. package/rules/bandit-b505-weak-cryptographic-key.json +2 -2
  38. package/rules/bandit-b507-ssh-no-host-key-verification.json +2 -2
  39. package/rules/bandit-b606-start-process-with-no-shell.json +2 -2
  40. package/rules/bandit-b615-huggingface-unsafe-download.json +2 -2
  41. package/rules/ruff-async100-cancel-scope-no-checkpoint.json +2 -2
  42. package/rules/ruff-async105-trio-sync-call.json +1 -1
  43. package/rules/ruff-async115-async-zero-sleep.json +1 -1
  44. package/rules/ruff-async116-long-sleep-not-forever.json +1 -1
  45. package/rules/ruff-async210-blocking-http-call-in-async-function.json +2 -2
  46. package/rules/ruff-async221-run-process-in-async-function.json +1 -1
  47. package/rules/ruff-async222-wait-for-process-in-async-function.json +2 -2
  48. package/rules/ruff-async230-blocking-open-call-in-async-function.json +2 -2
  49. package/rules/ruff-async250-blocking-input-in-async-function.json +2 -2
  50. package/rules/ruff-async251-blocking-sleep-in-async-function.json +1 -1
  51. package/rules/ruff-b002-unary-prefix-increment-decrement.json +3 -3
  52. package/rules/ruff-b003-assignment-to-os-environ.json +2 -2
  53. package/rules/ruff-b004-unreliable-callable-check.json +1 -1
  54. package/rules/ruff-b005-strip-with-multi-characters.json +2 -2
  55. package/rules/ruff-b007-unused-loop-control-variable.json +1 -1
  56. package/rules/ruff-b009-get-attr-with-constant.json +1 -1
  57. package/rules/ruff-b010-set-attr-with-constant.json +2 -2
  58. package/rules/ruff-b011-assert-false.json +1 -1
  59. package/rules/ruff-b013-redundant-tuple-in-exception-handler.json +1 -1
  60. package/rules/ruff-b014-duplicate-handler-exception.json +1 -1
  61. package/rules/ruff-b016-raise-literal.json +1 -1
  62. package/rules/ruff-b020-loop-variable-overrides-iterator.json +1 -1
  63. package/rules/ruff-b021-f-string-docstring.json +1 -1
  64. package/rules/ruff-b022-useless-contextlib-suppress.json +1 -1
  65. package/rules/ruff-b023-function-uses-loop-variable.json +2 -2
  66. package/rules/ruff-b025-duplicate-try-block-exception.json +1 -1
  67. package/rules/ruff-b026-star-arg-unpacking-after-keyword-arg.json +1 -1
  68. package/rules/ruff-b028-no-explicit-stacklevel.json +2 -2
  69. package/rules/ruff-b029-except-with-empty-tuple.json +1 -1
  70. package/rules/ruff-b030-except-with-non-exception-classes.json +1 -1
  71. package/rules/ruff-b032-unintentional-type-annotation.json +1 -1
  72. package/rules/ruff-b033-duplicate-value.json +1 -1
  73. package/rules/ruff-b034-re-sub-positional-args.json +1 -1
  74. package/rules/ruff-b039-mutable-contextvar-default.json +2 -2
  75. package/rules/ruff-b904-raise-without-from-inside-except.json +2 -2
  76. package/rules/ruff-b905-zip-without-explicit-strict.json +1 -1
  77. package/rules/ruff-e711-none-comparison.json +1 -1
  78. package/rules/ruff-e721-type-comparison.json +1 -1
  79. package/rules/ruff-e722-bare-except.json +2 -2
  80. package/rules/ruff-e742-ambiguous-class-name.json +2 -2
  81. package/rules/ruff-e743-ambiguous-function-name.json +2 -2
  82. package/rules/ruff-f403-undefined-local-with-import-star.json +1 -1
  83. package/rules/ruff-f405-undefined-local-with-import-star-usage.json +2 -2
  84. package/rules/ruff-f406-undefined-local-with-nested-import-star-usage.json +2 -2
  85. package/rules/ruff-f407-future-feature-not-defined.json +1 -1
  86. package/rules/ruff-f501-percent-format-invalid-format.json +2 -2
  87. package/rules/ruff-f502-percent-format-expected-mapping.json +1 -1
  88. package/rules/ruff-f503-percent-format-expected-sequence.json +1 -1
  89. package/rules/ruff-f504-percent-format-extra-named-arguments.json +1 -1
  90. package/rules/ruff-f505-percent-format-missing-argument.json +1 -1
  91. package/rules/ruff-f506-percent-format-mixed-positional-and-named.json +2 -2
  92. package/rules/ruff-f507-percent-format-positional-count-mismatch.json +2 -2
  93. package/rules/ruff-f508-percent-format-star-requires-sequence.json +2 -2
  94. package/rules/ruff-f509-percent-format-unsupported-format-character.json +2 -2
  95. package/rules/ruff-f521-string-dot-format-invalid-format.json +1 -1
  96. package/rules/ruff-f522-string-dot-format-extra-named-arguments.json +2 -2
  97. package/rules/ruff-f523-string-dot-format-extra-positional-arguments.json +1 -1
  98. package/rules/ruff-f524-string-dot-format-missing-arguments.json +1 -1
  99. package/rules/ruff-f525-string-dot-format-mixing-automatic.json +1 -1
  100. package/rules/ruff-f541-f-string-missing-placeholders.json +2 -2
  101. package/rules/ruff-f601-multi-value-repeated-key-literal.json +1 -1
  102. package/rules/ruff-f602-multi-value-repeated-key-variable.json +2 -2
  103. package/rules/ruff-f622-multiple-starred-expressions.json +1 -1
  104. package/rules/ruff-f632-is-literal.json +1 -1
  105. package/rules/ruff-f633-invalid-print-syntax.json +2 -2
  106. package/rules/ruff-f701-break-outside-loop.json +1 -1
  107. package/rules/ruff-f702-continue-outside-loop.json +1 -1
  108. package/rules/ruff-f706-return-outside-function.json +1 -1
  109. package/rules/ruff-f707-default-except-not-last.json +1 -1
  110. package/rules/ruff-f822-undefined-export.json +1 -1
  111. package/rules/ruff-f823-undefined-local.json +2 -2
  112. package/rules/ruff-f842-unused-annotation.json +1 -1
  113. package/rules/ruff-f901-raise-not-implemented.json +1 -1
  114. package/rules/ruff-pie794-duplicate-class-field-definition.json +1 -1
  115. package/rules/ruff-pie796-non-unique-enums.json +1 -1
  116. package/rules/ruff-pie800-unnecessary-spread.json +1 -1
  117. package/rules/ruff-pie804-unnecessary-dict-kwargs.json +1 -1
  118. package/rules/ruff-pie807-reimplemented-container-builtin.json +1 -1
  119. package/rules/ruff-pie810-multiple-starts-ends-with.json +2 -2
  120. package/rules/ruff-ret501-unnecessary-return-none.json +1 -1
  121. package/rules/ruff-ret502-implicit-return-value.json +2 -2
  122. package/rules/ruff-ret505-superfluous-else-return.json +1 -1
  123. package/rules/ruff-ret506-superfluous-else-raise.json +1 -1
  124. package/rules/ruff-ret507-superfluous-else-continue.json +1 -1
  125. package/rules/ruff-ret508-superfluous-else-break.json +1 -1
  126. package/rules/ruff-sim101-duplicate-isinstance-call.json +1 -1
  127. package/rules/ruff-sim107-return-in-try-except-finally.json +2 -2
  128. package/rules/ruff-sim109-compare-with-tuple.json +1 -1
  129. package/rules/ruff-sim112-uncapitalized-environment-variables.json +2 -2
  130. package/rules/ruff-sim113-enumerate-for-loop.json +1 -1
  131. package/rules/ruff-sim208-double-negation.json +1 -1
  132. package/rules/ruff-sim210-if-expr-with-true-false.json +1 -1
  133. package/rules/ruff-sim211-if-expr-with-false-true.json +1 -1
  134. package/rules/ruff-sim212-if-expr-with-twisted-arms.json +2 -2
  135. package/rules/ruff-sim300-yoda-conditions.json +2 -2
  136. package/rules/ruff-sim905-split-static-string.json +1 -1
  137. package/rules/ruff-sim910-dict-get-with-none-default.json +1 -1
  138. package/rules/ruff-t100-debugger.json +3 -3
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-async116-long-sleep-not-forever",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's ASYNC116 (long-sleep-not-forever): a call to `trio.sleep` or `anyio.sleep` with exactly one argument, an int or float literal (any spelling; not complex, not signed; parentheses allowed) whose value is greater than 86400 as `seconds=` (trio), `delay=` (anyio) or the first positional argument, in any context, reported on the call. Names resolve as in Ruff's resolve_qualified_name, through the engine's `resolves` (M7).",
6
+ "description": "Use sleep_forever() instead of trio or anyio sleep calls longer than 24 hours; a sleep that long is almost always meant to never end.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*"
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-async210-blocking-http-call-in-async-function",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's ASYNC210 (blocking-http-call-in-async-function): a call to `urllib.request.urlopen`, `urllib3.request` or an `httpx`/`requests` module-level HTTP method inside an `async def` body whose function is the nearest enclosing function, lambda body or class, reported on the callee. Names resolve as in Ruff's resolve_qualified_name, through the engine's `resolves` (M7).",
6
+ "description": "Don't make blocking HTTP calls with requests, httpx, urllib or urllib3 inside async functions; they stall the event loop.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*"
@@ -147,7 +147,7 @@
147
147
  "violation": {
148
148
  "anchor": "witness.span",
149
149
  "code": "ASYNC210",
150
- "message": "Async functions should not call blocking HTTP methods",
150
+ "message": "Replace this blocking HTTP call with an awaited async client call, such as `httpx.AsyncClient` or `aiohttp`.",
151
151
  "suppress": {
152
152
  "noqa": {
153
153
  "codes": [
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-async221-run-process-in-async-function",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's ASYNC221 (run-process-in-async-function): a call to `os.system`, `os.posix_spawn[p]`, `subprocess.run`/`call`/`check_call`/`check_output`/`getoutput`/`getstatusoutput`, or an `os.spawn*` function whose mode (Ruff's find_argument_value(\"mode\", 0): `arguments` in syntactic mode) is absent or `os.P_WAIT` (directly, or through a name whose value, read as find_assigned_value's lookup_symbol does (`resolves.binding` with `stopAtGlobal`), is `os.P_WAIT`) inside an `async def` body whose function is the nearest enclosing function, lambda body or class, reported on the callee. Names resolve as in Ruff's resolve_qualified_name, through the engine's `resolves` (M7).",
6
+ "description": "Don't run processes with subprocess.run, os.system or other blocking process calls inside async functions; they block the event loop until the process exits.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*"
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-async222-wait-for-process-in-async-function",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's ASYNC222 (wait-for-process-in-async-function): a call to `os.wait`, `os.wait3`, `os.wait4`, `os.waitid` or `os.waitpid` inside an `async def` body whose function is the nearest enclosing function, lambda body or class, reported on the callee. Names resolve as in Ruff's resolve_qualified_name, through the engine's `resolves` (M7).",
6
+ "description": "Don't call os.wait, os.waitpid or the other blocking os.wait functions inside async functions; they block the event loop.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*"
@@ -130,7 +130,7 @@
130
130
  "violation": {
131
131
  "anchor": "witness.span",
132
132
  "code": "ASYNC222",
133
- "message": "Async functions should not wait on processes with blocking methods",
133
+ "message": "Replace this blocking `os.wait` call by awaiting the async process object, such as `await proc.wait()`.",
134
134
  "suppress": {
135
135
  "noqa": {
136
136
  "codes": [
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-async230-blocking-open-call-in-async-function",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's ASYNC230 (blocking-open-call-in-async-function): a call to the builtin `open` (`builtins.open`, `io.open`, `io.open_code`), or `.open()` on a `pathlib.Path(...)` call or on a name whose binding holds one (Ruff's find_binding_value through `resolves.binding`: a plain name assignment, annotated assignment or walrus value, an unpacked name's element of a tuple or list display, or a `with` item's context expression; and, as Ruff's match_value, an unpacked name paired with a display element by index where the engine gives no value: a set display, unequal arities, a position after a starred value), inside an `async def` body whose function is the nearest enclosing function, lambda body or class, reported on the callee. Names resolve as in Ruff's resolve_qualified_name, through the engine's `resolves` (M7).",
6
+ "description": "Don't open files with open(), io.open or Path.open() inside async functions; use an async file API so file I/O doesn't block the event loop.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*"
@@ -325,7 +325,7 @@
325
325
  "violation": {
326
326
  "anchor": "witness.span",
327
327
  "code": "ASYNC230",
328
- "message": "Async functions should not open files with blocking methods like `open`",
328
+ "message": "Open this file with an async file API, such as `anyio.open_file()`, `trio.open_file()` or `aiofiles.open()`.",
329
329
  "suppress": {
330
330
  "noqa": {
331
331
  "codes": [
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-async250-blocking-input-in-async-function",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's ASYNC250 (blocking-input-in-async-function): a call to the builtin `input` (the unshadowed name, or `builtins.input`) inside an `async def` body whose function is the nearest enclosing function, lambda body or class, reported on the callee. Names resolve as in Ruff's resolve_qualified_name, through the engine's `resolves` (M7).",
6
+ "description": "Don't call input() inside async functions; it blocks the event loop while waiting for the user.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*"
@@ -129,7 +129,7 @@
129
129
  "violation": {
130
130
  "anchor": "witness.span",
131
131
  "code": "ASYNC250",
132
- "message": "Blocking call to `input()` in async context",
132
+ "message": "Read input in a worker thread, such as `await asyncio.to_thread(input)`, instead of calling `input()` directly.",
133
133
  "suppress": {
134
134
  "noqa": {
135
135
  "codes": [
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-async251-blocking-sleep-in-async-function",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's ASYNC251 (blocking-sleep-in-async-function): a call to `time.sleep` inside an `async def` body whose function is the nearest enclosing function, lambda body or class, reported on the callee. Names resolve as in Ruff's resolve_qualified_name, through the engine's `resolves` (M7).",
6
+ "description": "Don't call time.sleep() inside async functions; await the async library's sleep so other tasks keep running.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*"
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-b002-unary-prefix-increment-decrement",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's B002 (unary-prefix-increment-decrement): a unary `+` whose operand is a unary `+`, or a unary `-` whose operand is a unary `-` (parentheses around the operand are transparent, as in Ruff's AST). Reported on the outer unary expression.",
6
+ "description": "Don't write a doubled plus or minus prefix to increment or decrement a value; Python has no such operators, so the value is left unchanged.",
7
7
  "scope": { "include": ["**/*"], "exclude": [] },
8
8
  "clauses": [
9
9
  {
@@ -26,7 +26,7 @@
26
26
  }
27
27
  }
28
28
  },
29
- "violation": { "anchor": "witness.span", "code": "B002", "message": "Python does not support the unary prefix increment operator (`++`)", "suppress": { "noqa": { "codes": ["B002"] } } }
29
+ "violation": { "anchor": "witness.span", "code": "B002", "message": "Replace this `++` prefix with `+= 1`; Python reads `++x` as `x`, so nothing is incremented.", "suppress": { "noqa": { "codes": ["B002"] } } }
30
30
  },
31
31
  {
32
32
  "id": "unary-prefix-decrement",
@@ -48,7 +48,7 @@
48
48
  }
49
49
  }
50
50
  },
51
- "violation": { "anchor": "witness.span", "code": "B002", "message": "Python does not support the unary prefix decrement operator (`--`)", "suppress": { "noqa": { "codes": ["B002"] } } }
51
+ "violation": { "anchor": "witness.span", "code": "B002", "message": "Replace this `--` prefix with `-= 1`; Python reads `--x` as `x`, so nothing is decremented.", "suppress": { "noqa": { "codes": ["B002"] } } }
52
52
  }
53
53
  ]
54
54
  }
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-b003-assignment-to-os-environ",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's B003 (assignment-to-os-environ): a plain assignment statement with exactly one target, that target being the attribute `os.environ` (the name `os`, not resolved; parentheses around the target are transparent). Chained assignments (several targets), annotated and augmented assignments are not checked, as in Ruff. Reported on the attribute.",
6
+ "description": "Don't assign a new value to os.environ; it doesn't change the real process environment, so update or clear the existing mapping instead.",
7
7
  "scope": { "include": ["**/*"], "exclude": [] },
8
8
  "clauses": [
9
9
  {
@@ -48,7 +48,7 @@
48
48
  }
49
49
  }
50
50
  },
51
- "violation": { "anchor": "witness.span", "code": "B003", "message": "Assigning to `os.environ` doesn't clear the environment", "suppress": { "noqa": { "codes": ["B003"] } } }
51
+ "violation": { "anchor": "witness.span", "code": "B003", "message": "Update `os.environ` in place with `.clear()` and `.update()` instead of assigning a new mapping to it.", "suppress": { "noqa": { "codes": ["B003"] } } }
52
52
  }
53
53
  ]
54
54
  }
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-b004-unreliable-callable-check",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's B004 (unreliable-callable-check): `hasattr(x, \"__call__\")` with exactly two positional arguments, or `getattr(x, \"__call__\")` / `getattr(x, \"__call__\", default)` with two or three, no keyword arguments, the second argument a str literal (not bytes, an f- or t-string; parentheses transparent) whose value is `__call__` (escapes decoded, implicit concatenations joined). The callee (parentheses transparent) resolves to the builtin `hasattr`/`getattr` (Ruff's `resolve_builtin_symbol`, via `resolves`): the unshadowed name, or that attribute of the `builtins` module through the file's imports. Reported on the call.",
6
+ "description": "Use callable() instead of checking hasattr() or getattr() for __call__; the attribute check gives wrong answers for some objects.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*"
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-b005-strip-with-multi-characters",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's B005 (strip-with-multi-characters): `.strip`/`.lstrip`/`.rstrip` called with exactly one positional argument that is a str literal (not bytes, an f- or t-string; escapes decoded, implicit concatenations joined) whose value repeats a character, tested with a backreference (`(.).*\\1`). Reported on the call.",
6
+ "description": "Avoid strip, lstrip or rstrip with a multi-character string that repeats a character; the argument is a set of characters, not a substring to remove.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*"
@@ -117,7 +117,7 @@
117
117
  "violation": {
118
118
  "anchor": "witness.span",
119
119
  "code": "B005",
120
- "message": "Using `.strip()` with multi-character strings is misleading",
120
+ "message": "List each character once in this strip argument, or use `removeprefix()`/`removesuffix()` to remove a substring.",
121
121
  "suppress": {
122
122
  "noqa": {
123
123
  "codes": [
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-b007-unused-loop-control-variable",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's B007 (unused-loop-control-variable) with the default `dummy-variable-rgx`: a name bound by a `for` loop's target (itself, or inside tuple/list/starred targets) that does not match `^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$` and never occurs as a name expression in the loop body (the `else` clause does not count; attribute members, keyword-argument names, def/class names, parameters, import and global/nonlocal names and except-handler names are not name expressions). The message says `may not be used` when the body calls `locals`/`globals`/`vars`/`exec`/`eval` (by spelling; Ruff checks they are builtins). Match-statement capture, keyword-pattern, star and `as` names are not name expressions either. Reported on the target name.",
6
+ "description": "Rename for-loop variables the loop body never uses to start with an underscore; it shows the value is deliberately ignored.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*"
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-b009-get-attr-with-constant",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's B009 (getattr-with-constant): `getattr(obj, \"name\")` with exactly two positional arguments and no keyword arguments, `obj` not starred, the second a str literal (not bytes, an f- or t-string; escapes decoded, implicit concatenations joined) whose value is a Python identifier (Unicode XID, not a keyword) and not a mangled private name (`__x` without a trailing `__`). The callee (parentheses transparent) resolves to the builtin `getattr` (Ruff's `match_builtin_expr`): the unshadowed name, or `getattr` of the `builtins` module through the file's imports. Reported on the call.",
6
+ "description": "Use plain attribute access instead of getattr() with a constant attribute name; it is no safer and harder to read.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*"
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-b010-set-attr-with-constant",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's B010 (set-attr-with-constant): `setattr(obj, \"name\", value)` used as an expression statement, with exactly three positional arguments and no keyword arguments, `obj` not starred, the name a str literal (not bytes, an f- or t-string; escapes decoded, implicit concatenations joined) whose value is a Python identifier (Unicode XID, not a keyword), not `__debug__` and not a mangled private name. The callee (parentheses transparent) resolves to the builtin `setattr` (Ruff's `match_builtin_expr`): the unshadowed name, or `setattr` of the `builtins` module through the file's imports. Reported on the call.",
6
+ "description": "Use plain attribute assignment instead of setattr() with a constant attribute name; it is no safer and harder to read.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*"
@@ -205,7 +205,7 @@
205
205
  "violation": {
206
206
  "anchor": "witness.span",
207
207
  "code": "B010",
208
- "message": "Do not call `setattr` with a constant attribute value. It is not any safer than normal property access.",
208
+ "message": "Replace this `setattr` call with a plain assignment, such as `obj.name = value`.",
209
209
  "suppress": {
210
210
  "noqa": {
211
211
  "codes": [
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-b011-assert-false",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's B011 (assert-false): an `assert` statement whose test is the literal `False` (Ruff's `is_const_false`; parentheses transparent), reported on the literal. Ported from the Ruff conformance suite (rerail/conformance/ruff/rules/B011.json at 3f102adcb), with Ruff's `# noqa` honoured as the Ruff CLI honours it.",
6
+ "description": "Raise AssertionError instead of assert False; assertions are stripped when Python runs with optimizations enabled.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*"
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-b013-redundant-tuple-in-exception-handler",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's B013 (redundant-tuple-in-exception-handler): the type of an `except` (or `except*`) handler is a parenthesized tuple with exactly one element that is not starred. Parentheses around the tuple are transparent, and an `as` name does not matter. Reported on the tuple.",
6
+ "description": "Remove the one-element tuple around a single exception type in an except clause; the parentheses and comma are redundant.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*"
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-b014-duplicate-handler-exception",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's B014 (duplicate-handler-exception): the type of an `except` (or `except*`) handler is a tuple in which the same dotted name (a name or an attribute chain of names, Ruff's `UnqualifiedName`) occurs more than once (parentheses around an element are transparent). Reported once on the tuple, whatever the number of duplicates.",
6
+ "description": "Remove duplicate exception types from an except clause's tuple; naming one twice adds nothing.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*"
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-b016-raise-literal",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's B016 (raise-literal): the exception of a `raise` statement is a literal (Ruff's `is_literal_expr`: string, bytes, number, `True`/`False`, `None`, `...`; not an f-string or t-string, including an implicit concatenation with one; parentheses transparent). Reported on the literal.",
6
+ "description": "Raise an exception instance instead of a literal like a string or number; raising a literal fails with a TypeError.",
7
7
  "scope": { "include": ["**/*"], "exclude": [] },
8
8
  "clauses": [
9
9
  {
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-b020-loop-variable-overrides-iterator",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's B020 (loop-variable-overrides-iterator): a name in a `for` loop's target that also occurs as a name in its iterable, where comprehensions in the iterable contribute only the iterables of their `for` clauses and lambdas the children of their body (Ruff's `NameFinder` walks the body's children, so `lambda: x` adds nothing). A name that is a (non-variadic) parameter of a lambda in the iterable is exempt unless it occurs again after that lambda, as Ruff's walk removes it and a later occurrence adds it back. Reported on each such target name (Ruff reports only the last occurrence of a name repeated in the target).",
6
+ "description": "Don't name a for-loop variable after a name used in the loop's iterable; the loop overwrites the original value.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*"
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-b021-f-string-docstring",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's B021 (f-string-docstring): the first statement of a module, function or class body is an expression statement whose value is an f-string (an `f`-prefixed literal, or an implicit concatenation containing one; parentheses transparent). Comments before it are not statements. Reported on the statement.",
6
+ "description": "Use a plain string literal, not an f-string, for docstrings; Python doesn't treat an f-string as a docstring.",
7
7
  "scope": { "include": ["**/*"], "exclude": [] },
8
8
  "clauses": [
9
9
  {
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-b022-useless-contextlib-suppress",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's B022 (useless-contextlib-suppress): a call to `contextlib.suppress` with no positional arguments, reported on the call. The callee (parentheses transparent) resolves to `contextlib.suppress` with `resolves` (imports and shadowing as Ruff's semantic model sees them).",
6
+ "description": "Pass at least one exception type to contextlib.suppress(); with none it suppresses nothing.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*"
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-b023-function-uses-loop-variable",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's B023 (function-uses-loop-variable): a name loaded in the body of a function or lambda defined inside a loop (for, while, or comprehension), when the function neither takes it as a parameter nor stores it anywhere in its body, and the loop assigns it (assignment, augmented or annotated assignment, for or comprehension target; not inside nested functions or lambdas). The function is the first def or unsafe lambda on the way down from the loop; a lambda is safe when it is returned directly, called immediately, a positional argument of `filter`/`reduce`/`map`/`functools.reduce`, or the value of a `key=` keyword. Reported on the name.",
6
+ "description": "Pass loop variables into functions and lambdas defined inside a loop as arguments or defaults; otherwise they all see the variable's last value.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*"
@@ -546,7 +546,7 @@
546
546
  "violation": {
547
547
  "anchor": "witness.span",
548
548
  "code": "B023",
549
- "message": "Function definition does not bind loop variable `$N`",
549
+ "message": "Bind `$N` as a default argument, such as `$N=$N`, so the function keeps this iteration's value.",
550
550
  "suppress": {
551
551
  "noqa": {
552
552
  "codes": [
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-b025-duplicate-try-block-exception",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's B025 (duplicate-try-block-exception): an exception name (a name or dotted attribute chain) in an `except`/`except*` clause, as the type or a direct element of a tuple type, that an earlier handler of the same `try` already names; within one tuple only its first occurrence counts. Names compare structurally. Reported on the repeated name.",
6
+ "description": "Remove exception types repeated across handlers of the same try block; only the first handler that names one can ever run.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*"
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-b026-star-arg-unpacking-after-keyword-arg",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's B026 (star-arg-unpacking-after-keyword-arg): a `*` unpacking argument of a call that comes after the call's first keyword argument (`name=value` or `**mapping`). Reported on the starred argument.",
6
+ "description": "Put star-argument unpacking before keyword arguments in calls; placing it after is legal but misleading about argument order.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*"
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-b028-no-explicit-stacklevel",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's B028 (no-explicit-stacklevel): a call to `warnings.warn` with no `stacklevel` (keyword or third positional argument: find_argument_value, through `arguments` in syntactic mode), no non-empty `skip_file_prefixes`, and no `*`/`**` unpacking. The callee resolves with `resolves` (imports and shadowing as Ruff's semantic model sees them). Reported on the callee, inside any parentheses. Ported from the Ruff conformance suite (rerail/conformance/ruff/rules/B028.json at 3f102adcb), with Ruff's `# noqa` honoured as the Ruff CLI honours it.",
6
+ "description": "Pass an explicit stacklevel to warnings.warn(); without it the warning points at the warn call instead of the caller who triggered it.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*"
@@ -163,7 +163,7 @@
163
163
  "violation": {
164
164
  "anchor": "witness.span",
165
165
  "code": "B028",
166
- "message": "No explicit `stacklevel` keyword argument found",
166
+ "message": "Pass stacklevel= to this warnings.warn() call, usually 2, so the warning points at the caller.",
167
167
  "suppress": {
168
168
  "noqa": {
169
169
  "codes": [
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-b029-except-with-empty-tuple",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's B029 (except-with-empty-tuple): an `except`/`except*` clause whose type is the empty tuple `()` (inside any parentheses, with or without `as`). Reported on the whole clause.",
6
+ "description": "Don't write an except clause with an empty tuple as its type; it catches nothing, so name the exceptions to handle.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*"
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-b030-except-with-non-exception-classes",
4
4
  "revision": 2,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's B030 (except-with-non-exception-classes): flattens an `except`/`except*` type as Ruff's `flatten_iterables` does (a top-level tuple's elements; `*` unpacking of tuples and lists; both sides of `+`, splicing tuple sides and unpacking starred sides) and reports each resulting expression that is not a name, attribute, subscript or call. Parentheses and an `as` binding (`except E as e`, tree-sitter's as_pattern) are transparent.",
6
+ "description": "Use only exception classes, or tuples of them, in except clauses; other values such as literals or expressions are not valid exception types.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*"
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-b032-unintentional-type-annotation",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's B032 (unintentional-type-annotation): an annotated statement without a value whose target is a subscript of a name (`d[k]: v`) or an attribute of a name other than `self` (`o.a: v`), inside any parentheses (tree-sitter reads a parenthesized target as a one-element `tuple_pattern`). Reported on the statement.",
6
+ "description": "Use = instead of : when setting a subscript or another object's attribute without a value; a colon there makes a type annotation that assigns nothing.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*"
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-b033-duplicate-value",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's B033 (duplicate-value): a literal element of a set display (string, bytes, number, boolean, `None`, `...`, not an f- or t-string; parentheses are transparent) equal to an earlier literal element. Equality is Ruff's HashableExpr (`compare` `text: \"structure-hash\"`): numbers fold by value (`True == 1 == 1.0 == 0x1`), strings by decoded value (`'a' == \"\\x61\"`, implicit concatenation joined), and an int of 2**64 or more by its token.",
6
+ "description": "Remove duplicate literal values from Python set literals; the repeat is dropped silently and usually hides a typo, and values like True, 1 and 1.0 count as the same.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*"
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-b034-re-sub-positional-args",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's B034 (re-sub-positional-args): a call to `re.sub` or `re.subn` with more than three positional arguments, or to `re.split` with more than two (starred arguments count). The callee resolves with `resolves` (imports and shadowing as Ruff's semantic model sees them). Reported on the call.",
6
+ "description": "Pass count, maxsplit and flags as keyword arguments to re.sub(), re.subn() and re.split(); their positional order is easy to get wrong.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*"
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-b039-mutable-contextvar-default",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's B039 (mutable-contextvar-default): the `default=` of a `contextvars.ContextVar(...)` call (the callee may be subscripted) is a list, dict or set display or comprehension, or a call to anything other than a function Ruff knows returns an immutable value (`is_immutable_return_type`: `datetime`, `decimal`, `fractions`, `operator`, `pathlib.Path`, `types.MappingProxyType`, `re.compile`, immutable builtins, and Ruff's option `flake8-bugbear.extend-immutable-calls`). Names resolve with `resolves` (imports, and builtins only when unshadowed). Reported on the default, inside any parentheses.",
6
+ "description": "Don't give a ContextVar a mutable default such as a list, dict or set; the one default object is shared across every context.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*"
@@ -267,7 +267,7 @@
267
267
  "violation": {
268
268
  "anchor": "witness.span",
269
269
  "code": "B039",
270
- "message": "Do not use mutable data structures for `ContextVar` defaults",
270
+ "message": "Default this ContextVar to None and set the mutable value with .set(); a mutable default is shared by every context.",
271
271
  "suppress": {
272
272
  "noqa": {
273
273
  "codes": [
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-b904-raise-without-from-inside-except",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's B904 (raise-without-from-inside-except): a `raise X` without `from` in an `except`/`except*` body, reached only through `if`/`elif`/`else`, `with`, `for` and `while` bodies (not their `else`) and `match` cases; nested `try`, `def` and `class` are not entered. `raise name` re-raising the handler's own `as` name is exempt. Reported on the raise statement.",
6
+ "description": "Use raise ... from err (or from None) when raising a new exception inside an except block; it keeps the cause chain clear instead of looking like a bug in the handler.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*.py",
@@ -180,7 +180,7 @@
180
180
  "violation": {
181
181
  "anchor": "witness.span",
182
182
  "code": "B904",
183
- "message": "Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling",
183
+ "message": "Raise this exception with `from err` or `from None` so the cause chain is clear.",
184
184
  "suppress": {
185
185
  "noqa": {
186
186
  "codes": [
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-b905-zip-without-explicit-strict",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's B905 (zip-without-explicit-strict), from target version 3.10 (`when`; `expression.rs:792`): a call to builtin `zip` (bare `zip`, or `zip` from `builtins`) with no `strict=` keyword (find_keyword, through `arguments` in syntactic mode), at least two positional arguments or a `*` argument, and no infinite iterator argument (`itertools.cycle`/`count`, `repeat` without a finite `times`). `zip` and the itertools names resolve with `resolves`, so a shadowed `zip` is not reported. Reported on the call. Ported from the Ruff conformance suite (rerail/conformance/ruff/rules/B905.json at 3f102adcb), with Ruff's `# noqa` honoured as the Ruff CLI honours it.",
6
+ "description": "Pass strict= explicitly to zip() over two or more iterables on Python 3.10+; otherwise mismatched lengths are truncated silently.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*"
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-e711-none-comparison",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's E711 (none-comparison) with default settings: `None` compared with `==` or `!=`, reported on the `None` literal (inside any parentheses). The first operand is checked when the second is not a non-singleton constant; each later `None` when the operand before its operator is not one (Ruff's `is_constant_non_singleton`: string, bytes and number literals, and tuples of constants). Ported from the Ruff conformance suite (rerail/conformance/ruff/rules/E711.json at 3f102adcb), with Ruff's `# noqa` honoured as the Ruff CLI honours it.",
6
+ "description": "Use is None or is not None instead of == or != to compare with None; equality can be overridden and gives surprising results.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*"
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-e721-type-comparison",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's E721 (type-comparison): a comparison with an `==` or `!=` operator whose operand on either side is a type (a call whose callee resolves to the builtin `type` or `builtins.type`, or a name from Ruff's builtin type and exception list that resolves to the builtin) while neither side is a dtype (`x.dtype`, or a call of a callee resolving to `numpy.dtype`), reported on the whole comparison once per offending operator (a chained comparison can report twice, as in Ruff).",
6
+ "description": "Use isinstance(), or is and is not, instead of == or != to compare types; equality on types misses subclasses and can be overridden.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*"
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-e722-bare-except",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's E722 (bare-except) with default settings: an `except` clause that names no exception type, unless its body re-raises with a bare `raise` statement. Reported on the `except` keyword, as Ruff does. Ported from the Ruff conformance suite (rerail/conformance/ruff/rules/E722.json at 3f102adcb), with Ruff's `# noqa` honoured as the Ruff CLI honours it.",
6
+ "description": "Name the exception types in except clauses instead of a bare except, unless the handler re-raises; a bare except also catches KeyboardInterrupt and SystemExit.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*"
@@ -43,7 +43,7 @@
43
43
  "violation": {
44
44
  "anchor": "witness.span",
45
45
  "code": "E722",
46
- "message": "Do not use bare `except`",
46
+ "message": "Name the exception types this bare except should catch; it also catches KeyboardInterrupt and SystemExit.",
47
47
  "suppress": {
48
48
  "noqa": {
49
49
  "codes": [
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-e742-ambiguous-class-name",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's E742 (ambiguous-class-name): a class named `l`, `I` or `O`, reported on the name.",
6
+ "description": "Avoid naming classes l, I or O; in many fonts they are hard to tell apart from 1 and 0.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*"
@@ -33,7 +33,7 @@
33
33
  "violation": {
34
34
  "anchor": "witness.span",
35
35
  "code": "E742",
36
- "message": "Ambiguous class name: `$NAME`",
36
+ "message": "Rename class `$NAME` to a descriptive name; in many fonts it is easy to confuse with 1 or 0.",
37
37
  "suppress": {
38
38
  "noqa": {
39
39
  "codes": [
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-e743-ambiguous-function-name",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's E743 (ambiguous-function-name): a function named `l`, `I` or `O`, reported on the name. Includes `async def` and methods.",
6
+ "description": "Avoid naming functions or methods l, I or O; in many fonts they are hard to tell apart from 1 and 0.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*"
@@ -33,7 +33,7 @@
33
33
  "violation": {
34
34
  "anchor": "witness.span",
35
35
  "code": "E743",
36
- "message": "Ambiguous function name: `$NAME`",
36
+ "message": "Rename function `$NAME` to a descriptive name; in many fonts it is easy to confuse with 1 or 0.",
37
37
  "suppress": {
38
38
  "noqa": {
39
39
  "codes": [
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-f403-undefined-local-with-import-star",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's F403 (undefined-local-with-import-star): any `from <module> import *` whose module is not `__future__` (at any depth, whatever the relative level), reported on the whole statement.",
6
+ "description": "Avoid from module import * star imports; they hide where names come from and stop undefined names from being detected.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*"