@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,99 @@
|
|
|
1
|
+
{
|
|
2
|
+
"format": "rerail.policy/v1",
|
|
3
|
+
"id": "ruff-f525-string-dot-format-mixing-automatic",
|
|
4
|
+
"revision": 1,
|
|
5
|
+
"mode": "steer",
|
|
6
|
+
"description": "Port of Ruff's F525 (string-dot-format-mixing-automatic): a `.format` call on a valid format string with both an automatically numbered field (`{}`) and a manually numbered one (`{0}`), nested fields in specs included. The format string is a str literal (no f/t/b prefix; implicit concatenations joined, escapes decoded, parentheses transparent) receiving `.format`, read with the `braceFormat` grammar (a port of ruff_python_literal's format parser as pyflakes' FormatSummary reads it).",
|
|
7
|
+
"scope": {
|
|
8
|
+
"include": [
|
|
9
|
+
"**/*"
|
|
10
|
+
],
|
|
11
|
+
"exclude": []
|
|
12
|
+
},
|
|
13
|
+
"clauses": [
|
|
14
|
+
{
|
|
15
|
+
"id": "string-dot-format-mixing-automatic",
|
|
16
|
+
"forbid": {
|
|
17
|
+
"ast": {
|
|
18
|
+
"language": "python",
|
|
19
|
+
"utils": {
|
|
20
|
+
"plain-string": {
|
|
21
|
+
"any": [
|
|
22
|
+
{
|
|
23
|
+
"kind": "string",
|
|
24
|
+
"not": {
|
|
25
|
+
"regex": "^[A-Za-z]*[fFbBtT][A-Za-z]*['\"]"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"kind": "concatenated_string",
|
|
30
|
+
"not": {
|
|
31
|
+
"has": {
|
|
32
|
+
"kind": "string",
|
|
33
|
+
"regex": "^[A-Za-z]*[fFbBtT][A-Za-z]*['\"]"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
"format-string": {
|
|
40
|
+
"any": [
|
|
41
|
+
{
|
|
42
|
+
"matches": "plain-string",
|
|
43
|
+
"parse": {
|
|
44
|
+
"grammar": "braceFormat",
|
|
45
|
+
"not": {
|
|
46
|
+
"has": {
|
|
47
|
+
"kind": "error"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"all": [
|
|
51
|
+
{
|
|
52
|
+
"has": {
|
|
53
|
+
"kind": "auto",
|
|
54
|
+
"stopBy": "end"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"has": {
|
|
59
|
+
"kind": "index",
|
|
60
|
+
"stopBy": "end"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"kind": "parenthesized_expression",
|
|
68
|
+
"has": {
|
|
69
|
+
"matches": "format-string"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
"rule": {
|
|
76
|
+
"pattern": "$S.format($$$A)"
|
|
77
|
+
},
|
|
78
|
+
"constraints": {
|
|
79
|
+
"S": {
|
|
80
|
+
"matches": "format-string"
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"violation": {
|
|
86
|
+
"anchor": "witness.span",
|
|
87
|
+
"code": "F525",
|
|
88
|
+
"message": "`.format` string mixes automatic and manual numbering",
|
|
89
|
+
"suppress": {
|
|
90
|
+
"noqa": {
|
|
91
|
+
"codes": [
|
|
92
|
+
"F525"
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
]
|
|
99
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"format": "rerail.policy/v1",
|
|
3
|
+
"id": "ruff-f541-f-string-missing-placeholders",
|
|
4
|
+
"revision": 1,
|
|
5
|
+
"mode": "steer",
|
|
6
|
+
"description": "Port of Ruff's F541 (f-string-missing-placeholders) with default settings: every f-string part of a string expression (an implicit concatenation counts as one expression) when no f-string part of that expression has a replacement field. `{{`/`}}` escapes are not placeholders; nested f-strings inside a replacement field or format spec are their own expressions.",
|
|
7
|
+
"scope": { "include": ["**/*"], "exclude": [] },
|
|
8
|
+
"clauses": [
|
|
9
|
+
{
|
|
10
|
+
"id": "f-string-missing-placeholders",
|
|
11
|
+
"forbid": {
|
|
12
|
+
"ast": {
|
|
13
|
+
"language": "python",
|
|
14
|
+
"utils": {
|
|
15
|
+
"has-placeholder": {
|
|
16
|
+
"kind": "string",
|
|
17
|
+
"has": { "stopBy": "neighbor", "kind": "interpolation" }
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"rule": {
|
|
21
|
+
"kind": "string",
|
|
22
|
+
"has": { "stopBy": "neighbor", "kind": "string_start", "regex": "^[A-Za-z]*[fF]" },
|
|
23
|
+
"not": {
|
|
24
|
+
"any": [
|
|
25
|
+
{ "matches": "has-placeholder" },
|
|
26
|
+
{
|
|
27
|
+
"inside": {
|
|
28
|
+
"stopBy": "neighbor",
|
|
29
|
+
"kind": "concatenated_string",
|
|
30
|
+
"has": { "stopBy": "neighbor", "matches": "has-placeholder" }
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"violation": {
|
|
39
|
+
"anchor": "witness.span",
|
|
40
|
+
"code": "F541",
|
|
41
|
+
"message": "f-string without any placeholders",
|
|
42
|
+
"suppress": {
|
|
43
|
+
"noqa": {
|
|
44
|
+
"codes": [
|
|
45
|
+
"F541"
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
{
|
|
2
|
+
"format": "rerail.policy/v1",
|
|
3
|
+
"id": "ruff-f601-multi-value-repeated-key-literal",
|
|
4
|
+
"revision": 1,
|
|
5
|
+
"mode": "steer",
|
|
6
|
+
"description": "Port of Ruff's F601 (multi-value-repeated-key-literal) with default settings: a literal dictionary key (string, bytes, number, boolean, None, Ellipsis, tuple, f-string, signed number, real +/- imaginary; Ruff's is_literal_key) equal to an earlier key of the same dict display, reported on each repeat (parentheses are transparent). Equality is Ruff's HashableExpr (`compare` `text: \"structure-hash\"`): numbers fold by value (`1 == 1.0 == True`, `1 + 0j == 1`), strings by decoded value, tuples of constants element by element, anything else structurally as ComparableExpr (names without NFKC normalization). Ported from the Ruff conformance suite (rerail/conformance/ruff/rules/F601.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": "multi-value-repeated-key-literal",
|
|
16
|
+
"forbid": {
|
|
17
|
+
"ast": {
|
|
18
|
+
"language": "python",
|
|
19
|
+
"utils": {
|
|
20
|
+
"complex": {
|
|
21
|
+
"any": [
|
|
22
|
+
{
|
|
23
|
+
"kind": "integer"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"kind": "float"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"kind": "parenthesized_expression",
|
|
30
|
+
"has": {
|
|
31
|
+
"stopBy": "neighbor",
|
|
32
|
+
"matches": "complex"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
"regex": "[jJ]\\)*$"
|
|
37
|
+
},
|
|
38
|
+
"literal-key": {
|
|
39
|
+
"any": [
|
|
40
|
+
{
|
|
41
|
+
"kind": "string",
|
|
42
|
+
"not": {
|
|
43
|
+
"regex": "^[A-Za-z]*[tT]"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"kind": "concatenated_string",
|
|
48
|
+
"not": {
|
|
49
|
+
"has": {
|
|
50
|
+
"stopBy": "neighbor",
|
|
51
|
+
"kind": "string",
|
|
52
|
+
"regex": "^[A-Za-z]*[tT]"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"kind": "integer"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"kind": "float"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"kind": "true"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"kind": "false"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"kind": "none"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"kind": "ellipsis"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"kind": "tuple"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"kind": "unary_operator",
|
|
79
|
+
"regex": "^[-+]",
|
|
80
|
+
"has": {
|
|
81
|
+
"stopBy": "neighbor",
|
|
82
|
+
"matches": "signed-literal"
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"kind": "binary_operator",
|
|
87
|
+
"has": {
|
|
88
|
+
"stopBy": "neighbor",
|
|
89
|
+
"regex": "^[-+]$",
|
|
90
|
+
"follows": {
|
|
91
|
+
"stopBy": "neighbor",
|
|
92
|
+
"matches": "signed-literal",
|
|
93
|
+
"not": {
|
|
94
|
+
"regex": "[jJ]\\)*$"
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
"precedes": {
|
|
98
|
+
"stopBy": "neighbor",
|
|
99
|
+
"matches": "complex"
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
]
|
|
104
|
+
},
|
|
105
|
+
"signed-literal": {
|
|
106
|
+
"any": [
|
|
107
|
+
{
|
|
108
|
+
"kind": "integer"
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"kind": "float"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"kind": "unary_operator",
|
|
115
|
+
"regex": "^[-+]",
|
|
116
|
+
"has": {
|
|
117
|
+
"stopBy": "neighbor",
|
|
118
|
+
"matches": "signed-literal"
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"kind": "parenthesized_expression",
|
|
123
|
+
"has": {
|
|
124
|
+
"stopBy": "neighbor",
|
|
125
|
+
"matches": "signed-literal"
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
]
|
|
129
|
+
},
|
|
130
|
+
"key-slot": {
|
|
131
|
+
"any": [
|
|
132
|
+
{
|
|
133
|
+
"not": {
|
|
134
|
+
"follows": {
|
|
135
|
+
"stopBy": "neighbor",
|
|
136
|
+
"regex": "(?s)."
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
"inside": {
|
|
140
|
+
"stopBy": "neighbor",
|
|
141
|
+
"kind": "pair"
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"inside": {
|
|
146
|
+
"stopBy": "neighbor",
|
|
147
|
+
"kind": "parenthesized_expression",
|
|
148
|
+
"matches": "key-slot"
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
"rule": {
|
|
155
|
+
"pattern": "$KEY",
|
|
156
|
+
"not": {
|
|
157
|
+
"kind": "parenthesized_expression"
|
|
158
|
+
},
|
|
159
|
+
"all": [
|
|
160
|
+
{
|
|
161
|
+
"matches": "literal-key"
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
"matches": "key-slot"
|
|
165
|
+
}
|
|
166
|
+
],
|
|
167
|
+
"inside": {
|
|
168
|
+
"stopBy": {
|
|
169
|
+
"not": {
|
|
170
|
+
"kind": "parenthesized_expression"
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
"kind": "pair",
|
|
174
|
+
"count": {
|
|
175
|
+
"follows": {
|
|
176
|
+
"stopBy": "end",
|
|
177
|
+
"kind": "pair",
|
|
178
|
+
"has": {
|
|
179
|
+
"stopBy": "neighbor",
|
|
180
|
+
"not": {
|
|
181
|
+
"follows": {
|
|
182
|
+
"stopBy": "neighbor",
|
|
183
|
+
"regex": "(?s)."
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
"pattern": "$J"
|
|
187
|
+
},
|
|
188
|
+
"compare": {
|
|
189
|
+
"left": "J",
|
|
190
|
+
"op": "eq",
|
|
191
|
+
"right": "KEY",
|
|
192
|
+
"text": "structure-hash"
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
"min": 1
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
"violation": {
|
|
202
|
+
"anchor": "witness.span",
|
|
203
|
+
"code": "F601",
|
|
204
|
+
"message": "Dictionary key literal `$KEY` repeated",
|
|
205
|
+
"suppress": {
|
|
206
|
+
"noqa": {
|
|
207
|
+
"codes": [
|
|
208
|
+
"F601"
|
|
209
|
+
]
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
]
|
|
215
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
{
|
|
2
|
+
"format": "rerail.policy/v1",
|
|
3
|
+
"id": "ruff-f602-multi-value-repeated-key-variable",
|
|
4
|
+
"revision": 1,
|
|
5
|
+
"mode": "steer",
|
|
6
|
+
"description": "Port of Ruff's F602 (multi-value-repeated-key-variable) with default settings: a dictionary key that is a bare name equal to an earlier key of the same dict display, reported on each repeat (parentheses transparent).",
|
|
7
|
+
"scope": {
|
|
8
|
+
"include": [
|
|
9
|
+
"**/*"
|
|
10
|
+
],
|
|
11
|
+
"exclude": []
|
|
12
|
+
},
|
|
13
|
+
"clauses": [
|
|
14
|
+
{
|
|
15
|
+
"id": "multi-value-repeated-key-variable",
|
|
16
|
+
"forbid": {
|
|
17
|
+
"ast": {
|
|
18
|
+
"language": "python",
|
|
19
|
+
"utils": {
|
|
20
|
+
"dict-key": {
|
|
21
|
+
"any": [
|
|
22
|
+
{
|
|
23
|
+
"not": {
|
|
24
|
+
"follows": {
|
|
25
|
+
"stopBy": "neighbor",
|
|
26
|
+
"regex": "(?s)."
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"inside": {
|
|
30
|
+
"stopBy": "neighbor",
|
|
31
|
+
"kind": "pair"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"inside": {
|
|
36
|
+
"stopBy": "neighbor",
|
|
37
|
+
"kind": "parenthesized_expression",
|
|
38
|
+
"matches": "dict-key"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
"earlier-same": {
|
|
44
|
+
"any": [
|
|
45
|
+
{
|
|
46
|
+
"not": {
|
|
47
|
+
"kind": "parenthesized_expression"
|
|
48
|
+
},
|
|
49
|
+
"pattern": "$EARLIER",
|
|
50
|
+
"kind": "identifier",
|
|
51
|
+
"compare": {
|
|
52
|
+
"left": "EARLIER",
|
|
53
|
+
"op": "eq",
|
|
54
|
+
"right": "KEY"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"kind": "parenthesized_expression",
|
|
59
|
+
"has": {
|
|
60
|
+
"stopBy": "neighbor",
|
|
61
|
+
"matches": "earlier-same"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"rule": {
|
|
68
|
+
"all": [
|
|
69
|
+
{
|
|
70
|
+
"pattern": "$KEY"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"not": {
|
|
74
|
+
"kind": "parenthesized_expression"
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"kind": "identifier"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"matches": "dict-key"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"inside": {
|
|
85
|
+
"stopBy": {
|
|
86
|
+
"kind": "pair"
|
|
87
|
+
},
|
|
88
|
+
"kind": "pair",
|
|
89
|
+
"follows": {
|
|
90
|
+
"stopBy": "end",
|
|
91
|
+
"kind": "pair",
|
|
92
|
+
"has": {
|
|
93
|
+
"stopBy": "neighbor",
|
|
94
|
+
"not": {
|
|
95
|
+
"follows": {
|
|
96
|
+
"stopBy": "neighbor",
|
|
97
|
+
"regex": "(?s)."
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
"matches": "earlier-same"
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
]
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
"violation": {
|
|
110
|
+
"anchor": "witness.span",
|
|
111
|
+
"code": "F602",
|
|
112
|
+
"message": "Dictionary key `$KEY` repeated",
|
|
113
|
+
"suppress": {
|
|
114
|
+
"noqa": {
|
|
115
|
+
"codes": [
|
|
116
|
+
"F602"
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
]
|
|
123
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"format": "rerail.policy/v1",
|
|
3
|
+
"id": "ruff-f622-multiple-starred-expressions",
|
|
4
|
+
"revision": 1,
|
|
5
|
+
"mode": "steer",
|
|
6
|
+
"description": "Port of Ruff's F622 (multiple-starred-expressions, a semantic syntax error) with default settings: a tuple or list assignment target (assignment, `for`, comprehension `for`, `with ... as`), at any nesting, with two or more starred elements of its own. Reported on the target tuple or list, parentheses included.",
|
|
7
|
+
"scope": { "include": ["**/*"], "exclude": [] },
|
|
8
|
+
"clauses": [
|
|
9
|
+
{
|
|
10
|
+
"id": "multiple-starred-expressions",
|
|
11
|
+
"forbid": {
|
|
12
|
+
"ast": {
|
|
13
|
+
"language": "python",
|
|
14
|
+
"utils": {
|
|
15
|
+
"with-target": {
|
|
16
|
+
"any": [
|
|
17
|
+
{ "inside": { "stopBy": "neighbor", "kind": "as_pattern_target" } },
|
|
18
|
+
{
|
|
19
|
+
"inside": {
|
|
20
|
+
"stopBy": "neighbor",
|
|
21
|
+
"any": [{ "kind": "tuple" }, { "kind": "list" }, { "kind": "parenthesized_expression" }],
|
|
22
|
+
"matches": "with-target"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"rule": {
|
|
29
|
+
"any": [
|
|
30
|
+
{
|
|
31
|
+
"any": [{ "kind": "pattern_list" }, { "kind": "tuple_pattern" }, { "kind": "list_pattern" }],
|
|
32
|
+
"count": { "has": { "stopBy": "neighbor", "kind": "list_splat_pattern" }, "min": 2 }
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"any": [{ "kind": "tuple" }, { "kind": "list" }],
|
|
36
|
+
"matches": "with-target",
|
|
37
|
+
"count": { "has": { "stopBy": "neighbor", "kind": "list_splat" }, "min": 2 }
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"violation": {
|
|
44
|
+
"anchor": "witness.span",
|
|
45
|
+
"code": "F622",
|
|
46
|
+
"message": "Two starred expressions in assignment",
|
|
47
|
+
"suppress": {
|
|
48
|
+
"noqa": {
|
|
49
|
+
"codes": [
|
|
50
|
+
"F622"
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
}
|