@neralabs/rerail-pack-python 0.1.2 → 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 (144) hide show
  1. package/README.md +707 -3
  2. package/licenses/bandit/UPSTREAM.md +10 -0
  3. package/licenses/ruff/UPSTREAM.md +56 -0
  4. package/pack.json +7 -20
  5. package/package.json +1 -1
  6. package/rules/bandit-b101-assert-used.json +2 -2
  7. package/rules/bandit-b102-exec-used.json +2 -2
  8. package/rules/bandit-b110-try-except-pass.json +1 -1
  9. package/rules/bandit-b112-try-except-continue.json +1 -1
  10. package/rules/bandit-b113-request-without-timeout.json +2 -2
  11. package/rules/bandit-b301-pickle.json +2 -2
  12. package/rules/bandit-b302-marshal.json +2 -2
  13. package/rules/bandit-b303-md5.json +1 -1
  14. package/rules/bandit-b305-cipher-modes.json +2 -2
  15. package/rules/bandit-b306-mktemp-q.json +2 -2
  16. package/rules/bandit-b307-eval.json +1 -1
  17. package/rules/bandit-b308-mark-safe.json +2 -2
  18. package/rules/bandit-b310-urllib-urlopen.json +1 -1
  19. package/rules/bandit-b311-random.json +1 -1
  20. package/rules/bandit-b312-telnetlib.json +1 -1
  21. package/rules/bandit-b313-xml-bad-celementtree.json +1 -1
  22. package/rules/bandit-b314-xml-bad-elementtree.json +1 -1
  23. package/rules/bandit-b315-xml-bad-expatreader.json +1 -1
  24. package/rules/bandit-b316-xml-bad-expatbuilder.json +1 -1
  25. package/rules/bandit-b317-xml-bad-sax.json +1 -1
  26. package/rules/bandit-b318-xml-bad-minidom.json +1 -1
  27. package/rules/bandit-b319-xml-bad-pulldom.json +1 -1
  28. package/rules/bandit-b321-ftplib.json +2 -2
  29. package/rules/bandit-b323-unverified-context.json +2 -2
  30. package/rules/bandit-b401-import-telnetlib.json +2 -2
  31. package/rules/bandit-b402-import-ftplib.json +2 -2
  32. package/rules/bandit-b405-import-xml-etree.json +1 -1
  33. package/rules/bandit-b407-import-xml-expat.json +1 -1
  34. package/rules/bandit-b408-import-xml-minidom.json +1 -1
  35. package/rules/bandit-b409-import-xml-pulldom.json +1 -1
  36. package/rules/bandit-b411-import-xmlrpclib.json +1 -1
  37. package/rules/bandit-b413-import-pycrypto.json +1 -1
  38. package/rules/bandit-b415-import-pyghmi.json +2 -2
  39. package/rules/bandit-b502-ssl-with-bad-version.json +2 -2
  40. package/rules/bandit-b505-weak-cryptographic-key.json +2 -2
  41. package/rules/bandit-b507-ssh-no-host-key-verification.json +2 -2
  42. package/rules/bandit-b606-start-process-with-no-shell.json +2 -2
  43. package/rules/bandit-b615-huggingface-unsafe-download.json +2 -2
  44. package/rules/ruff-async100-cancel-scope-no-checkpoint.json +2 -2
  45. package/rules/ruff-async105-trio-sync-call.json +1 -1
  46. package/rules/ruff-async115-async-zero-sleep.json +1 -1
  47. package/rules/ruff-async116-long-sleep-not-forever.json +1 -1
  48. package/rules/ruff-async210-blocking-http-call-in-async-function.json +2 -2
  49. package/rules/ruff-async221-run-process-in-async-function.json +1 -1
  50. package/rules/ruff-async222-wait-for-process-in-async-function.json +2 -2
  51. package/rules/ruff-async230-blocking-open-call-in-async-function.json +2 -2
  52. package/rules/ruff-async250-blocking-input-in-async-function.json +2 -2
  53. package/rules/ruff-async251-blocking-sleep-in-async-function.json +1 -1
  54. package/rules/ruff-b002-unary-prefix-increment-decrement.json +3 -3
  55. package/rules/ruff-b003-assignment-to-os-environ.json +2 -2
  56. package/rules/ruff-b004-unreliable-callable-check.json +1 -1
  57. package/rules/ruff-b005-strip-with-multi-characters.json +2 -2
  58. package/rules/ruff-b007-unused-loop-control-variable.json +1 -1
  59. package/rules/ruff-b009-get-attr-with-constant.json +1 -1
  60. package/rules/ruff-b010-set-attr-with-constant.json +2 -2
  61. package/rules/ruff-b011-assert-false.json +1 -1
  62. package/rules/ruff-b013-redundant-tuple-in-exception-handler.json +1 -1
  63. package/rules/ruff-b014-duplicate-handler-exception.json +1 -1
  64. package/rules/ruff-b016-raise-literal.json +1 -1
  65. package/rules/ruff-b020-loop-variable-overrides-iterator.json +1 -1
  66. package/rules/ruff-b021-f-string-docstring.json +1 -1
  67. package/rules/ruff-b022-useless-contextlib-suppress.json +1 -1
  68. package/rules/ruff-b023-function-uses-loop-variable.json +2 -2
  69. package/rules/ruff-b025-duplicate-try-block-exception.json +1 -1
  70. package/rules/ruff-b026-star-arg-unpacking-after-keyword-arg.json +1 -1
  71. package/rules/ruff-b028-no-explicit-stacklevel.json +2 -2
  72. package/rules/ruff-b029-except-with-empty-tuple.json +1 -1
  73. package/rules/ruff-b030-except-with-non-exception-classes.json +406 -0
  74. package/rules/ruff-b032-unintentional-type-annotation.json +1 -1
  75. package/rules/ruff-b033-duplicate-value.json +1 -1
  76. package/rules/ruff-b034-re-sub-positional-args.json +1 -1
  77. package/rules/ruff-b039-mutable-contextvar-default.json +2 -2
  78. package/rules/ruff-b904-raise-without-from-inside-except.json +2 -2
  79. package/rules/ruff-b905-zip-without-explicit-strict.json +1 -1
  80. package/rules/ruff-e711-none-comparison.json +1 -1
  81. package/rules/ruff-e721-type-comparison.json +1 -1
  82. package/rules/ruff-e722-bare-except.json +2 -2
  83. package/rules/ruff-e742-ambiguous-class-name.json +2 -2
  84. package/rules/ruff-e743-ambiguous-function-name.json +2 -2
  85. package/rules/ruff-f403-undefined-local-with-import-star.json +1 -1
  86. package/rules/ruff-f405-undefined-local-with-import-star-usage.json +2 -2
  87. package/rules/ruff-f406-undefined-local-with-nested-import-star-usage.json +2 -2
  88. package/rules/ruff-f407-future-feature-not-defined.json +1 -1
  89. package/rules/ruff-f501-percent-format-invalid-format.json +2 -2
  90. package/rules/ruff-f502-percent-format-expected-mapping.json +1 -1
  91. package/rules/ruff-f503-percent-format-expected-sequence.json +1 -1
  92. package/rules/ruff-f504-percent-format-extra-named-arguments.json +1 -1
  93. package/rules/ruff-f505-percent-format-missing-argument.json +1 -1
  94. package/rules/ruff-f506-percent-format-mixed-positional-and-named.json +2 -2
  95. package/rules/ruff-f507-percent-format-positional-count-mismatch.json +2 -2
  96. package/rules/ruff-f508-percent-format-star-requires-sequence.json +2 -2
  97. package/rules/ruff-f509-percent-format-unsupported-format-character.json +2 -2
  98. package/rules/ruff-f521-string-dot-format-invalid-format.json +1 -1
  99. package/rules/ruff-f522-string-dot-format-extra-named-arguments.json +2 -2
  100. package/rules/ruff-f523-string-dot-format-extra-positional-arguments.json +1 -1
  101. package/rules/ruff-f524-string-dot-format-missing-arguments.json +1 -1
  102. package/rules/ruff-f525-string-dot-format-mixing-automatic.json +1 -1
  103. package/rules/ruff-f541-f-string-missing-placeholders.json +2 -2
  104. package/rules/ruff-f601-multi-value-repeated-key-literal.json +1 -1
  105. package/rules/ruff-f602-multi-value-repeated-key-variable.json +2 -2
  106. package/rules/ruff-f622-multiple-starred-expressions.json +1 -1
  107. package/rules/ruff-f632-is-literal.json +1 -1
  108. package/rules/ruff-f633-invalid-print-syntax.json +2 -2
  109. package/rules/ruff-f701-break-outside-loop.json +1 -1
  110. package/rules/ruff-f702-continue-outside-loop.json +1 -1
  111. package/rules/ruff-f706-return-outside-function.json +1 -1
  112. package/rules/ruff-f707-default-except-not-last.json +1 -1
  113. package/rules/ruff-f822-undefined-export.json +1 -1
  114. package/rules/ruff-f823-undefined-local.json +2 -2
  115. package/rules/ruff-f842-unused-annotation.json +1 -1
  116. package/rules/ruff-f901-raise-not-implemented.json +1 -1
  117. package/rules/ruff-pie794-duplicate-class-field-definition.json +1 -1
  118. package/rules/ruff-pie796-non-unique-enums.json +1 -1
  119. package/rules/ruff-pie800-unnecessary-spread.json +1 -1
  120. package/rules/ruff-pie804-unnecessary-dict-kwargs.json +1 -1
  121. package/rules/ruff-pie807-reimplemented-container-builtin.json +1 -1
  122. package/rules/ruff-pie810-multiple-starts-ends-with.json +2 -2
  123. package/rules/ruff-ret501-unnecessary-return-none.json +1 -1
  124. package/rules/ruff-ret502-implicit-return-value.json +2 -2
  125. package/rules/ruff-ret505-superfluous-else-return.json +1 -1
  126. package/rules/ruff-ret506-superfluous-else-raise.json +1 -1
  127. package/rules/ruff-ret507-superfluous-else-continue.json +1 -1
  128. package/rules/ruff-ret508-superfluous-else-break.json +1 -1
  129. package/rules/ruff-sim101-duplicate-isinstance-call.json +1 -1
  130. package/rules/ruff-sim107-return-in-try-except-finally.json +2 -2
  131. package/rules/ruff-sim109-compare-with-tuple.json +1 -1
  132. package/rules/ruff-sim112-uncapitalized-environment-variables.json +2 -2
  133. package/rules/ruff-sim113-enumerate-for-loop.json +1 -1
  134. package/rules/ruff-sim208-double-negation.json +1 -1
  135. package/rules/ruff-sim210-if-expr-with-true-false.json +1 -1
  136. package/rules/ruff-sim211-if-expr-with-false-true.json +1 -1
  137. package/rules/ruff-sim212-if-expr-with-twisted-arms.json +2 -2
  138. package/rules/ruff-sim300-yoda-conditions.json +2 -2
  139. package/rules/ruff-sim905-split-static-string.json +1 -1
  140. package/rules/ruff-sim910-dict-get-with-none-default.json +1 -1
  141. package/rules/ruff-t100-debugger.json +3 -3
  142. package/rules/bandit-b406-import-xml-sax.json +0 -73
  143. package/rules/bandit-b610-django-extra-used.json +0 -268
  144. package/rules/ruff-f722-forward-annotation-syntax-error.json +0 -654
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-ret502-implicit-return-value",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's RET502 (implicit-return-value): a bare `return` in a function that also has a `return` with a value other than `None` (nested functions and classes are separate; generators and functions whose body is a lone `return` are skipped), reported on the `return`.",
6
+ "description": "Use return None instead of a bare return in Python functions that also return a value; make the None result explicit.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*"
@@ -149,7 +149,7 @@
149
149
  "violation": {
150
150
  "anchor": "witness.span",
151
151
  "code": "RET502",
152
- "message": "Do not implicitly `return None` in function able to return non-`None` value",
152
+ "message": "Write `return None` instead of a bare `return`, since this function returns a value elsewhere.",
153
153
  "suppress": {
154
154
  "noqa": {
155
155
  "codes": [
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-ret505-superfluous-else-return",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's RET505 (superfluous-else-return): the first `elif`/`else` clause of an `if` statement inside a function whose `if` body has a direct `return` statement and no earlier direct raise/continue/break statement, reported on the `elif`/`else` keyword. As in Ruff, only the `if` body and the first clause are compared, nested functions and classes are separate, and generator functions and functions whose body is a lone `return` are skipped.",
6
+ "description": "Remove the else or elif after an if branch that returns, and dedent its code; the branch already leaves the function.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*"
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-ret506-superfluous-else-raise",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's RET506 (superfluous-else-raise): the first `elif`/`else` clause of an `if` statement inside a function whose `if` body has a direct `raise` statement and no earlier direct return/continue/break statement, reported on the `elif`/`else` keyword. As in Ruff, only the `if` body and the first clause are compared, nested functions and classes are separate, and generator functions and functions whose body is a lone `return` are skipped.",
6
+ "description": "Remove the else or elif after an if branch that raises, and dedent its code; the branch already leaves the function.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*"
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-ret507-superfluous-else-continue",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's RET507 (superfluous-else-continue): the first `elif`/`else` clause of an `if` statement inside a function whose `if` body has a direct `continue` statement and no earlier direct return/raise/break statement, reported on the `elif`/`else` keyword. As in Ruff, only the `if` body and the first clause are compared, nested functions and classes are separate, and generator functions and functions whose body is a lone `return` are skipped.",
6
+ "description": "Remove the else or elif after an if branch that continues the loop, and dedent its code; the branch already skips ahead.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*"
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-ret508-superfluous-else-break",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's RET508 (superfluous-else-break): the first `elif`/`else` clause of an `if` statement inside a function whose `if` body has a direct `break` statement and no earlier direct return/raise/continue statement, reported on the `elif`/`else` keyword. As in Ruff, only the `if` body and the first clause are compared, nested functions and classes are separate, and generator functions and functions whose body is a lone `return` are skipped.",
6
+ "description": "Remove the else or elif after an if branch that breaks out of the loop, and dedent its code; the branch already exits the loop.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*"
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-sim101-duplicate-isinstance-call",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's SIM101 (duplicate-isinstance-call): two adjacent operands of one `or` chain that are calls of the builtin `isinstance(T, C)` (exactly two positional arguments, no keywords) with equal targets (Ruff's ComparableExpr, `text: \"structure\"`; names without NFKC normalization), reported on the whole `or` chain once per run of adjacent such calls with equal targets. A parenthesized `or` is its own chain, as in Ruff's AST. `isinstance` must resolve to the builtin (`match_builtin_expr`: the unshadowed name, or `builtins.isinstance` through an import).",
6
+ "description": "Merge isinstance() checks on the same object joined by or into one call with a tuple of types.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*"
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-sim107-return-in-try-except-finally",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's SIM107 (return-in-try-except-finally): the first top-level `return` of a `finally` body when the `try` body or an `except` handler body has a top-level `return`.",
6
+ "description": "Don't return from a finally block when the try or except also returns; the finally return silently overrides theirs.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*"
@@ -68,7 +68,7 @@
68
68
  "violation": {
69
69
  "anchor": "witness.span",
70
70
  "code": "SIM107",
71
- "message": "Don't use `return` in `try`-`except` and `finally`",
71
+ "message": "Remove the `return` from the `finally` block; it silently overrides the `return` in `try` or `except`.",
72
72
  "suppress": {
73
73
  "noqa": {
74
74
  "codes": [
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-sim109-compare-with-tuple",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's SIM109 (compare-with-tuple): an `or` chain with two or more operands `N == name` (one `==`, both sides names) for the same `N`, anywhere in the chain; not reported when a comment lies inside the chain or follows it on its last line with only white space between (Ruff's has_comments). Reported on the whole `or` chain, once per such name.",
6
+ "description": "Use a membership test against a tuple instead of several or-chained equality checks of the same variable.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*"
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-sim112-uncapitalized-environment-variables",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's SIM112 (uncapitalized-environment-variables): a str literal (not bytes, an f- or t-string; escapes decoded, implicit concatenations joined) whose value has an ASCII lowercase letter, other than `https_proxy`/`http_proxy`/`no_proxy`, used as `os.environ[...]` or as the first argument of a call resolving to `os.environ.get`/`os.getenv`, after Ruff's traversal has visited an absolute import of `os` (M10a `resolves.seenBefore`). Reported on the string.",
6
+ "description": "Use uppercase names when reading environment variables through os.environ or os.getenv; the lowercase proxy variables are exempt.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*"
@@ -154,7 +154,7 @@
154
154
  "violation": {
155
155
  "anchor": "witness.span",
156
156
  "code": "SIM112",
157
- "message": "Use capitalized environment variable",
157
+ "message": "Write this environment variable name in uppercase, and set the variable under that name wherever it is defined.",
158
158
  "suppress": {
159
159
  "noqa": {
160
160
  "codes": [
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-sim113-enumerate-for-loop",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's SIM113 (enumerate-for-loop): `N += 1` as a top-level statement of a non-async `for` body without `continue`, where the binding `N` reads (`resolves.binding`) is a name assignment of `0` (plain, annotated, or an unpacked element of a display, paired by index as Ruff's match_value where the engine gives no value) whose parent statement is the loop's, `N` is bound only once inside the loop (`binds` with `bindings` within the loop: deletions and comprehension walruses count, comprehension targets, nested functions' locals and keyword arguments do not), and no load of `N` outside the loop in its scope, at or after the initial assignment, reads the initial binding (whose references Ruff's rebinding inherits) or a binding inside the loop. The loop and the initial assignment are found again by node identity (`compare` with `text: \"node\"`), so identical loops in one scope stay apart.",
6
+ "description": "Use enumerate() instead of a counter that starts at 0 and is incremented by hand in each pass of a for loop.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*"
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-sim208-double-negation",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's SIM208 (double-negation): `not` applied to another `not` expression, through any parentheses, reported on the outer `not` expression (each outer `not` of a longer chain).",
6
+ "description": "Remove double negation with not not; use the value itself, or bool() if you need a real boolean.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*"
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-sim210-if-expr-with-true-false",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's SIM210 (if-expr-with-true-false): a conditional expression whose body is the literal `True` and whose `else` arm is `False` (through any parentheses), reported on the whole expression. Ruff's message and fix differ when the test is a comparison or `bool` is shadowed; what is flagged does not.",
6
+ "description": "Use bool() on the condition instead of a conditional expression that yields True when it holds and False otherwise.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*"
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-sim211-if-expr-with-false-true",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's SIM211 (if-expr-with-false-true): a conditional expression whose body is the literal `False` and whose `else` arm is `True` (through any parentheses), reported on the whole expression.",
6
+ "description": "Use not on the condition instead of a conditional expression that yields False when it holds and True otherwise.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*"
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-sim212-if-expr-with-twisted-arms",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's SIM212 (if-expr-with-twisted-arms): `B if not A else A` where the negated test operand and the `else` arm are the same plain name (through any parentheses), reported on the whole expression.",
6
+ "description": "Swap the arms of a conditional expression that tests not x and falls back to x, so the test reads x without the negation.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*"
@@ -81,7 +81,7 @@
81
81
  "violation": {
82
82
  "anchor": "witness.span",
83
83
  "code": "SIM212",
84
- "message": "Use `$A if $A else ...` instead of `... if not $A else $A`",
84
+ "message": "Swap the arms to read `$A if $A else ...`, dropping the `not` from `... if not $A else $A`.",
85
85
  "suppress": {
86
86
  "noqa": {
87
87
  "codes": [
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-sim300-yoda-conditions",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's SIM300 (yoda-conditions): a comparison with one `==`, `!=`, `<`, `<=`, `>` or `>=` whose left operand is more constant-like than its right, on Ruff's three levels (`ConstantLikelihood`, flake8_simplify/rules/yoda_conditions.rs:76-136): literals (not f- or t-strings) are definite; a name or attribute whose name is cased uppercase is probable; tuples, lists and dicts (keys and values, `**` values), binary operations and unary `+`/`-`/`~` take the least of their parts (empty is definite); everything else, sets included, is unlikely. Reported on the comparison.",
6
+ "description": "Put the variable first and the constant or literal second in comparisons, avoiding Yoda conditions; it reads the way you would say it.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*"
@@ -473,7 +473,7 @@
473
473
  "violation": {
474
474
  "anchor": "witness.span",
475
475
  "code": "SIM300",
476
- "message": "Yoda condition detected",
476
+ "message": "Swap the comparison so the variable comes first and the constant second, as in `x == 1`.",
477
477
  "suppress": {
478
478
  "noqa": {
479
479
  "codes": [
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-sim905-split-static-string",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's SIM905 (split-static-string): `.split(...)` or `.rsplit(...)` called on a str literal (implicit concatenations included; not bytes, f- or t-strings), where `sep` (keyword, else first positional argument) is absent, `None` or a str literal, and `maxsplit` (keyword, else second positional argument) is absent or an integer literal, optionally negated, that fits in an i32 (`get_maxsplit_value`). Reported on the call.",
6
+ "description": "Use a list literal instead of calling split() or rsplit() on a string literal; the result is known in advance.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*"
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-sim910-dict-get-with-none-default",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's SIM910 (dict-get-with-none-default): `.get(key, None, ...)` whose second positional argument is `None`, with no keywords, called on a dict display or dict comprehension (through parentheses), or on a name whose binding is a dict (Ruff's `is_dict` through `resolves.binding`: a `def`'s `**kwargs`, a dict-typed value or `dict(...)`, a `dict`/`Dict` annotation or return annotation; unpacking carries no value).",
6
+ "description": "Drop the redundant None default from dict.get() calls; get() already returns None for a missing key.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*"
@@ -3,7 +3,7 @@
3
3
  "id": "ruff-t100-debugger",
4
4
  "revision": 1,
5
5
  "mode": "steer",
6
- "description": "Port of Ruff's T100 (debugger): imports of debugger modules (`is_debugger_import`) and of debugger functions (`from M import n` with `M.n` in `is_debugger_call`), once per imported name, matched by module with `resolves.imported`, relative imports by the module's text (`relative: \"text\"`: Ruff ignores the level). It also flags calls whose callee resolves to a debugger function (`resolve_qualified_name` through the file's imports, or the builtin `breakpoint`).",
6
+ "description": "Remove debugger imports and calls such as pdb.set_trace() and breakpoint() before committing.",
7
7
  "scope": {
8
8
  "include": [
9
9
  "**/*"
@@ -106,7 +106,7 @@
106
106
  "violation": {
107
107
  "anchor": "witness.span",
108
108
  "code": "T100",
109
- "message": "Import for a debugger found",
109
+ "message": "Remove this debugger import of `$D` before committing.",
110
110
  "each": "D",
111
111
  "suppress": {
112
112
  "noqa": {
@@ -183,7 +183,7 @@
183
183
  "violation": {
184
184
  "anchor": "witness.span",
185
185
  "code": "T100",
186
- "message": "Trace found: debugger used",
186
+ "message": "Remove this debugger call before committing.",
187
187
  "suppress": {
188
188
  "noqa": {
189
189
  "codes": [
@@ -1,73 +0,0 @@
1
- {
2
- "format": "rerail.policy/v1",
3
- "id": "bandit-b406-import-xml-sax",
4
- "revision": 2,
5
- "mode": "steer",
6
- "description": "Detect direct imports of xml.sax. Port of Bandit 1.9.4's B406 import_xml_sax. Divergence: an import of only xml.sax.saxutils (`from xml.sax.saxutils import ...`, `from xml.sax import saxutils`, aliased or parenthesised) is not reported. saxutils holds XML writing and escaping helpers (escape, quoteattr, unescape, XMLGenerator) and no parser, so defusedxml, which the steer points to, has nothing to replace it with. `import xml.sax.saxutils` is still reported, since it also binds xml.sax and its parse functions (NER-1827).",
7
- "scope": {
8
- "include": [
9
- "**/*.py"
10
- ],
11
- "exclude": []
12
- },
13
- "clauses": [
14
- {
15
- "id": "B406",
16
- "forbid": {
17
- "ast": {
18
- "language": "python",
19
- "rule": {
20
- "any": [
21
- {
22
- "pattern": "import xml.sax"
23
- },
24
- {
25
- "pattern": "import xml.sax as $ALIAS"
26
- },
27
- {
28
- "pattern": "from xml.sax import $$$NAMES"
29
- },
30
- {
31
- "pattern": "from xml import sax"
32
- },
33
- {
34
- "pattern": "from xml import sax as $ALIAS"
35
- }
36
- ],
37
- "not": {
38
- "any": [
39
- {
40
- "pattern": "from xml.sax.saxutils import $$$NAMES"
41
- },
42
- {
43
- "pattern": "from xml.sax import saxutils"
44
- },
45
- {
46
- "pattern": "from xml.sax import saxutils as $ALIAS"
47
- },
48
- {
49
- "pattern": "from xml.sax import (saxutils)"
50
- },
51
- {
52
- "pattern": "from xml.sax import (saxutils as $ALIAS)"
53
- }
54
- ]
55
- }
56
- }
57
- }
58
- },
59
- "violation": {
60
- "code": "B406",
61
- "anchor": "witness.span",
62
- "message": "xml.sax parsing may be vulnerable to XML attacks; use defusedxml or defuse the standard library.",
63
- "suppress": {
64
- "nosec": {
65
- "codes": [
66
- "B406"
67
- ]
68
- }
69
- }
70
- }
71
- }
72
- ]
73
- }
@@ -1,268 +0,0 @@
1
- {
2
- "format": "rerail.policy/v1",
3
- "id": "bandit-b610-django-extra-used",
4
- "revision": 2,
5
- "mode": "steer",
6
- "description": "Port of Bandit 1.9.4's B610 django_extra_used: a call of `extra` whose `where` or `tables` is not a list of plain strings, or whose `select` is not a dict of plain strings, bound to QuerySet.extra's six positional slots. Port of the kernel test b610_extra_with_a_non_literal_where_tables_or_select. Bandit's `# nosec` is honoured (`suppress.nosec`), as its recordings honour it. Divergence: Bandit reports a call of any function or method named `extra`; the port reports only a method call whose receiver looks like a Django QuerySet or Manager: a name or attribute named `objects`, `qs`, `QS`, `queryset`, `querysets`, `manager` or `managers`, alone or after an underscore-joined prefix (`User.objects`, `self.queryset`, `base_qs`, `_default_manager`); a call of `get_queryset`; a method call on such a receiver (`User.objects.filter(...)`); or `self` or `super()` inside a class with a base whose name ends in `QuerySet` (`QuerySet`, `SoftDeleteQuerySet`, `TreeQuerySet`) or is `Manager`, `BaseManager` or `BaseUserManager`, optionally dotted (`models.QuerySet`); a base that only ends in `Manager` (`AbstractContextManager`, `PluginManager`, `TreeManager`) does not count. A bare `extra(...)` call and `extra` on any other receiver (`parser.extra(...)`, `self.extra(...)` in an unrelated class) are not reported (NER-1827).",
7
- "scope": {
8
- "include": [
9
- "**/*"
10
- ],
11
- "exclude": []
12
- },
13
- "clauses": [
14
- {
15
- "id": "django-extra-used",
16
- "forbid": {
17
- "ast": {
18
- "language": "python",
19
- "rule": {
20
- "any": [
21
- {
22
- "pattern": "$R.extra($$$)"
23
- }
24
- ],
25
- "all": [
26
- {
27
- "has": {
28
- "field": "function",
29
- "has": {
30
- "field": "object",
31
- "matches": "queryset-receiver"
32
- }
33
- }
34
- },
35
- {
36
- "any": [
37
- {
38
- "arguments": {
39
- "signature": [
40
- "select",
41
- "where",
42
- "params",
43
- "tables",
44
- "order_by",
45
- "select_params"
46
- ],
47
- "bind": {
48
- "W": "where"
49
- }
50
- },
51
- "has": {
52
- "stopBy": "end",
53
- "pattern": "$W",
54
- "not": {
55
- "matches": "strings"
56
- }
57
- }
58
- },
59
- {
60
- "arguments": {
61
- "signature": [
62
- "select",
63
- "where",
64
- "params",
65
- "tables",
66
- "order_by",
67
- "select_params"
68
- ],
69
- "bind": {
70
- "T": "tables"
71
- }
72
- },
73
- "has": {
74
- "stopBy": "end",
75
- "pattern": "$T",
76
- "not": {
77
- "matches": "strings"
78
- }
79
- }
80
- },
81
- {
82
- "arguments": {
83
- "signature": [
84
- "select",
85
- "where",
86
- "params",
87
- "tables",
88
- "order_by",
89
- "select_params"
90
- ],
91
- "bind": {
92
- "S": "select"
93
- }
94
- },
95
- "has": {
96
- "stopBy": "end",
97
- "pattern": "$S",
98
- "not": {
99
- "matches": "string-pairs"
100
- }
101
- }
102
- }
103
- ]
104
- }
105
- ]
106
- },
107
- "utils": {
108
- "queryset-receiver": {
109
- "any": [
110
- {
111
- "kind": "identifier",
112
- "regex": "^(?:[A-Za-z0-9_]*_)?(?:qs|QS|querysets?|objects|managers?)$"
113
- },
114
- {
115
- "kind": "attribute",
116
- "has": {
117
- "field": "attribute",
118
- "regex": "^(?:[A-Za-z0-9_]*_)?(?:qs|QS|querysets?|objects|managers?)$"
119
- }
120
- },
121
- {
122
- "kind": "call",
123
- "has": {
124
- "field": "function",
125
- "kind": "attribute",
126
- "has": {
127
- "field": "object",
128
- "matches": "queryset-receiver"
129
- }
130
- }
131
- },
132
- {
133
- "kind": "call",
134
- "has": {
135
- "field": "function",
136
- "any": [
137
- {
138
- "kind": "identifier",
139
- "regex": "^get_queryset$"
140
- },
141
- {
142
- "kind": "attribute",
143
- "has": {
144
- "field": "attribute",
145
- "regex": "^get_queryset$"
146
- }
147
- }
148
- ]
149
- }
150
- },
151
- {
152
- "any": [
153
- {
154
- "kind": "identifier",
155
- "regex": "^self$"
156
- },
157
- {
158
- "pattern": "super()"
159
- }
160
- ],
161
- "inside": {
162
- "stopBy": "end",
163
- "kind": "class_definition",
164
- "has": {
165
- "field": "superclasses",
166
- "regex": "(?:^|[(,\\s])(?:[A-Za-z_][A-Za-z0-9_]*\\.)*(?:[A-Za-z0-9_]*QuerySet|Manager|BaseManager|BaseUserManager)\\b"
167
- }
168
- }
169
- }
170
- ]
171
- },
172
- "string": {
173
- "any": [
174
- {
175
- "kind": "string",
176
- "not": {
177
- "regex": "^[A-Za-z]*[fFbBtT]"
178
- }
179
- },
180
- {
181
- "kind": "concatenated_string",
182
- "not": {
183
- "has": {
184
- "kind": "string",
185
- "regex": "^[A-Za-z]*[fFbBtT]"
186
- }
187
- }
188
- }
189
- ]
190
- },
191
- "strings": {
192
- "kind": "list",
193
- "not": {
194
- "has": {
195
- "stopBy": "neighbor",
196
- "not": {
197
- "any": [
198
- {
199
- "matches": "string"
200
- },
201
- {
202
- "regex": "^[\\[\\],]$"
203
- },
204
- {
205
- "kind": "comment"
206
- }
207
- ]
208
- }
209
- }
210
- }
211
- },
212
- "string-pairs": {
213
- "kind": "dictionary",
214
- "not": {
215
- "has": {
216
- "stopBy": "neighbor",
217
- "not": {
218
- "any": [
219
- {
220
- "kind": "pair",
221
- "not": {
222
- "has": {
223
- "stopBy": "neighbor",
224
- "not": {
225
- "any": [
226
- {
227
- "matches": "string"
228
- },
229
- {
230
- "regex": "^:$"
231
- },
232
- {
233
- "kind": "comment"
234
- }
235
- ]
236
- }
237
- }
238
- }
239
- },
240
- {
241
- "regex": "^[{},]$"
242
- },
243
- {
244
- "kind": "comment"
245
- }
246
- ]
247
- }
248
- }
249
- }
250
- }
251
- }
252
- }
253
- },
254
- "violation": {
255
- "anchor": "witness.span",
256
- "code": "B610",
257
- "message": "Bandit B610 (django-extra-used)",
258
- "suppress": {
259
- "nosec": {
260
- "codes": [
261
- "B610"
262
- ]
263
- }
264
- }
265
- }
266
- }
267
- ]
268
- }