@neralabs/rerail-pack-python 0.1.1

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 (147) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +7 -0
  3. package/README.md +36 -0
  4. package/licenses/bandit/LICENSE +175 -0
  5. package/licenses/bandit/UPSTREAM.md +100 -0
  6. package/licenses/ruff/LICENSE +430 -0
  7. package/licenses/ruff/UPSTREAM.md +338 -0
  8. package/pack.json +912 -0
  9. package/package.json +30 -0
  10. package/rules/bandit-b101-assert-used.json +38 -0
  11. package/rules/bandit-b102-exec-used.json +125 -0
  12. package/rules/bandit-b110-try-except-pass.json +109 -0
  13. package/rules/bandit-b112-try-except-continue.json +109 -0
  14. package/rules/bandit-b113-request-without-timeout.json +138 -0
  15. package/rules/bandit-b301-pickle.json +58 -0
  16. package/rules/bandit-b302-marshal.json +48 -0
  17. package/rules/bandit-b303-md5.json +79 -0
  18. package/rules/bandit-b305-cipher-modes.json +47 -0
  19. package/rules/bandit-b306-mktemp-q.json +54 -0
  20. package/rules/bandit-b307-eval.json +125 -0
  21. package/rules/bandit-b308-mark-safe.json +47 -0
  22. package/rules/bandit-b310-urllib-urlopen.json +54 -0
  23. package/rules/bandit-b311-random.json +57 -0
  24. package/rules/bandit-b312-telnetlib.json +47 -0
  25. package/rules/bandit-b313-xml-bad-celementtree.json +50 -0
  26. package/rules/bandit-b314-xml-bad-elementtree.json +50 -0
  27. package/rules/bandit-b315-xml-bad-expatreader.json +47 -0
  28. package/rules/bandit-b316-xml-bad-expatbuilder.json +48 -0
  29. package/rules/bandit-b317-xml-bad-sax.json +58 -0
  30. package/rules/bandit-b318-xml-bad-minidom.json +48 -0
  31. package/rules/bandit-b319-xml-bad-pulldom.json +48 -0
  32. package/rules/bandit-b321-ftplib.json +47 -0
  33. package/rules/bandit-b323-unverified-context.json +47 -0
  34. package/rules/bandit-b401-import-telnetlib.json +48 -0
  35. package/rules/bandit-b402-import-ftplib.json +48 -0
  36. package/rules/bandit-b405-import-xml-etree.json +69 -0
  37. package/rules/bandit-b406-import-xml-sax.json +73 -0
  38. package/rules/bandit-b407-import-xml-expat.json +54 -0
  39. package/rules/bandit-b408-import-xml-minidom.json +54 -0
  40. package/rules/bandit-b409-import-xml-pulldom.json +54 -0
  41. package/rules/bandit-b411-import-xmlrpclib.json +48 -0
  42. package/rules/bandit-b413-import-pycrypto.json +159 -0
  43. package/rules/bandit-b415-import-pyghmi.json +48 -0
  44. package/rules/bandit-b502-ssl-with-bad-version.json +90 -0
  45. package/rules/bandit-b505-weak-cryptographic-key.json +166 -0
  46. package/rules/bandit-b507-ssh-no-host-key-verification.json +210 -0
  47. package/rules/bandit-b606-start-process-with-no-shell.json +63 -0
  48. package/rules/bandit-b610-django-extra-used.json +268 -0
  49. package/rules/bandit-b615-huggingface-unsafe-download.json +1152 -0
  50. package/rules/ruff-async100-cancel-scope-no-checkpoint.json +357 -0
  51. package/rules/ruff-async105-trio-sync-call.json +199 -0
  52. package/rules/ruff-async115-async-zero-sleep.json +264 -0
  53. package/rules/ruff-async116-long-sleep-not-forever.json +267 -0
  54. package/rules/ruff-async210-blocking-http-call-in-async-function.json +161 -0
  55. package/rules/ruff-async221-run-process-in-async-function.json +342 -0
  56. package/rules/ruff-async222-wait-for-process-in-async-function.json +144 -0
  57. package/rules/ruff-async230-blocking-open-call-in-async-function.json +339 -0
  58. package/rules/ruff-async250-blocking-input-in-async-function.json +143 -0
  59. package/rules/ruff-async251-blocking-sleep-in-async-function.json +140 -0
  60. package/rules/ruff-b002-unary-prefix-increment-decrement.json +54 -0
  61. package/rules/ruff-b003-assignment-to-os-environ.json +54 -0
  62. package/rules/ruff-b004-unreliable-callable-check.json +171 -0
  63. package/rules/ruff-b005-strip-with-multi-characters.json +131 -0
  64. package/rules/ruff-b007-unused-loop-control-variable.json +368 -0
  65. package/rules/ruff-b009-get-attr-with-constant.json +190 -0
  66. package/rules/ruff-b010-set-attr-with-constant.json +219 -0
  67. package/rules/ruff-b011-assert-false.json +62 -0
  68. package/rules/ruff-b013-redundant-tuple-in-exception-handler.json +94 -0
  69. package/rules/ruff-b014-duplicate-handler-exception.json +126 -0
  70. package/rules/ruff-b016-raise-literal.json +47 -0
  71. package/rules/ruff-b020-loop-variable-overrides-iterator.json +341 -0
  72. package/rules/ruff-b021-f-string-docstring.json +48 -0
  73. package/rules/ruff-b022-useless-contextlib-suppress.json +95 -0
  74. package/rules/ruff-b023-function-uses-loop-variable.json +560 -0
  75. package/rules/ruff-b025-duplicate-try-block-exception.json +182 -0
  76. package/rules/ruff-b026-star-arg-unpacking-after-keyword-arg.json +57 -0
  77. package/rules/ruff-b028-no-explicit-stacklevel.json +177 -0
  78. package/rules/ruff-b029-except-with-empty-tuple.json +102 -0
  79. package/rules/ruff-b032-unintentional-type-annotation.json +157 -0
  80. package/rules/ruff-b033-duplicate-value.json +129 -0
  81. package/rules/ruff-b034-re-sub-positional-args.json +159 -0
  82. package/rules/ruff-b039-mutable-contextvar-default.json +281 -0
  83. package/rules/ruff-b904-raise-without-from-inside-except.json +194 -0
  84. package/rules/ruff-b905-zip-without-explicit-strict.json +429 -0
  85. package/rules/ruff-e711-none-comparison.json +199 -0
  86. package/rules/ruff-e721-type-comparison.json +293 -0
  87. package/rules/ruff-e722-bare-except.json +57 -0
  88. package/rules/ruff-e742-ambiguous-class-name.json +47 -0
  89. package/rules/ruff-e743-ambiguous-function-name.json +47 -0
  90. package/rules/ruff-f403-undefined-local-with-import-star.json +73 -0
  91. package/rules/ruff-f405-undefined-local-with-import-star-usage.json +87 -0
  92. package/rules/ruff-f406-undefined-local-with-nested-import-star-usage.json +39 -0
  93. package/rules/ruff-f407-future-feature-not-defined.json +56 -0
  94. package/rules/ruff-f501-percent-format-invalid-format.json +88 -0
  95. package/rules/ruff-f502-percent-format-expected-mapping.json +127 -0
  96. package/rules/ruff-f503-percent-format-expected-sequence.json +127 -0
  97. package/rules/ruff-f504-percent-format-extra-named-arguments.json +46 -0
  98. package/rules/ruff-f505-percent-format-missing-argument.json +49 -0
  99. package/rules/ruff-f506-percent-format-mixed-positional-and-named.json +114 -0
  100. package/rules/ruff-f507-percent-format-positional-count-mismatch.json +78 -0
  101. package/rules/ruff-f508-percent-format-star-requires-sequence.json +112 -0
  102. package/rules/ruff-f509-percent-format-unsupported-format-character.json +86 -0
  103. package/rules/ruff-f521-string-dot-format-invalid-format.json +83 -0
  104. package/rules/ruff-f522-string-dot-format-extra-named-arguments.json +46 -0
  105. package/rules/ruff-f523-string-dot-format-extra-positional-arguments.json +48 -0
  106. package/rules/ruff-f524-string-dot-format-missing-arguments.json +46 -0
  107. package/rules/ruff-f525-string-dot-format-mixing-automatic.json +99 -0
  108. package/rules/ruff-f541-f-string-missing-placeholders.json +52 -0
  109. package/rules/ruff-f601-multi-value-repeated-key-literal.json +215 -0
  110. package/rules/ruff-f602-multi-value-repeated-key-variable.json +123 -0
  111. package/rules/ruff-f622-multiple-starred-expressions.json +57 -0
  112. package/rules/ruff-f632-is-literal.json +232 -0
  113. package/rules/ruff-f633-invalid-print-syntax.json +299 -0
  114. package/rules/ruff-f701-break-outside-loop.json +64 -0
  115. package/rules/ruff-f702-continue-outside-loop.json +64 -0
  116. package/rules/ruff-f706-return-outside-function.json +61 -0
  117. package/rules/ruff-f707-default-except-not-last.json +50 -0
  118. package/rules/ruff-f722-forward-annotation-syntax-error.json +654 -0
  119. package/rules/ruff-f822-undefined-export.json +55 -0
  120. package/rules/ruff-f823-undefined-local.json +42 -0
  121. package/rules/ruff-f842-unused-annotation.json +51 -0
  122. package/rules/ruff-f901-raise-not-implemented.json +97 -0
  123. package/rules/ruff-pie794-duplicate-class-field-definition.json +157 -0
  124. package/rules/ruff-pie796-non-unique-enums.json +460 -0
  125. package/rules/ruff-pie800-unnecessary-spread.json +62 -0
  126. package/rules/ruff-pie804-unnecessary-dict-kwargs.json +179 -0
  127. package/rules/ruff-pie807-reimplemented-container-builtin.json +100 -0
  128. package/rules/ruff-pie810-multiple-starts-ends-with.json +585 -0
  129. package/rules/ruff-ret501-unnecessary-return-none.json +256 -0
  130. package/rules/ruff-ret502-implicit-return-value.json +163 -0
  131. package/rules/ruff-ret505-superfluous-else-return.json +211 -0
  132. package/rules/ruff-ret506-superfluous-else-raise.json +211 -0
  133. package/rules/ruff-ret507-superfluous-else-continue.json +211 -0
  134. package/rules/ruff-ret508-superfluous-else-break.json +211 -0
  135. package/rules/ruff-sim101-duplicate-isinstance-call.json +384 -0
  136. package/rules/ruff-sim107-return-in-try-except-finally.json +82 -0
  137. package/rules/ruff-sim109-compare-with-tuple.json +205 -0
  138. package/rules/ruff-sim112-uncapitalized-environment-variables.json +168 -0
  139. package/rules/ruff-sim113-enumerate-for-loop.json +562 -0
  140. package/rules/ruff-sim208-double-negation.json +58 -0
  141. package/rules/ruff-sim210-if-expr-with-true-false.json +90 -0
  142. package/rules/ruff-sim211-if-expr-with-false-true.json +90 -0
  143. package/rules/ruff-sim212-if-expr-with-twisted-arms.json +95 -0
  144. package/rules/ruff-sim300-yoda-conditions.json +487 -0
  145. package/rules/ruff-sim905-split-static-string.json +579 -0
  146. package/rules/ruff-sim910-dict-get-with-none-default.json +518 -0
  147. package/rules/ruff-t100-debugger.json +197 -0
