@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.
- package/LICENSE +202 -0
- package/NOTICE +7 -0
- package/README.md +36 -0
- package/licenses/bandit/LICENSE +175 -0
- package/licenses/bandit/UPSTREAM.md +100 -0
- package/licenses/ruff/LICENSE +430 -0
- package/licenses/ruff/UPSTREAM.md +338 -0
- package/pack.json +912 -0
- package/package.json +30 -0
- package/rules/bandit-b101-assert-used.json +38 -0
- package/rules/bandit-b102-exec-used.json +125 -0
- package/rules/bandit-b110-try-except-pass.json +109 -0
- package/rules/bandit-b112-try-except-continue.json +109 -0
- package/rules/bandit-b113-request-without-timeout.json +138 -0
- package/rules/bandit-b301-pickle.json +58 -0
- package/rules/bandit-b302-marshal.json +48 -0
- package/rules/bandit-b303-md5.json +79 -0
- package/rules/bandit-b305-cipher-modes.json +47 -0
- package/rules/bandit-b306-mktemp-q.json +54 -0
- package/rules/bandit-b307-eval.json +125 -0
- package/rules/bandit-b308-mark-safe.json +47 -0
- package/rules/bandit-b310-urllib-urlopen.json +54 -0
- package/rules/bandit-b311-random.json +57 -0
- package/rules/bandit-b312-telnetlib.json +47 -0
- package/rules/bandit-b313-xml-bad-celementtree.json +50 -0
- package/rules/bandit-b314-xml-bad-elementtree.json +50 -0
- package/rules/bandit-b315-xml-bad-expatreader.json +47 -0
- package/rules/bandit-b316-xml-bad-expatbuilder.json +48 -0
- package/rules/bandit-b317-xml-bad-sax.json +58 -0
- package/rules/bandit-b318-xml-bad-minidom.json +48 -0
- package/rules/bandit-b319-xml-bad-pulldom.json +48 -0
- package/rules/bandit-b321-ftplib.json +47 -0
- package/rules/bandit-b323-unverified-context.json +47 -0
- package/rules/bandit-b401-import-telnetlib.json +48 -0
- package/rules/bandit-b402-import-ftplib.json +48 -0
- package/rules/bandit-b405-import-xml-etree.json +69 -0
- package/rules/bandit-b406-import-xml-sax.json +73 -0
- package/rules/bandit-b407-import-xml-expat.json +54 -0
- package/rules/bandit-b408-import-xml-minidom.json +54 -0
- package/rules/bandit-b409-import-xml-pulldom.json +54 -0
- package/rules/bandit-b411-import-xmlrpclib.json +48 -0
- package/rules/bandit-b413-import-pycrypto.json +159 -0
- package/rules/bandit-b415-import-pyghmi.json +48 -0
- package/rules/bandit-b502-ssl-with-bad-version.json +90 -0
- package/rules/bandit-b505-weak-cryptographic-key.json +166 -0
- package/rules/bandit-b507-ssh-no-host-key-verification.json +210 -0
- package/rules/bandit-b606-start-process-with-no-shell.json +63 -0
- package/rules/bandit-b610-django-extra-used.json +268 -0
- package/rules/bandit-b615-huggingface-unsafe-download.json +1152 -0
- package/rules/ruff-async100-cancel-scope-no-checkpoint.json +357 -0
- package/rules/ruff-async105-trio-sync-call.json +199 -0
- package/rules/ruff-async115-async-zero-sleep.json +264 -0
- package/rules/ruff-async116-long-sleep-not-forever.json +267 -0
- package/rules/ruff-async210-blocking-http-call-in-async-function.json +161 -0
- package/rules/ruff-async221-run-process-in-async-function.json +342 -0
- package/rules/ruff-async222-wait-for-process-in-async-function.json +144 -0
- package/rules/ruff-async230-blocking-open-call-in-async-function.json +339 -0
- package/rules/ruff-async250-blocking-input-in-async-function.json +143 -0
- package/rules/ruff-async251-blocking-sleep-in-async-function.json +140 -0
- package/rules/ruff-b002-unary-prefix-increment-decrement.json +54 -0
- package/rules/ruff-b003-assignment-to-os-environ.json +54 -0
- package/rules/ruff-b004-unreliable-callable-check.json +171 -0
- package/rules/ruff-b005-strip-with-multi-characters.json +131 -0
- package/rules/ruff-b007-unused-loop-control-variable.json +368 -0
- package/rules/ruff-b009-get-attr-with-constant.json +190 -0
- package/rules/ruff-b010-set-attr-with-constant.json +219 -0
- package/rules/ruff-b011-assert-false.json +62 -0
- package/rules/ruff-b013-redundant-tuple-in-exception-handler.json +94 -0
- package/rules/ruff-b014-duplicate-handler-exception.json +126 -0
- package/rules/ruff-b016-raise-literal.json +47 -0
- package/rules/ruff-b020-loop-variable-overrides-iterator.json +341 -0
- package/rules/ruff-b021-f-string-docstring.json +48 -0
- package/rules/ruff-b022-useless-contextlib-suppress.json +95 -0
- package/rules/ruff-b023-function-uses-loop-variable.json +560 -0
- package/rules/ruff-b025-duplicate-try-block-exception.json +182 -0
- package/rules/ruff-b026-star-arg-unpacking-after-keyword-arg.json +57 -0
- package/rules/ruff-b028-no-explicit-stacklevel.json +177 -0
- package/rules/ruff-b029-except-with-empty-tuple.json +102 -0
- package/rules/ruff-b032-unintentional-type-annotation.json +157 -0
- package/rules/ruff-b033-duplicate-value.json +129 -0
- package/rules/ruff-b034-re-sub-positional-args.json +159 -0
- package/rules/ruff-b039-mutable-contextvar-default.json +281 -0
- package/rules/ruff-b904-raise-without-from-inside-except.json +194 -0
- package/rules/ruff-b905-zip-without-explicit-strict.json +429 -0
- package/rules/ruff-e711-none-comparison.json +199 -0
- package/rules/ruff-e721-type-comparison.json +293 -0
- package/rules/ruff-e722-bare-except.json +57 -0
- package/rules/ruff-e742-ambiguous-class-name.json +47 -0
- package/rules/ruff-e743-ambiguous-function-name.json +47 -0
- package/rules/ruff-f403-undefined-local-with-import-star.json +73 -0
- package/rules/ruff-f405-undefined-local-with-import-star-usage.json +87 -0
- package/rules/ruff-f406-undefined-local-with-nested-import-star-usage.json +39 -0
- package/rules/ruff-f407-future-feature-not-defined.json +56 -0
- package/rules/ruff-f501-percent-format-invalid-format.json +88 -0
- package/rules/ruff-f502-percent-format-expected-mapping.json +127 -0
- package/rules/ruff-f503-percent-format-expected-sequence.json +127 -0
- package/rules/ruff-f504-percent-format-extra-named-arguments.json +46 -0
- package/rules/ruff-f505-percent-format-missing-argument.json +49 -0
- package/rules/ruff-f506-percent-format-mixed-positional-and-named.json +114 -0
- package/rules/ruff-f507-percent-format-positional-count-mismatch.json +78 -0
- package/rules/ruff-f508-percent-format-star-requires-sequence.json +112 -0
- package/rules/ruff-f509-percent-format-unsupported-format-character.json +86 -0
- package/rules/ruff-f521-string-dot-format-invalid-format.json +83 -0
- package/rules/ruff-f522-string-dot-format-extra-named-arguments.json +46 -0
- package/rules/ruff-f523-string-dot-format-extra-positional-arguments.json +48 -0
- package/rules/ruff-f524-string-dot-format-missing-arguments.json +46 -0
- package/rules/ruff-f525-string-dot-format-mixing-automatic.json +99 -0
- package/rules/ruff-f541-f-string-missing-placeholders.json +52 -0
- package/rules/ruff-f601-multi-value-repeated-key-literal.json +215 -0
- package/rules/ruff-f602-multi-value-repeated-key-variable.json +123 -0
- package/rules/ruff-f622-multiple-starred-expressions.json +57 -0
- package/rules/ruff-f632-is-literal.json +232 -0
- package/rules/ruff-f633-invalid-print-syntax.json +299 -0
- package/rules/ruff-f701-break-outside-loop.json +64 -0
- package/rules/ruff-f702-continue-outside-loop.json +64 -0
- package/rules/ruff-f706-return-outside-function.json +61 -0
- package/rules/ruff-f707-default-except-not-last.json +50 -0
- package/rules/ruff-f722-forward-annotation-syntax-error.json +654 -0
- package/rules/ruff-f822-undefined-export.json +55 -0
- package/rules/ruff-f823-undefined-local.json +42 -0
- package/rules/ruff-f842-unused-annotation.json +51 -0
- package/rules/ruff-f901-raise-not-implemented.json +97 -0
- package/rules/ruff-pie794-duplicate-class-field-definition.json +157 -0
- package/rules/ruff-pie796-non-unique-enums.json +460 -0
- package/rules/ruff-pie800-unnecessary-spread.json +62 -0
- package/rules/ruff-pie804-unnecessary-dict-kwargs.json +179 -0
- package/rules/ruff-pie807-reimplemented-container-builtin.json +100 -0
- package/rules/ruff-pie810-multiple-starts-ends-with.json +585 -0
- package/rules/ruff-ret501-unnecessary-return-none.json +256 -0
- package/rules/ruff-ret502-implicit-return-value.json +163 -0
- package/rules/ruff-ret505-superfluous-else-return.json +211 -0
- package/rules/ruff-ret506-superfluous-else-raise.json +211 -0
- package/rules/ruff-ret507-superfluous-else-continue.json +211 -0
- package/rules/ruff-ret508-superfluous-else-break.json +211 -0
- package/rules/ruff-sim101-duplicate-isinstance-call.json +384 -0
- package/rules/ruff-sim107-return-in-try-except-finally.json +82 -0
- package/rules/ruff-sim109-compare-with-tuple.json +205 -0
- package/rules/ruff-sim112-uncapitalized-environment-variables.json +168 -0
- package/rules/ruff-sim113-enumerate-for-loop.json +562 -0
- package/rules/ruff-sim208-double-negation.json +58 -0
- package/rules/ruff-sim210-if-expr-with-true-false.json +90 -0
- package/rules/ruff-sim211-if-expr-with-false-true.json +90 -0
- package/rules/ruff-sim212-if-expr-with-twisted-arms.json +95 -0
- package/rules/ruff-sim300-yoda-conditions.json +487 -0
- package/rules/ruff-sim905-split-static-string.json +579 -0
- package/rules/ruff-sim910-dict-get-with-none-default.json +518 -0
- package/rules/ruff-t100-debugger.json +197 -0
|
@@ -0,0 +1,460 @@
|
|
|
1
|
+
{
|
|
2
|
+
"format": "rerail.policy/v1",
|
|
3
|
+
"id": "ruff-pie796-non-unique-enums",
|
|
4
|
+
"revision": 1,
|
|
5
|
+
"mode": "steer",
|
|
6
|
+
"description": "Port of Ruff's PIE796 (non-unique-enums): in a class with an `enum.Enum` base, a plain assignment whose value equals the value of an earlier assignment in the same body as Ruff's ComparableExpr (`text: \"structure\"`: literals by type and value, `1 == 0x1`, `'a' == \"a\"`, `-1 == -(1)`, not `1 == 1.0 == True`; names compared without NFKC normalization); `enum.auto()` values (alone or in a tuple) are skipped, and in stubs (`.pyi`) so are `...` and `typing.cast(T, ...)`. Ported from the Ruff conformance suite (rerail/conformance/ruff/rules/PIE796.json at 3f102adcb), with Ruff's `# noqa` honoured as the Ruff CLI honours it, and its `.py`/`.pyi` split read per file (`ast.file.path`): the suite's `select_when` gate holds wherever a matching file exists anywhere in the workspace, so in a repository it would read stubs as modules and modules as stubs.",
|
|
7
|
+
"scope": {
|
|
8
|
+
"include": [
|
|
9
|
+
"**/*"
|
|
10
|
+
],
|
|
11
|
+
"exclude": []
|
|
12
|
+
},
|
|
13
|
+
"clauses": [
|
|
14
|
+
{
|
|
15
|
+
"id": "shared",
|
|
16
|
+
"define": {
|
|
17
|
+
"language": "python",
|
|
18
|
+
"utils": {
|
|
19
|
+
"auto-call": {
|
|
20
|
+
"any": [
|
|
21
|
+
{
|
|
22
|
+
"kind": "call",
|
|
23
|
+
"has": {
|
|
24
|
+
"stopBy": "neighbor",
|
|
25
|
+
"not": {
|
|
26
|
+
"follows": {
|
|
27
|
+
"stopBy": "neighbor",
|
|
28
|
+
"regex": "(?s)."
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"matches": "enum-auto"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"kind": "parenthesized_expression",
|
|
36
|
+
"has": {
|
|
37
|
+
"stopBy": "neighbor",
|
|
38
|
+
"matches": "auto-call"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
"enum-auto": {
|
|
44
|
+
"any": [
|
|
45
|
+
{
|
|
46
|
+
"kind": "identifier"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"kind": "attribute"
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
"resolves": {
|
|
53
|
+
"import": [
|
|
54
|
+
"enum.auto"
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"enum-base": {
|
|
59
|
+
"any": [
|
|
60
|
+
{
|
|
61
|
+
"kind": "identifier"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"kind": "attribute"
|
|
65
|
+
}
|
|
66
|
+
],
|
|
67
|
+
"resolves": {
|
|
68
|
+
"import": [
|
|
69
|
+
"enum.Enum"
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"id": "non-unique-enums",
|
|
78
|
+
"forbid": {
|
|
79
|
+
"ast": {
|
|
80
|
+
"language": "python",
|
|
81
|
+
"utils": {
|
|
82
|
+
"member": {
|
|
83
|
+
"params": [
|
|
84
|
+
"X"
|
|
85
|
+
],
|
|
86
|
+
"rule": {
|
|
87
|
+
"kind": "expression_statement",
|
|
88
|
+
"has": {
|
|
89
|
+
"stopBy": "neighbor",
|
|
90
|
+
"kind": "assignment",
|
|
91
|
+
"not": {
|
|
92
|
+
"has": {
|
|
93
|
+
"stopBy": "neighbor",
|
|
94
|
+
"regex": "^:$"
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
"has": {
|
|
98
|
+
"stopBy": {
|
|
99
|
+
"not": {
|
|
100
|
+
"kind": "assignment"
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
"follows": {
|
|
104
|
+
"stopBy": "neighbor",
|
|
105
|
+
"regex": "^=$"
|
|
106
|
+
},
|
|
107
|
+
"not": {
|
|
108
|
+
"kind": "assignment"
|
|
109
|
+
},
|
|
110
|
+
"pattern": "$X",
|
|
111
|
+
"all": [
|
|
112
|
+
{
|
|
113
|
+
"not": {
|
|
114
|
+
"any": [
|
|
115
|
+
{
|
|
116
|
+
"matches": "auto-call"
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"any": [
|
|
120
|
+
{
|
|
121
|
+
"any": [
|
|
122
|
+
{
|
|
123
|
+
"kind": "tuple"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"kind": "expression_list"
|
|
127
|
+
}
|
|
128
|
+
]
|
|
129
|
+
}
|
|
130
|
+
],
|
|
131
|
+
"has": {
|
|
132
|
+
"stopBy": "neighbor",
|
|
133
|
+
"matches": "auto-call"
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
]
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
]
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
"rule": {
|
|
146
|
+
"all": [
|
|
147
|
+
{
|
|
148
|
+
"matches": {
|
|
149
|
+
"member": {
|
|
150
|
+
"X": "$V"
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"count": {
|
|
156
|
+
"follows": {
|
|
157
|
+
"stopBy": "end",
|
|
158
|
+
"matches": {
|
|
159
|
+
"member": {
|
|
160
|
+
"X": "$U"
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
"compare": {
|
|
164
|
+
"left": "U",
|
|
165
|
+
"op": "eq",
|
|
166
|
+
"right": "V",
|
|
167
|
+
"text": "structure"
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
"min": 1
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
],
|
|
174
|
+
"inside": {
|
|
175
|
+
"stopBy": "neighbor",
|
|
176
|
+
"kind": "block",
|
|
177
|
+
"inside": {
|
|
178
|
+
"stopBy": "neighbor",
|
|
179
|
+
"kind": "class_definition",
|
|
180
|
+
"has": {
|
|
181
|
+
"stopBy": "neighbor",
|
|
182
|
+
"kind": "argument_list",
|
|
183
|
+
"has": {
|
|
184
|
+
"stopBy": "neighbor",
|
|
185
|
+
"matches": "enum-base"
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
"file": {
|
|
192
|
+
"path": {
|
|
193
|
+
"regex": "\\.py$"
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
"violation": {
|
|
199
|
+
"anchor": "witness.span",
|
|
200
|
+
"code": "PIE796",
|
|
201
|
+
"message": "Enum contains duplicate value: `$V`",
|
|
202
|
+
"suppress": {
|
|
203
|
+
"noqa": {
|
|
204
|
+
"codes": [
|
|
205
|
+
"PIE796"
|
|
206
|
+
]
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
"id": "non-unique-enums-stub",
|
|
213
|
+
"forbid": {
|
|
214
|
+
"ast": {
|
|
215
|
+
"language": "python",
|
|
216
|
+
"utils": {
|
|
217
|
+
"member": {
|
|
218
|
+
"params": [
|
|
219
|
+
"X"
|
|
220
|
+
],
|
|
221
|
+
"rule": {
|
|
222
|
+
"kind": "expression_statement",
|
|
223
|
+
"has": {
|
|
224
|
+
"stopBy": "neighbor",
|
|
225
|
+
"kind": "assignment",
|
|
226
|
+
"not": {
|
|
227
|
+
"has": {
|
|
228
|
+
"stopBy": "neighbor",
|
|
229
|
+
"regex": "^:$"
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
"has": {
|
|
233
|
+
"stopBy": {
|
|
234
|
+
"not": {
|
|
235
|
+
"kind": "assignment"
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
"follows": {
|
|
239
|
+
"stopBy": "neighbor",
|
|
240
|
+
"regex": "^=$"
|
|
241
|
+
},
|
|
242
|
+
"not": {
|
|
243
|
+
"kind": "assignment"
|
|
244
|
+
},
|
|
245
|
+
"pattern": "$X",
|
|
246
|
+
"all": [
|
|
247
|
+
{
|
|
248
|
+
"not": {
|
|
249
|
+
"any": [
|
|
250
|
+
{
|
|
251
|
+
"any": [
|
|
252
|
+
{
|
|
253
|
+
"matches": "auto-call"
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
"any": [
|
|
257
|
+
{
|
|
258
|
+
"any": [
|
|
259
|
+
{
|
|
260
|
+
"kind": "tuple"
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
"kind": "expression_list"
|
|
264
|
+
}
|
|
265
|
+
]
|
|
266
|
+
}
|
|
267
|
+
],
|
|
268
|
+
"has": {
|
|
269
|
+
"stopBy": "neighbor",
|
|
270
|
+
"matches": "auto-call"
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
]
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
"matches": "unknown-value"
|
|
277
|
+
}
|
|
278
|
+
]
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
]
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
},
|
|
286
|
+
"typing-cast": {
|
|
287
|
+
"any": [
|
|
288
|
+
{
|
|
289
|
+
"kind": "identifier"
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
"kind": "attribute"
|
|
293
|
+
}
|
|
294
|
+
],
|
|
295
|
+
"resolves": {
|
|
296
|
+
"import": [
|
|
297
|
+
"typing.cast",
|
|
298
|
+
"typing_extensions.cast",
|
|
299
|
+
"_typeshed.cast"
|
|
300
|
+
]
|
|
301
|
+
}
|
|
302
|
+
},
|
|
303
|
+
"ellipsis": {
|
|
304
|
+
"any": [
|
|
305
|
+
{
|
|
306
|
+
"kind": "ellipsis"
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
"kind": "parenthesized_expression",
|
|
310
|
+
"has": {
|
|
311
|
+
"stopBy": "neighbor",
|
|
312
|
+
"matches": "ellipsis"
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
]
|
|
316
|
+
},
|
|
317
|
+
"unknown-value": {
|
|
318
|
+
"any": [
|
|
319
|
+
{
|
|
320
|
+
"matches": "ellipsis"
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
"matches": "cast-ellipsis"
|
|
324
|
+
}
|
|
325
|
+
]
|
|
326
|
+
},
|
|
327
|
+
"cast-ellipsis": {
|
|
328
|
+
"any": [
|
|
329
|
+
{
|
|
330
|
+
"kind": "call",
|
|
331
|
+
"all": [
|
|
332
|
+
{
|
|
333
|
+
"has": {
|
|
334
|
+
"stopBy": "neighbor",
|
|
335
|
+
"not": {
|
|
336
|
+
"follows": {
|
|
337
|
+
"stopBy": "neighbor",
|
|
338
|
+
"regex": "(?s)."
|
|
339
|
+
}
|
|
340
|
+
},
|
|
341
|
+
"matches": "typing-cast"
|
|
342
|
+
}
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
"has": {
|
|
346
|
+
"stopBy": "neighbor",
|
|
347
|
+
"kind": "argument_list",
|
|
348
|
+
"count": {
|
|
349
|
+
"has": {
|
|
350
|
+
"stopBy": "neighbor",
|
|
351
|
+
"not": {
|
|
352
|
+
"regex": "^[(),]$"
|
|
353
|
+
}
|
|
354
|
+
},
|
|
355
|
+
"min": 2,
|
|
356
|
+
"max": 2
|
|
357
|
+
},
|
|
358
|
+
"not": {
|
|
359
|
+
"has": {
|
|
360
|
+
"stopBy": "neighbor",
|
|
361
|
+
"any": [
|
|
362
|
+
{
|
|
363
|
+
"kind": "keyword_argument"
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
"kind": "dictionary_splat"
|
|
367
|
+
}
|
|
368
|
+
]
|
|
369
|
+
}
|
|
370
|
+
},
|
|
371
|
+
"has": {
|
|
372
|
+
"stopBy": "neighbor",
|
|
373
|
+
"matches": "ellipsis",
|
|
374
|
+
"follows": {
|
|
375
|
+
"stopBy": "neighbor",
|
|
376
|
+
"regex": "^,$"
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
]
|
|
382
|
+
},
|
|
383
|
+
{
|
|
384
|
+
"kind": "parenthesized_expression",
|
|
385
|
+
"has": {
|
|
386
|
+
"stopBy": "neighbor",
|
|
387
|
+
"matches": "cast-ellipsis"
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
]
|
|
391
|
+
}
|
|
392
|
+
},
|
|
393
|
+
"rule": {
|
|
394
|
+
"all": [
|
|
395
|
+
{
|
|
396
|
+
"matches": {
|
|
397
|
+
"member": {
|
|
398
|
+
"X": "$V"
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
"count": {
|
|
404
|
+
"follows": {
|
|
405
|
+
"stopBy": "end",
|
|
406
|
+
"matches": {
|
|
407
|
+
"member": {
|
|
408
|
+
"X": "$U"
|
|
409
|
+
}
|
|
410
|
+
},
|
|
411
|
+
"compare": {
|
|
412
|
+
"left": "U",
|
|
413
|
+
"op": "eq",
|
|
414
|
+
"right": "V",
|
|
415
|
+
"text": "structure"
|
|
416
|
+
}
|
|
417
|
+
},
|
|
418
|
+
"min": 1
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
],
|
|
422
|
+
"inside": {
|
|
423
|
+
"stopBy": "neighbor",
|
|
424
|
+
"kind": "block",
|
|
425
|
+
"inside": {
|
|
426
|
+
"stopBy": "neighbor",
|
|
427
|
+
"kind": "class_definition",
|
|
428
|
+
"has": {
|
|
429
|
+
"stopBy": "neighbor",
|
|
430
|
+
"kind": "argument_list",
|
|
431
|
+
"has": {
|
|
432
|
+
"stopBy": "neighbor",
|
|
433
|
+
"matches": "enum-base"
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
},
|
|
439
|
+
"file": {
|
|
440
|
+
"path": {
|
|
441
|
+
"regex": "\\.pyi$"
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
},
|
|
446
|
+
"violation": {
|
|
447
|
+
"anchor": "witness.span",
|
|
448
|
+
"code": "PIE796",
|
|
449
|
+
"message": "Enum contains duplicate value: `$V`",
|
|
450
|
+
"suppress": {
|
|
451
|
+
"noqa": {
|
|
452
|
+
"codes": [
|
|
453
|
+
"PIE796"
|
|
454
|
+
]
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
]
|
|
460
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"format": "rerail.policy/v1",
|
|
3
|
+
"id": "ruff-pie800-unnecessary-spread",
|
|
4
|
+
"revision": 1,
|
|
5
|
+
"mode": "steer",
|
|
6
|
+
"description": "Port of Ruff's PIE800 (unnecessary-spread): a dict display spread with `**` into another dict display, reported on the inner dict (inside any parentheses).",
|
|
7
|
+
"scope": {
|
|
8
|
+
"include": [
|
|
9
|
+
"**/*"
|
|
10
|
+
],
|
|
11
|
+
"exclude": []
|
|
12
|
+
},
|
|
13
|
+
"clauses": [
|
|
14
|
+
{
|
|
15
|
+
"id": "unnecessary-spread",
|
|
16
|
+
"forbid": {
|
|
17
|
+
"ast": {
|
|
18
|
+
"language": "python",
|
|
19
|
+
"utils": {
|
|
20
|
+
"spread-slot": {
|
|
21
|
+
"any": [
|
|
22
|
+
{
|
|
23
|
+
"inside": {
|
|
24
|
+
"stopBy": "neighbor",
|
|
25
|
+
"kind": "dictionary_splat",
|
|
26
|
+
"inside": {
|
|
27
|
+
"stopBy": "neighbor",
|
|
28
|
+
"kind": "dictionary"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"inside": {
|
|
34
|
+
"stopBy": "neighbor",
|
|
35
|
+
"kind": "parenthesized_expression",
|
|
36
|
+
"matches": "spread-slot"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"rule": {
|
|
43
|
+
"kind": "dictionary",
|
|
44
|
+
"matches": "spread-slot"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"violation": {
|
|
49
|
+
"anchor": "witness.span",
|
|
50
|
+
"code": "PIE800",
|
|
51
|
+
"message": "Unnecessary spread `**`",
|
|
52
|
+
"suppress": {
|
|
53
|
+
"noqa": {
|
|
54
|
+
"codes": [
|
|
55
|
+
"PIE800"
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
{
|
|
2
|
+
"format": "rerail.policy/v1",
|
|
3
|
+
"id": "ruff-pie804-unnecessary-dict-kwargs",
|
|
4
|
+
"revision": 1,
|
|
5
|
+
"mode": "steer",
|
|
6
|
+
"description": "Port of Ruff's PIE804 (unnecessary-dict-kwargs): a call argument `**{...}` whose dict display is a single `**x` spread, empty, or has only keys that are str literals (not bytes, f- or t-strings; escapes decoded, implicit concatenations joined) whose value is a Python identifier (not a keyword). Reported on the `**` argument.",
|
|
7
|
+
"scope": {
|
|
8
|
+
"include": [
|
|
9
|
+
"**/*"
|
|
10
|
+
],
|
|
11
|
+
"exclude": []
|
|
12
|
+
},
|
|
13
|
+
"clauses": [
|
|
14
|
+
{
|
|
15
|
+
"id": "unnecessary-dict-kwargs",
|
|
16
|
+
"forbid": {
|
|
17
|
+
"ast": {
|
|
18
|
+
"language": "python",
|
|
19
|
+
"utils": {
|
|
20
|
+
"kwarg-string": {
|
|
21
|
+
"any": [
|
|
22
|
+
{
|
|
23
|
+
"kind": "string",
|
|
24
|
+
"regex": "^[uUrR]{0,2}['\"]"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"kind": "concatenated_string",
|
|
28
|
+
"not": {
|
|
29
|
+
"has": {
|
|
30
|
+
"stopBy": "neighbor",
|
|
31
|
+
"kind": "string",
|
|
32
|
+
"not": {
|
|
33
|
+
"regex": "^[uUrR]{0,2}['\"]"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
],
|
|
39
|
+
"value": {
|
|
40
|
+
"regex": "^[\\p{XID_Start}_]\\p{XID_Continue}*$"
|
|
41
|
+
},
|
|
42
|
+
"not": {
|
|
43
|
+
"value": {
|
|
44
|
+
"regex": "^(False|None|True|and|as|assert|async|await|break|class|continue|def|del|elif|else|except|finally|for|from|global|if|import|in|is|lambda|nonlocal|not|or|pass|raise|return|try|while|with|yield)$"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"kwarg-key": {
|
|
49
|
+
"any": [
|
|
50
|
+
{
|
|
51
|
+
"matches": "kwarg-string"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"kind": "parenthesized_expression",
|
|
55
|
+
"has": {
|
|
56
|
+
"stopBy": "neighbor",
|
|
57
|
+
"matches": "kwarg-key"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
},
|
|
62
|
+
"spread-dict": {
|
|
63
|
+
"any": [
|
|
64
|
+
{
|
|
65
|
+
"kind": "dictionary",
|
|
66
|
+
"any": [
|
|
67
|
+
{
|
|
68
|
+
"count": {
|
|
69
|
+
"has": {
|
|
70
|
+
"stopBy": "neighbor",
|
|
71
|
+
"not": {
|
|
72
|
+
"any": [
|
|
73
|
+
{
|
|
74
|
+
"regex": "^[{},]$"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"any": [
|
|
78
|
+
{
|
|
79
|
+
"kind": "comment"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"kind": "line_continuation"
|
|
83
|
+
}
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
"min": 1,
|
|
90
|
+
"max": 1
|
|
91
|
+
},
|
|
92
|
+
"has": {
|
|
93
|
+
"stopBy": "neighbor",
|
|
94
|
+
"kind": "dictionary_splat"
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"not": {
|
|
99
|
+
"has": {
|
|
100
|
+
"stopBy": "neighbor",
|
|
101
|
+
"all": [
|
|
102
|
+
{
|
|
103
|
+
"not": {
|
|
104
|
+
"any": [
|
|
105
|
+
{
|
|
106
|
+
"regex": "^[{},]$"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"any": [
|
|
110
|
+
{
|
|
111
|
+
"kind": "comment"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"kind": "line_continuation"
|
|
115
|
+
}
|
|
116
|
+
]
|
|
117
|
+
}
|
|
118
|
+
]
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"not": {
|
|
123
|
+
"kind": "pair",
|
|
124
|
+
"has": {
|
|
125
|
+
"stopBy": "neighbor",
|
|
126
|
+
"not": {
|
|
127
|
+
"follows": {
|
|
128
|
+
"stopBy": "neighbor",
|
|
129
|
+
"regex": "(?s)."
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
"matches": "kwarg-key"
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
]
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
]
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"kind": "parenthesized_expression",
|
|
144
|
+
"has": {
|
|
145
|
+
"stopBy": "neighbor",
|
|
146
|
+
"matches": "spread-dict"
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
]
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
"rule": {
|
|
153
|
+
"kind": "dictionary_splat",
|
|
154
|
+
"inside": {
|
|
155
|
+
"stopBy": "neighbor",
|
|
156
|
+
"kind": "argument_list"
|
|
157
|
+
},
|
|
158
|
+
"has": {
|
|
159
|
+
"stopBy": "neighbor",
|
|
160
|
+
"matches": "spread-dict"
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
"violation": {
|
|
166
|
+
"anchor": "witness.span",
|
|
167
|
+
"code": "PIE804",
|
|
168
|
+
"message": "Unnecessary `dict` kwargs",
|
|
169
|
+
"suppress": {
|
|
170
|
+
"noqa": {
|
|
171
|
+
"codes": [
|
|
172
|
+
"PIE804"
|
|
173
|
+
]
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
]
|
|
179
|
+
}
|