@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,73 @@
|
|
|
1
|
+
{
|
|
2
|
+
"format": "rerail.policy/v1",
|
|
3
|
+
"id": "ruff-f403-undefined-local-with-import-star",
|
|
4
|
+
"revision": 1,
|
|
5
|
+
"mode": "steer",
|
|
6
|
+
"description": "Port of Ruff's F403 (undefined-local-with-import-star): any `from <module> import *` whose module is not `__future__` (at any depth, whatever the relative level), reported on the whole statement.",
|
|
7
|
+
"scope": {
|
|
8
|
+
"include": [
|
|
9
|
+
"**/*"
|
|
10
|
+
],
|
|
11
|
+
"exclude": []
|
|
12
|
+
},
|
|
13
|
+
"clauses": [
|
|
14
|
+
{
|
|
15
|
+
"id": "undefined-local-with-import-star",
|
|
16
|
+
"forbid": {
|
|
17
|
+
"ast": {
|
|
18
|
+
"language": "python",
|
|
19
|
+
"rule": {
|
|
20
|
+
"kind": "import_from_statement",
|
|
21
|
+
"has": {
|
|
22
|
+
"stopBy": "neighbor",
|
|
23
|
+
"kind": "wildcard_import",
|
|
24
|
+
"follows": {
|
|
25
|
+
"stopBy": "end",
|
|
26
|
+
"any": [
|
|
27
|
+
{
|
|
28
|
+
"kind": "dotted_name"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"kind": "relative_import"
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
"pattern": "$MODULE"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"not": {
|
|
38
|
+
"has": {
|
|
39
|
+
"stopBy": "neighbor",
|
|
40
|
+
"any": [
|
|
41
|
+
{
|
|
42
|
+
"kind": "dotted_name",
|
|
43
|
+
"regex": "^__future__$"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"kind": "relative_import",
|
|
47
|
+
"has": {
|
|
48
|
+
"stopBy": "neighbor",
|
|
49
|
+
"kind": "dotted_name",
|
|
50
|
+
"regex": "^__future__$"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"violation": {
|
|
60
|
+
"anchor": "witness.span",
|
|
61
|
+
"code": "F403",
|
|
62
|
+
"message": "`from $MODULE import *` used; unable to detect undefined names",
|
|
63
|
+
"suppress": {
|
|
64
|
+
"noqa": {
|
|
65
|
+
"codes": [
|
|
66
|
+
"F403"
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
{
|
|
2
|
+
"format": "rerail.policy/v1",
|
|
3
|
+
"id": "ruff-f405-undefined-local-with-import-star-usage",
|
|
4
|
+
"revision": 1,
|
|
5
|
+
"mode": "steer",
|
|
6
|
+
"description": "Port of Ruff's F405 (undefined-local-with-import-star-usage) on the engine's name resolution (M10a `resolves.unresolved: \"star\"`): a reference, or a string entry of a module `__all__`, that no binding in scope and no builtin resolves and that a visible star import may bind, reported on the name or the string; and such a name inside a string Ruff parses as a type definition (M11a `parse` with `annotation`, nested strings included), reported on each such name inside the string.",
|
|
7
|
+
"scope": {
|
|
8
|
+
"include": [
|
|
9
|
+
"**/*"
|
|
10
|
+
],
|
|
11
|
+
"exclude": []
|
|
12
|
+
},
|
|
13
|
+
"clauses": [
|
|
14
|
+
{
|
|
15
|
+
"id": "undefined-local-with-import-star-usage",
|
|
16
|
+
"forbid": {
|
|
17
|
+
"ast": {
|
|
18
|
+
"language": "python",
|
|
19
|
+
"utils": {
|
|
20
|
+
"star-in-string": {
|
|
21
|
+
"any": [
|
|
22
|
+
{
|
|
23
|
+
"kind": "string"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"kind": "concatenated_string"
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
"parse": {
|
|
30
|
+
"grammar": "annotation",
|
|
31
|
+
"has": {
|
|
32
|
+
"stopBy": "end",
|
|
33
|
+
"any": [
|
|
34
|
+
{
|
|
35
|
+
"kind": "identifier",
|
|
36
|
+
"resolves": {
|
|
37
|
+
"unresolved": "star"
|
|
38
|
+
},
|
|
39
|
+
"capture": "NAME"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"matches": "star-in-string"
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"rule": {
|
|
50
|
+
"any": [
|
|
51
|
+
{
|
|
52
|
+
"any": [
|
|
53
|
+
{
|
|
54
|
+
"kind": "identifier"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"kind": "string"
|
|
58
|
+
}
|
|
59
|
+
],
|
|
60
|
+
"pattern": "$NAME",
|
|
61
|
+
"resolves": {
|
|
62
|
+
"unresolved": "star"
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"matches": "star-in-string"
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
"violation": {
|
|
73
|
+
"anchor": "capture.NAME",
|
|
74
|
+
"code": "F405",
|
|
75
|
+
"message": "`$NAME` may be undefined, or defined from star imports",
|
|
76
|
+
"each": "NAME",
|
|
77
|
+
"suppress": {
|
|
78
|
+
"noqa": {
|
|
79
|
+
"codes": [
|
|
80
|
+
"F405"
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
]
|
|
87
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"format": "rerail.policy/v1",
|
|
3
|
+
"id": "ruff-f406-undefined-local-with-nested-import-star-usage",
|
|
4
|
+
"revision": 1,
|
|
5
|
+
"mode": "steer",
|
|
6
|
+
"description": "Port of Ruff's F406 (undefined-local-with-nested-import-star-usage): a `from <module> import *` outside module scope, i.e. anywhere inside a function or class body, reported on the whole statement.",
|
|
7
|
+
"scope": { "include": ["**/*"], "exclude": [] },
|
|
8
|
+
"clauses": [
|
|
9
|
+
{
|
|
10
|
+
"id": "undefined-local-with-nested-import-star-usage",
|
|
11
|
+
"forbid": {
|
|
12
|
+
"ast": {
|
|
13
|
+
"language": "python",
|
|
14
|
+
"rule": {
|
|
15
|
+
"kind": "import_from_statement",
|
|
16
|
+
"has": {
|
|
17
|
+
"stopBy": "neighbor",
|
|
18
|
+
"kind": "wildcard_import",
|
|
19
|
+
"follows": { "stopBy": "end", "any": [{ "kind": "dotted_name" }, { "kind": "relative_import" }], "pattern": "$MODULE" }
|
|
20
|
+
},
|
|
21
|
+
"inside": { "stopBy": "end", "any": [{ "kind": "function_definition" }, { "kind": "class_definition" }] }
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"violation": {
|
|
26
|
+
"anchor": "witness.span",
|
|
27
|
+
"code": "F406",
|
|
28
|
+
"message": "`from $MODULE import *` only allowed at module level",
|
|
29
|
+
"suppress": {
|
|
30
|
+
"noqa": {
|
|
31
|
+
"codes": [
|
|
32
|
+
"F406"
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"format": "rerail.policy/v1",
|
|
3
|
+
"id": "ruff-f407-future-feature-not-defined",
|
|
4
|
+
"revision": 1,
|
|
5
|
+
"mode": "steer",
|
|
6
|
+
"description": "Port of Ruff's F407 (future-feature-not-defined): a name imported from `__future__` (also through a relative `from .__future__`, matched by the module's text with `resolves.imported` and `relative: \"text\"`, as Ruff ignores the level) that is not one of CPython's future features (`is_known_future_feature` in ruff_python_parser's semantic_errors.rs), reported on the alias (`name as alias` included) or on the `*` of a star import.",
|
|
7
|
+
"scope": { "include": ["**/*"], "exclude": [] },
|
|
8
|
+
"clauses": [
|
|
9
|
+
{
|
|
10
|
+
"id": "future-feature-not-defined",
|
|
11
|
+
"forbid": {
|
|
12
|
+
"ast": {
|
|
13
|
+
"language": "python",
|
|
14
|
+
"utils": {
|
|
15
|
+
"known-feature": {
|
|
16
|
+
"kind": "dotted_name",
|
|
17
|
+
"regex": "^(nested_scopes|generators|division|absolute_import|with_statement|print_function|unicode_literals|barry_as_FLUFL|generator_stop|annotations)$"
|
|
18
|
+
},
|
|
19
|
+
"future-import": {
|
|
20
|
+
"any": [
|
|
21
|
+
{ "kind": "future_import_statement" },
|
|
22
|
+
{
|
|
23
|
+
"kind": "import_from_statement",
|
|
24
|
+
"has": { "stopBy": "neighbor", "kind": "relative_import", "has": { "stopBy": "neighbor", "kind": "dotted_name", "resolves": { "imported": ["__future__"], "relative": "text" } } }
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"rule": {
|
|
30
|
+
"any": [
|
|
31
|
+
{ "kind": "dotted_name", "not": { "matches": "known-feature" }, "pattern": "$NAME" },
|
|
32
|
+
{
|
|
33
|
+
"kind": "aliased_import",
|
|
34
|
+
"has": { "stopBy": "neighbor", "kind": "dotted_name", "not": { "matches": "known-feature" }, "pattern": "$NAME" }
|
|
35
|
+
},
|
|
36
|
+
{ "kind": "wildcard_import", "pattern": "$NAME" }
|
|
37
|
+
],
|
|
38
|
+
"inside": { "stopBy": "neighbor", "matches": "future-import" }
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"violation": {
|
|
43
|
+
"anchor": "witness.span",
|
|
44
|
+
"code": "F407",
|
|
45
|
+
"message": "Future feature `$NAME` is not defined",
|
|
46
|
+
"suppress": {
|
|
47
|
+
"noqa": {
|
|
48
|
+
"codes": [
|
|
49
|
+
"F407"
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
{
|
|
2
|
+
"format": "rerail.policy/v1",
|
|
3
|
+
"id": "ruff-f501-percent-format-invalid-format",
|
|
4
|
+
"revision": 1,
|
|
5
|
+
"mode": "steer",
|
|
6
|
+
"description": "Port of Ruff's F501 (percent-format-invalid-format): a `%`-format string the parser refuses for any reason but an unsupported format character (an incomplete specifier, an unclosed mapping key, a width or precision too big). The format string is a str literal (no f/t/b prefix; implicit concatenations joined, escapes decoded, parentheses transparent) left of `%`, read with the `percentFormat` grammar (a port of ruff_python_literal's cformat parser).",
|
|
7
|
+
"scope": {
|
|
8
|
+
"include": [
|
|
9
|
+
"**/*"
|
|
10
|
+
],
|
|
11
|
+
"exclude": []
|
|
12
|
+
},
|
|
13
|
+
"clauses": [
|
|
14
|
+
{
|
|
15
|
+
"id": "percent-format-invalid-format",
|
|
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": "percentFormat",
|
|
45
|
+
"has": {
|
|
46
|
+
"kind": "error",
|
|
47
|
+
"not": {
|
|
48
|
+
"value": {
|
|
49
|
+
"regex": "^unsupported format character"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"kind": "parenthesized_expression",
|
|
57
|
+
"has": {
|
|
58
|
+
"matches": "format-string"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"rule": {
|
|
65
|
+
"pattern": "$S % $R"
|
|
66
|
+
},
|
|
67
|
+
"constraints": {
|
|
68
|
+
"S": {
|
|
69
|
+
"matches": "format-string"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"violation": {
|
|
75
|
+
"anchor": "witness.span",
|
|
76
|
+
"code": "F501",
|
|
77
|
+
"message": "`%`-format string has invalid format string",
|
|
78
|
+
"suppress": {
|
|
79
|
+
"noqa": {
|
|
80
|
+
"codes": [
|
|
81
|
+
"F501"
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
]
|
|
88
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
{
|
|
2
|
+
"format": "rerail.policy/v1",
|
|
3
|
+
"id": "ruff-f502-percent-format-expected-mapping",
|
|
4
|
+
"revision": 1,
|
|
5
|
+
"mode": "steer",
|
|
6
|
+
"description": "Port of Ruff's F502 (percent-format-expected-mapping): a valid `%`-format string with a `%(key)` placeholder applied to a list, tuple or set display, a list or set comprehension or a generator. The format string is a str literal (no f/t/b prefix; implicit concatenations joined, escapes decoded, parentheses transparent) left of `%`, read with the `percentFormat` grammar (a port of ruff_python_literal's cformat parser).",
|
|
7
|
+
"scope": {
|
|
8
|
+
"include": [
|
|
9
|
+
"**/*"
|
|
10
|
+
],
|
|
11
|
+
"exclude": []
|
|
12
|
+
},
|
|
13
|
+
"clauses": [
|
|
14
|
+
{
|
|
15
|
+
"id": "percent-format-expected-mapping",
|
|
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": "percentFormat",
|
|
45
|
+
"not": {
|
|
46
|
+
"has": {
|
|
47
|
+
"kind": "error"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"has": {
|
|
51
|
+
"kind": "placeholder",
|
|
52
|
+
"stopBy": "end",
|
|
53
|
+
"has": {
|
|
54
|
+
"kind": "mapping_key"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"kind": "parenthesized_expression",
|
|
61
|
+
"has": {
|
|
62
|
+
"matches": "format-string"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
|
+
"operand": {
|
|
68
|
+
"any": [
|
|
69
|
+
{
|
|
70
|
+
"any": [
|
|
71
|
+
{
|
|
72
|
+
"kind": "list"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"kind": "tuple"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"kind": "set"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"kind": "list_comprehension"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"kind": "set_comprehension"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"kind": "generator_expression"
|
|
88
|
+
}
|
|
89
|
+
]
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"kind": "parenthesized_expression",
|
|
93
|
+
"has": {
|
|
94
|
+
"matches": "operand"
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
]
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
"rule": {
|
|
101
|
+
"pattern": "$S % $R"
|
|
102
|
+
},
|
|
103
|
+
"constraints": {
|
|
104
|
+
"S": {
|
|
105
|
+
"matches": "format-string"
|
|
106
|
+
},
|
|
107
|
+
"R": {
|
|
108
|
+
"matches": "operand"
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
"violation": {
|
|
114
|
+
"anchor": "witness.span",
|
|
115
|
+
"code": "F502",
|
|
116
|
+
"message": "`%`-format string expected mapping but got sequence",
|
|
117
|
+
"suppress": {
|
|
118
|
+
"noqa": {
|
|
119
|
+
"codes": [
|
|
120
|
+
"F502"
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
]
|
|
127
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
{
|
|
2
|
+
"format": "rerail.policy/v1",
|
|
3
|
+
"id": "ruff-f503-percent-format-expected-sequence",
|
|
4
|
+
"revision": 1,
|
|
5
|
+
"mode": "steer",
|
|
6
|
+
"description": "Port of Ruff's F503 (percent-format-expected-sequence): a valid `%`-format string consuming more than one positional value (placeholders without a key, and `*` widths and precisions) applied to a dict display or comprehension. The format string is a str literal (no f/t/b prefix; implicit concatenations joined, escapes decoded, parentheses transparent) left of `%`, read with the `percentFormat` grammar (a port of ruff_python_literal's cformat parser).",
|
|
7
|
+
"scope": {
|
|
8
|
+
"include": [
|
|
9
|
+
"**/*"
|
|
10
|
+
],
|
|
11
|
+
"exclude": []
|
|
12
|
+
},
|
|
13
|
+
"clauses": [
|
|
14
|
+
{
|
|
15
|
+
"id": "percent-format-expected-sequence",
|
|
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": "percentFormat",
|
|
45
|
+
"not": {
|
|
46
|
+
"has": {
|
|
47
|
+
"kind": "error"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"count": {
|
|
51
|
+
"has": {
|
|
52
|
+
"stopBy": "end",
|
|
53
|
+
"any": [
|
|
54
|
+
{
|
|
55
|
+
"kind": "placeholder",
|
|
56
|
+
"not": {
|
|
57
|
+
"has": {
|
|
58
|
+
"kind": "mapping_key"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"kind": "star"
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
|
+
"min": 2
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"kind": "parenthesized_expression",
|
|
73
|
+
"has": {
|
|
74
|
+
"matches": "format-string"
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
]
|
|
78
|
+
},
|
|
79
|
+
"operand": {
|
|
80
|
+
"any": [
|
|
81
|
+
{
|
|
82
|
+
"any": [
|
|
83
|
+
{
|
|
84
|
+
"kind": "dictionary"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"kind": "dictionary_comprehension"
|
|
88
|
+
}
|
|
89
|
+
]
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"kind": "parenthesized_expression",
|
|
93
|
+
"has": {
|
|
94
|
+
"matches": "operand"
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
]
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
"rule": {
|
|
101
|
+
"pattern": "$S % $R"
|
|
102
|
+
},
|
|
103
|
+
"constraints": {
|
|
104
|
+
"S": {
|
|
105
|
+
"matches": "format-string"
|
|
106
|
+
},
|
|
107
|
+
"R": {
|
|
108
|
+
"matches": "operand"
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
"violation": {
|
|
114
|
+
"anchor": "witness.span",
|
|
115
|
+
"code": "F503",
|
|
116
|
+
"message": "`%`-format string expected sequence but got mapping",
|
|
117
|
+
"suppress": {
|
|
118
|
+
"noqa": {
|
|
119
|
+
"codes": [
|
|
120
|
+
"F503"
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
]
|
|
127
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"format": "rerail.policy/v1",
|
|
3
|
+
"id": "ruff-f504-percent-format-extra-named-arguments",
|
|
4
|
+
"revision": 1,
|
|
5
|
+
"mode": "steer",
|
|
6
|
+
"description": "Port of Ruff's F504 (percent-format-extra-named-arguments): a valid `%`-format string without positional placeholders applied to a dict display without `**` with a string-literal key no `%(key)` placeholder names. `formatArgs` reads the format string left of `%` (a str literal with no f/t/b prefix, implicit concatenations joined, escapes decoded, parentheses transparent) with the `percentFormat` grammar (a port of ruff_python_literal's cformat parser), and the right operand as Ruff's strings.rs does.",
|
|
7
|
+
"scope": {
|
|
8
|
+
"include": [
|
|
9
|
+
"**/*"
|
|
10
|
+
],
|
|
11
|
+
"exclude": []
|
|
12
|
+
},
|
|
13
|
+
"clauses": [
|
|
14
|
+
{
|
|
15
|
+
"id": "percent-format-extra-named-arguments",
|
|
16
|
+
"forbid": {
|
|
17
|
+
"ast": {
|
|
18
|
+
"language": "python",
|
|
19
|
+
"rule": {
|
|
20
|
+
"pattern": "$S % $R",
|
|
21
|
+
"formatArgs": {
|
|
22
|
+
"style": "percent",
|
|
23
|
+
"string": "S",
|
|
24
|
+
"args": "R",
|
|
25
|
+
"unused": {
|
|
26
|
+
"kind": "pair"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"violation": {
|
|
33
|
+
"anchor": "witness.span",
|
|
34
|
+
"code": "F504",
|
|
35
|
+
"message": "`%`-format string has unused named argument(s)",
|
|
36
|
+
"suppress": {
|
|
37
|
+
"noqa": {
|
|
38
|
+
"codes": [
|
|
39
|
+
"F504"
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
}
|