@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,384 @@
1
+ {
2
+ "format": "rerail.policy/v1",
3
+ "id": "ruff-sim101-duplicate-isinstance-call",
4
+ "revision": 1,
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).",
7
+ "scope": {
8
+ "include": [
9
+ "**/*"
10
+ ],
11
+ "exclude": []
12
+ },
13
+ "clauses": [
14
+ {
15
+ "id": "duplicate-isinstance-call",
16
+ "forbid": {
17
+ "ast": {
18
+ "language": "python",
19
+ "utils": {
20
+ "or-op": {
21
+ "kind": "boolean_operator",
22
+ "has": {
23
+ "field": "operator",
24
+ "regex": "^or$"
25
+ }
26
+ },
27
+ "isinstance-a": {
28
+ "any": [
29
+ {
30
+ "kind": "call",
31
+ "pattern": "$_F($_, $_)",
32
+ "all": [
33
+ {
34
+ "has": {
35
+ "field": "arguments",
36
+ "kind": "argument_list",
37
+ "not": {
38
+ "has": {
39
+ "stopBy": "neighbor",
40
+ "any": [
41
+ {
42
+ "kind": "keyword_argument"
43
+ },
44
+ {
45
+ "kind": "dictionary_splat"
46
+ }
47
+ ]
48
+ }
49
+ }
50
+ }
51
+ },
52
+ {
53
+ "has": {
54
+ "field": "function",
55
+ "matches": "isinstance-ref"
56
+ }
57
+ },
58
+ {
59
+ "has": {
60
+ "field": "arguments",
61
+ "kind": "argument_list",
62
+ "has": {
63
+ "stopBy": "neighbor",
64
+ "follows": {
65
+ "stopBy": "neighbor",
66
+ "regex": "^\\($"
67
+ },
68
+ "matches": "target-a"
69
+ }
70
+ }
71
+ }
72
+ ]
73
+ },
74
+ {
75
+ "kind": "parenthesized_expression",
76
+ "has": {
77
+ "stopBy": "neighbor",
78
+ "matches": "isinstance-a"
79
+ }
80
+ }
81
+ ]
82
+ },
83
+ "target-a": {
84
+ "pattern": "$A"
85
+ },
86
+ "isinstance-t": {
87
+ "any": [
88
+ {
89
+ "kind": "call",
90
+ "pattern": "$_F($_, $_)",
91
+ "all": [
92
+ {
93
+ "has": {
94
+ "field": "arguments",
95
+ "kind": "argument_list",
96
+ "not": {
97
+ "has": {
98
+ "stopBy": "neighbor",
99
+ "any": [
100
+ {
101
+ "kind": "keyword_argument"
102
+ },
103
+ {
104
+ "kind": "dictionary_splat"
105
+ }
106
+ ]
107
+ }
108
+ }
109
+ }
110
+ },
111
+ {
112
+ "has": {
113
+ "field": "function",
114
+ "matches": "isinstance-ref"
115
+ }
116
+ },
117
+ {
118
+ "has": {
119
+ "field": "arguments",
120
+ "kind": "argument_list",
121
+ "has": {
122
+ "stopBy": "neighbor",
123
+ "follows": {
124
+ "stopBy": "neighbor",
125
+ "regex": "^\\($"
126
+ },
127
+ "matches": "target-t"
128
+ }
129
+ }
130
+ }
131
+ ]
132
+ },
133
+ {
134
+ "kind": "parenthesized_expression",
135
+ "has": {
136
+ "stopBy": "neighbor",
137
+ "matches": "isinstance-t"
138
+ }
139
+ }
140
+ ]
141
+ },
142
+ "target-t": {
143
+ "any": [
144
+ {
145
+ "not": {
146
+ "kind": "parenthesized_expression"
147
+ },
148
+ "pattern": "$T"
149
+ },
150
+ {
151
+ "kind": "parenthesized_expression",
152
+ "has": {
153
+ "stopBy": "neighbor",
154
+ "not": {
155
+ "regex": "^[()]$"
156
+ },
157
+ "matches": "target-t"
158
+ }
159
+ }
160
+ ]
161
+ },
162
+ "isinstance-b": {
163
+ "any": [
164
+ {
165
+ "kind": "call",
166
+ "pattern": "$_F($_, $_)",
167
+ "all": [
168
+ {
169
+ "has": {
170
+ "field": "arguments",
171
+ "kind": "argument_list",
172
+ "not": {
173
+ "has": {
174
+ "stopBy": "neighbor",
175
+ "any": [
176
+ {
177
+ "kind": "keyword_argument"
178
+ },
179
+ {
180
+ "kind": "dictionary_splat"
181
+ }
182
+ ]
183
+ }
184
+ }
185
+ }
186
+ },
187
+ {
188
+ "has": {
189
+ "field": "function",
190
+ "matches": "isinstance-ref"
191
+ }
192
+ },
193
+ {
194
+ "has": {
195
+ "field": "arguments",
196
+ "kind": "argument_list",
197
+ "has": {
198
+ "stopBy": "neighbor",
199
+ "follows": {
200
+ "stopBy": "neighbor",
201
+ "regex": "^\\($"
202
+ },
203
+ "matches": "target-b"
204
+ }
205
+ }
206
+ }
207
+ ]
208
+ },
209
+ {
210
+ "kind": "parenthesized_expression",
211
+ "has": {
212
+ "stopBy": "neighbor",
213
+ "matches": "isinstance-b"
214
+ }
215
+ }
216
+ ]
217
+ },
218
+ "target-b": {
219
+ "any": [
220
+ {
221
+ "not": {
222
+ "kind": "parenthesized_expression"
223
+ },
224
+ "pattern": "$B"
225
+ },
226
+ {
227
+ "kind": "parenthesized_expression",
228
+ "has": {
229
+ "stopBy": "neighbor",
230
+ "not": {
231
+ "regex": "^[()]$"
232
+ },
233
+ "matches": "target-b"
234
+ }
235
+ }
236
+ ]
237
+ },
238
+ "adjacent-pair": {
239
+ "matches": "or-op",
240
+ "all": [
241
+ {
242
+ "has": {
243
+ "field": "left",
244
+ "any": [
245
+ {
246
+ "not": {
247
+ "matches": "or-op"
248
+ },
249
+ "matches": "isinstance-t"
250
+ },
251
+ {
252
+ "matches": "or-op",
253
+ "has": {
254
+ "field": "right",
255
+ "matches": "isinstance-t"
256
+ }
257
+ }
258
+ ]
259
+ }
260
+ },
261
+ {
262
+ "has": {
263
+ "field": "right",
264
+ "matches": "isinstance-a"
265
+ }
266
+ }
267
+ ],
268
+ "compare": {
269
+ "left": "T",
270
+ "op": "eq",
271
+ "right": "A",
272
+ "text": "structure"
273
+ }
274
+ },
275
+ "isinstance-ref": {
276
+ "any": [
277
+ {
278
+ "any": [
279
+ {
280
+ "kind": "identifier"
281
+ },
282
+ {
283
+ "kind": "attribute"
284
+ }
285
+ ],
286
+ "resolves": {
287
+ "import": [
288
+ "builtins.isinstance"
289
+ ],
290
+ "global": [
291
+ "isinstance"
292
+ ]
293
+ }
294
+ },
295
+ {
296
+ "kind": "parenthesized_expression",
297
+ "has": {
298
+ "stopBy": "neighbor",
299
+ "matches": "isinstance-ref"
300
+ }
301
+ }
302
+ ]
303
+ },
304
+ "last-is-b": {
305
+ "any": [
306
+ {
307
+ "not": {
308
+ "matches": "or-op"
309
+ },
310
+ "matches": "isinstance-b"
311
+ },
312
+ {
313
+ "matches": "or-op",
314
+ "has": {
315
+ "field": "right",
316
+ "matches": "isinstance-b"
317
+ }
318
+ }
319
+ ]
320
+ },
321
+ "run-start": {
322
+ "matches": "adjacent-pair",
323
+ "pattern": "$P",
324
+ "not": {
325
+ "has": {
326
+ "field": "left",
327
+ "matches": "or-op",
328
+ "has": {
329
+ "field": "left",
330
+ "matches": "last-is-b",
331
+ "compare": {
332
+ "left": "B",
333
+ "op": "eq",
334
+ "right": "T",
335
+ "text": "structure"
336
+ }
337
+ }
338
+ }
339
+ }
340
+ }
341
+ },
342
+ "rule": {
343
+ "kind": "boolean_operator",
344
+ "matches": "or-op",
345
+ "not": {
346
+ "inside": {
347
+ "stopBy": "neighbor",
348
+ "matches": "or-op"
349
+ }
350
+ },
351
+ "any": [
352
+ {
353
+ "matches": "run-start"
354
+ },
355
+ {
356
+ "has": {
357
+ "stopBy": {
358
+ "not": {
359
+ "matches": "or-op"
360
+ }
361
+ },
362
+ "matches": "run-start"
363
+ }
364
+ }
365
+ ]
366
+ }
367
+ }
368
+ },
369
+ "violation": {
370
+ "anchor": "witness.span",
371
+ "code": "SIM101",
372
+ "message": "Multiple `isinstance` calls for `$T`, merge into a single call",
373
+ "each": "P",
374
+ "suppress": {
375
+ "noqa": {
376
+ "codes": [
377
+ "SIM101"
378
+ ]
379
+ }
380
+ }
381
+ }
382
+ }
383
+ ]
384
+ }
@@ -0,0 +1,82 @@
1
+ {
2
+ "format": "rerail.policy/v1",
3
+ "id": "ruff-sim107-return-in-try-except-finally",
4
+ "revision": 1,
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`.",
7
+ "scope": {
8
+ "include": [
9
+ "**/*"
10
+ ],
11
+ "exclude": []
12
+ },
13
+ "clauses": [
14
+ {
15
+ "id": "return-in-try-except-finally",
16
+ "forbid": {
17
+ "ast": {
18
+ "language": "python",
19
+ "rule": {
20
+ "kind": "return_statement",
21
+ "not": {
22
+ "follows": {
23
+ "stopBy": "end",
24
+ "kind": "return_statement"
25
+ }
26
+ },
27
+ "inside": {
28
+ "stopBy": "neighbor",
29
+ "kind": "block",
30
+ "inside": {
31
+ "stopBy": "neighbor",
32
+ "kind": "finally_clause",
33
+ "inside": {
34
+ "stopBy": "neighbor",
35
+ "kind": "try_statement",
36
+ "any": [
37
+ {
38
+ "has": {
39
+ "stopBy": "neighbor",
40
+ "kind": "block",
41
+ "has": {
42
+ "stopBy": "neighbor",
43
+ "kind": "return_statement"
44
+ }
45
+ }
46
+ },
47
+ {
48
+ "has": {
49
+ "stopBy": "neighbor",
50
+ "kind": "except_clause",
51
+ "has": {
52
+ "stopBy": "neighbor",
53
+ "kind": "block",
54
+ "has": {
55
+ "stopBy": "neighbor",
56
+ "kind": "return_statement"
57
+ }
58
+ }
59
+ }
60
+ }
61
+ ]
62
+ }
63
+ }
64
+ }
65
+ }
66
+ }
67
+ },
68
+ "violation": {
69
+ "anchor": "witness.span",
70
+ "code": "SIM107",
71
+ "message": "Don't use `return` in `try`-`except` and `finally`",
72
+ "suppress": {
73
+ "noqa": {
74
+ "codes": [
75
+ "SIM107"
76
+ ]
77
+ }
78
+ }
79
+ }
80
+ }
81
+ ]
82
+ }
@@ -0,0 +1,205 @@
1
+ {
2
+ "format": "rerail.policy/v1",
3
+ "id": "ruff-sim109-compare-with-tuple",
4
+ "revision": 1,
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.",
7
+ "scope": {
8
+ "include": [
9
+ "**/*"
10
+ ],
11
+ "exclude": []
12
+ },
13
+ "clauses": [
14
+ {
15
+ "id": "compare-with-tuple",
16
+ "forbid": {
17
+ "ast": {
18
+ "language": "python",
19
+ "utils": {
20
+ "or-op": {
21
+ "kind": "boolean_operator",
22
+ "has": {
23
+ "stopBy": "neighbor",
24
+ "regex": "^or$"
25
+ }
26
+ },
27
+ "eq-target": {
28
+ "any": [
29
+ {
30
+ "kind": "comparison_operator",
31
+ "count": {
32
+ "has": {
33
+ "stopBy": "neighbor",
34
+ "regex": "(?s)."
35
+ },
36
+ "max": 3
37
+ },
38
+ "all": [
39
+ {
40
+ "has": {
41
+ "stopBy": "neighbor",
42
+ "kind": "identifier",
43
+ "precedes": {
44
+ "stopBy": "neighbor",
45
+ "regex": "^==$"
46
+ },
47
+ "pattern": "$N"
48
+ }
49
+ },
50
+ {
51
+ "has": {
52
+ "stopBy": "neighbor",
53
+ "kind": "identifier",
54
+ "follows": {
55
+ "stopBy": "neighbor",
56
+ "regex": "^==$"
57
+ }
58
+ }
59
+ }
60
+ ]
61
+ },
62
+ {
63
+ "kind": "parenthesized_expression",
64
+ "has": {
65
+ "stopBy": "neighbor",
66
+ "matches": "eq-target"
67
+ }
68
+ }
69
+ ]
70
+ }
71
+ },
72
+ "rule": {
73
+ "kind": "boolean_operator",
74
+ "matches": "or-op",
75
+ "not": {
76
+ "any": [
77
+ {
78
+ "inside": {
79
+ "stopBy": "neighbor",
80
+ "matches": "or-op"
81
+ }
82
+ },
83
+ {
84
+ "has": {
85
+ "stopBy": "end",
86
+ "kind": "comment"
87
+ }
88
+ },
89
+ {
90
+ "layout": {
91
+ "after": {
92
+ "to": "token",
93
+ "comments": true,
94
+ "breaks": {
95
+ "eq": 0
96
+ }
97
+ }
98
+ },
99
+ "not": {
100
+ "layout": {
101
+ "after": {
102
+ "to": "token",
103
+ "breaks": {
104
+ "eq": 0
105
+ }
106
+ }
107
+ }
108
+ }
109
+ }
110
+ ]
111
+ },
112
+ "has": {
113
+ "stopBy": {
114
+ "not": {
115
+ "matches": "or-op"
116
+ }
117
+ },
118
+ "not": {
119
+ "any": [
120
+ {
121
+ "matches": "or-op"
122
+ },
123
+ {
124
+ "follows": {
125
+ "stopBy": "end",
126
+ "any": [
127
+ {
128
+ "not": {
129
+ "matches": "or-op"
130
+ },
131
+ "matches": "eq-target"
132
+ },
133
+ {
134
+ "matches": "or-op",
135
+ "has": {
136
+ "stopBy": {
137
+ "not": {
138
+ "matches": "or-op"
139
+ }
140
+ },
141
+ "not": {
142
+ "matches": "or-op"
143
+ },
144
+ "matches": "eq-target"
145
+ }
146
+ }
147
+ ]
148
+ }
149
+ }
150
+ ]
151
+ },
152
+ "matches": "eq-target",
153
+ "pattern": "$FIRST",
154
+ "inside": {
155
+ "stopBy": {
156
+ "not": {
157
+ "matches": "or-op"
158
+ }
159
+ },
160
+ "matches": "or-op",
161
+ "not": {
162
+ "inside": {
163
+ "stopBy": "neighbor",
164
+ "matches": "or-op"
165
+ }
166
+ },
167
+ "has": {
168
+ "stopBy": {
169
+ "not": {
170
+ "matches": "or-op"
171
+ }
172
+ },
173
+ "not": {
174
+ "matches": "or-op"
175
+ },
176
+ "matches": "eq-target",
177
+ "pattern": "$SECOND",
178
+ "compare": {
179
+ "left": "SECOND",
180
+ "op": "ne",
181
+ "right": "FIRST",
182
+ "text": "node"
183
+ }
184
+ }
185
+ }
186
+ }
187
+ }
188
+ }
189
+ },
190
+ "violation": {
191
+ "anchor": "witness.span",
192
+ "code": "SIM109",
193
+ "message": "Use `$N in (...)` instead of multiple equality comparisons",
194
+ "each": "FIRST",
195
+ "suppress": {
196
+ "noqa": {
197
+ "codes": [
198
+ "SIM109"
199
+ ]
200
+ }
201
+ }
202
+ }
203
+ }
204
+ ]
205
+ }