@@ -0,0 +1,199 @@
1
+ {
2
+ "format": "rerail.policy/v1",
3
+ "id": "ruff-e711-none-comparison",
4
+ "revision": 1,
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.",
7
+ "scope": {
8
+ "include": [
9
+ "**/*"
10
+ ],
11
+ "exclude": []
12
+ },
13
+ "clauses": [
14
+ {
15
+ "id": "none-comparison",
16
+ "forbid": {
17
+ "ast": {
18
+ "language": "python",
19
+ "utils": {
20
+ "constant": {
21
+ "any": [
22
+ {
23
+ "kind": "string",
24
+ "not": {
25
+ "has": {
26
+ "stopBy": "end",
27
+ "kind": "interpolation"
28
+ }
29
+ }
30
+ },
31
+ {
32
+ "kind": "concatenated_string",
33
+ "not": {
34
+ "has": {
35
+ "stopBy": "end",
36
+ "kind": "interpolation"
37
+ }
38
+ }
39
+ },
40
+ {
41
+ "kind": "integer"
42
+ },
43
+ {
44
+ "kind": "float"
45
+ },
46
+ {
47
+ "kind": "none"
48
+ },
49
+ {
50
+ "kind": "true"
51
+ },
52
+ {
53
+ "kind": "false"
54
+ },
55
+ {
56
+ "kind": "ellipsis"
57
+ },
58
+ {
59
+ "kind": "parenthesized_expression",
60
+ "has": {
61
+ "stopBy": "neighbor",
62
+ "matches": "constant"
63
+ }
64
+ },
65
+ {
66
+ "kind": "tuple",
67
+ "not": {
68
+ "has": {
69
+ "stopBy": "neighbor",
70
+ "not": {
71
+ "any": [
72
+ {
73
+ "matches": "constant"
74
+ },
75
+ {
76
+ "regex": "^[(),]$"
77
+ }
78
+ ]
79
+ }
80
+ }
81
+ }
82
+ }
83
+ ]
84
+ },
85
+ "constant-non-singleton": {
86
+ "all": [
87
+ {
88
+ "matches": "constant"
89
+ },
90
+ {
91
+ "not": {
92
+ "matches": "singleton"
93
+ }
94
+ }
95
+ ]
96
+ },
97
+ "compared-operand": {
98
+ "inside": {
99
+ "stopBy": "neighbor",
100
+ "kind": "comparison_operator"
101
+ },
102
+ "any": [
103
+ {
104
+ "all": [
105
+ {
106
+ "not": {
107
+ "follows": {
108
+ "stopBy": "neighbor",
109
+ "regex": "(?s)."
110
+ }
111
+ }
112
+ },
113
+ {
114
+ "precedes": {
115
+ "stopBy": "neighbor",
116
+ "regex": "^(==|!=)$",
117
+ "precedes": {
118
+ "stopBy": "neighbor",
119
+ "not": {
120
+ "matches": "constant-non-singleton"
121
+ }
122
+ }
123
+ }
124
+ }
125
+ ]
126
+ },
127
+ {
128
+ "follows": {
129
+ "stopBy": "neighbor",
130
+ "regex": "^(==|!=)$",
131
+ "follows": {
132
+ "stopBy": "neighbor",
133
+ "not": {
134
+ "matches": "constant-non-singleton"
135
+ }
136
+ }
137
+ }
138
+ }
139
+ ]
140
+ },
141
+ "operand": {
142
+ "any": [
143
+ {
144
+ "matches": "compared-operand"
145
+ },
146
+ {
147
+ "inside": {
148
+ "stopBy": "neighbor",
149
+ "kind": "parenthesized_expression",
150
+ "matches": "operand"
151
+ }
152
+ }
153
+ ]
154
+ },
155
+ "singleton": {
156
+ "any": [
157
+ {
158
+ "kind": "none"
159
+ },
160
+ {
161
+ "kind": "true"
162
+ },
163
+ {
164
+ "kind": "false"
165
+ },
166
+ {
167
+ "kind": "ellipsis"
168
+ },
169
+ {
170
+ "kind": "parenthesized_expression",
171
+ "has": {
172
+ "stopBy": "neighbor",
173
+ "matches": "singleton"
174
+ }
175
+ }
176
+ ]
177
+ }
178
+ },
179
+ "rule": {
180
+ "kind": "none",
181
+ "matches": "operand"
182
+ }
183
+ }
184
+ },
185
+ "violation": {
186
+ "anchor": "witness.span",
187
+ "code": "E711",
188
+ "message": "Comparison to `None` should be `cond is None`",
189
+ "suppress": {
190
+ "noqa": {
191
+ "codes": [
192
+ "E711"
193
+ ]
194
+ }
195
+ }
196
+ }
197
+ }
198
+ ]
199
+ }
@@ -0,0 +1,293 @@
1
+ {
2
+ "format": "rerail.policy/v1",
3
+ "id": "ruff-e721-type-comparison",
4
+ "revision": 1,
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).",
7
+ "scope": {
8
+ "include": [
9
+ "**/*"
10
+ ],
11
+ "exclude": []
12
+ },
13
+ "clauses": [
14
+ {
15
+ "id": "type-comparison",
16
+ "forbid": {
17
+ "ast": {
18
+ "language": "python",
19
+ "utils": {
20
+ "type-callee": {
21
+ "any": [
22
+ {
23
+ "any": [
24
+ {
25
+ "kind": "identifier"
26
+ },
27
+ {
28
+ "kind": "attribute"
29
+ }
30
+ ],
31
+ "resolves": {
32
+ "global": [
33
+ "type"
34
+ ],
35
+ "import": [
36
+ "builtins.type"
37
+ ]
38
+ }
39
+ },
40
+ {
41
+ "kind": "parenthesized_expression",
42
+ "has": {
43
+ "stopBy": "neighbor",
44
+ "matches": "type-callee"
45
+ }
46
+ }
47
+ ]
48
+ },
49
+ "is-type": {
50
+ "any": [
51
+ {
52
+ "kind": "call",
53
+ "has": {
54
+ "stopBy": "neighbor",
55
+ "not": {
56
+ "follows": {
57
+ "stopBy": "neighbor",
58
+ "regex": "(?s)."
59
+ }
60
+ },
61
+ "matches": "type-callee"
62
+ }
63
+ },
64
+ {
65
+ "kind": "identifier",
66
+ "resolves": {
67
+ "global": [
68
+ "bool",
69
+ "bytearray",
70
+ "bytes",
71
+ "classmethod",
72
+ "complex",
73
+ "dict",
74
+ "enumerate",
75
+ "filter",
76
+ "float",
77
+ "frozenset",
78
+ "int",
79
+ "list",
80
+ "map",
81
+ "memoryview",
82
+ "object",
83
+ "property",
84
+ "range",
85
+ "reversed",
86
+ "set",
87
+ "slice",
88
+ "staticmethod",
89
+ "str",
90
+ "super",
91
+ "tuple",
92
+ "type",
93
+ "zip",
94
+ "ArithmeticError",
95
+ "AssertionError",
96
+ "AttributeError",
97
+ "BaseException",
98
+ "BlockingIOError",
99
+ "BrokenPipeError",
100
+ "BufferError",
101
+ "BytesWarning",
102
+ "ChildProcessError",
103
+ "ConnectionAbortedError",
104
+ "ConnectionError",
105
+ "ConnectionRefusedError",
106
+ "ConnectionResetError",
107
+ "DeprecationWarning",
108
+ "EnvironmentError",
109
+ "EOFError",
110
+ "Exception",
111
+ "FileExistsError",
112
+ "FileNotFoundError",
113
+ "FloatingPointError",
114
+ "FutureWarning",
115
+ "GeneratorExit",
116
+ "ImportError",
117
+ "ImportWarning",
118
+ "IndentationError",
119
+ "IndexError",
120
+ "InterruptedError",
121
+ "IOError",
122
+ "IsADirectoryError",
123
+ "KeyboardInterrupt",
124
+ "KeyError",
125
+ "LookupError",
126
+ "MemoryError",
127
+ "ModuleNotFoundError",
128
+ "NameError",
129
+ "NotADirectoryError",
130
+ "NotImplementedError",
131
+ "OSError",
132
+ "OverflowError",
133
+ "PendingDeprecationWarning",
134
+ "PermissionError",
135
+ "ProcessLookupError",
136
+ "RecursionError",
137
+ "ReferenceError",
138
+ "ResourceWarning",
139
+ "RuntimeError",
140
+ "RuntimeWarning",
141
+ "StopAsyncIteration",
142
+ "StopIteration",
143
+ "SyntaxError",
144
+ "SyntaxWarning",
145
+ "SystemError",
146
+ "SystemExit",
147
+ "TabError",
148
+ "TimeoutError",
149
+ "TypeError",
150
+ "UnboundLocalError",
151
+ "UnicodeDecodeError",
152
+ "UnicodeEncodeError",
153
+ "UnicodeError",
154
+ "UnicodeTranslateError",
155
+ "UnicodeWarning",
156
+ "UserWarning",
157
+ "ValueError",
158
+ "Warning",
159
+ "ZeroDivisionError"
160
+ ]
161
+ }
162
+ },
163
+ {
164
+ "kind": "parenthesized_expression",
165
+ "has": {
166
+ "stopBy": "neighbor",
167
+ "matches": "is-type"
168
+ }
169
+ }
170
+ ]
171
+ },
172
+ "dtype-callee": {
173
+ "any": [
174
+ {
175
+ "any": [
176
+ {
177
+ "kind": "identifier"
178
+ },
179
+ {
180
+ "kind": "attribute"
181
+ }
182
+ ],
183
+ "resolves": {
184
+ "import": [
185
+ "numpy.dtype"
186
+ ]
187
+ }
188
+ },
189
+ {
190
+ "kind": "parenthesized_expression",
191
+ "has": {
192
+ "stopBy": "neighbor",
193
+ "matches": "dtype-callee"
194
+ }
195
+ }
196
+ ]
197
+ },
198
+ "is-dtype": {
199
+ "any": [
200
+ {
201
+ "kind": "attribute",
202
+ "pattern": "$OBJ.dtype"
203
+ },
204
+ {
205
+ "kind": "call",
206
+ "has": {
207
+ "stopBy": "neighbor",
208
+ "not": {
209
+ "follows": {
210
+ "stopBy": "neighbor",
211
+ "regex": "(?s)."
212
+ }
213
+ },
214
+ "matches": "dtype-callee"
215
+ }
216
+ },
217
+ {
218
+ "kind": "parenthesized_expression",
219
+ "has": {
220
+ "stopBy": "neighbor",
221
+ "matches": "is-dtype"
222
+ }
223
+ }
224
+ ]
225
+ },
226
+ "eq-op": {
227
+ "regex": "^(?:==|!=)$"
228
+ },
229
+ "offending-op": {
230
+ "all": [
231
+ {
232
+ "matches": "eq-op"
233
+ },
234
+ {
235
+ "any": [
236
+ {
237
+ "follows": {
238
+ "stopBy": "neighbor",
239
+ "matches": "is-type"
240
+ }
241
+ },
242
+ {
243
+ "precedes": {
244
+ "stopBy": "neighbor",
245
+ "matches": "is-type"
246
+ }
247
+ }
248
+ ]
249
+ },
250
+ {
251
+ "not": {
252
+ "follows": {
253
+ "stopBy": "neighbor",
254
+ "matches": "is-dtype"
255
+ }
256
+ }
257
+ },
258
+ {
259
+ "not": {
260
+ "precedes": {
261
+ "stopBy": "neighbor",
262
+ "matches": "is-dtype"
263
+ }
264
+ }
265
+ }
266
+ ]
267
+ }
268
+ },
269
+ "rule": {
270
+ "matches": "offending-op",
271
+ "inside": {
272
+ "stopBy": "neighbor",
273
+ "kind": "comparison_operator",
274
+ "pattern": "$CMP"
275
+ }
276
+ }
277
+ }
278
+ },
279
+ "violation": {
280
+ "anchor": "capture.CMP",
281
+ "code": "E721",
282
+ "message": "Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks",
283
+ "suppress": {
284
+ "noqa": {
285
+ "codes": [
286
+ "E721"
287
+ ]
288
+ }
289
+ }
290
+ }
291
+ }
292
+ ]
293
+ }
@@ -0,0 +1,57 @@
1
+ {
2
+ "format": "rerail.policy/v1",
3
+ "id": "ruff-e722-bare-except",
4
+ "revision": 1,
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.",
7
+ "scope": {
8
+ "include": [
9
+ "**/*"
10
+ ],
11
+ "exclude": []
12
+ },
13
+ "clauses": [
14
+ {
15
+ "id": "bare-except",
16
+ "forbid": {
17
+ "ast": {
18
+ "language": "python",
19
+ "rule": {
20
+ "regex": "^except$",
21
+ "inside": {
22
+ "stopBy": "neighbor",
23
+ "kind": "except_clause",
24
+ "not": {
25
+ "has": {
26
+ "stopBy": "neighbor",
27
+ "kind": "block",
28
+ "has": {
29
+ "stopBy": "neighbor",
30
+ "kind": "raise_statement",
31
+ "regex": "^raise$"
32
+ }
33
+ }
34
+ }
35
+ },
36
+ "precedes": {
37
+ "stopBy": "neighbor",
38
+ "regex": "^:$"
39
+ }
40
+ }
41
+ }
42
+ },
43
+ "violation": {
44
+ "anchor": "witness.span",
45
+ "code": "E722",
46
+ "message": "Do not use bare `except`",
47
+ "suppress": {
48
+ "noqa": {
49
+ "codes": [
50
+ "E722"
51
+ ]
52
+ }
53
+ }
54
+ }
55
+ }
56
+ ]
57
+ }
@@ -0,0 +1,47 @@
1
+ {
2
+ "format": "rerail.policy/v1",
3
+ "id": "ruff-e742-ambiguous-class-name",
4
+ "revision": 1,
5
+ "mode": "steer",
6
+ "description": "Port of Ruff's E742 (ambiguous-class-name): a class named `l`, `I` or `O`, reported on the name.",
7
+ "scope": {
8
+ "include": [
9
+ "**/*"
10
+ ],
11
+ "exclude": []
12
+ },
13
+ "clauses": [
14
+ {
15
+ "id": "ambiguous-class-name",
16
+ "forbid": {
17
+ "ast": {
18
+ "language": "python",
19
+ "rule": {
20
+ "kind": "identifier",
21
+ "regex": "^(?<NAME>[lIO])$",
22
+ "inside": {
23
+ "stopBy": "neighbor",
24
+ "kind": "class_definition"
25
+ },
26
+ "follows": {
27
+ "stopBy": "neighbor",
28
+ "regex": "^(?:class|def)$"
29
+ }
30
+ }
31
+ }
32
+ },
33
+ "violation": {
34
+ "anchor": "witness.span",
35
+ "code": "E742",
36
+ "message": "Ambiguous class name: `$NAME`",
37
+ "suppress": {
38
+ "noqa": {
39
+ "codes": [
40
+ "E742"
41
+ ]
42
+ }
43
+ }
44
+ }
45
+ }
46
+ ]
47
+ }
@@ -0,0 +1,47 @@
1
+ {
2
+ "format": "rerail.policy/v1",
3
+ "id": "ruff-e743-ambiguous-function-name",
4
+ "revision": 1,
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.",
7
+ "scope": {
8
+ "include": [
9
+ "**/*"
10
+ ],
11
+ "exclude": []
12
+ },
13
+ "clauses": [
14
+ {
15
+ "id": "ambiguous-function-name",
16
+ "forbid": {
17
+ "ast": {
18
+ "language": "python",
19
+ "rule": {
20
+ "kind": "identifier",
21
+ "regex": "^(?<NAME>[lIO])$",
22
+ "inside": {
23
+ "stopBy": "neighbor",
24
+ "kind": "function_definition"
25
+ },
26
+ "follows": {
27
+ "stopBy": "neighbor",
28
+ "regex": "^(?:class|def)$"
29
+ }
30
+ }
31
+ }
32
+ },
33
+ "violation": {
34
+ "anchor": "witness.span",
35
+ "code": "E743",
36
+ "message": "Ambiguous function name: `$NAME`",
37
+ "suppress": {
38
+ "noqa": {
39
+ "codes": [
40
+ "E743"
41
+ ]
42
+ }
43
+ }
44
+ }
45
+ }
46
+ ]
47
+ }