@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,129 @@
1
+ {
2
+ "format": "rerail.policy/v1",
3
+ "id": "ruff-b033-duplicate-value",
4
+ "revision": 1,
5
+ "mode": "steer",
6
+ "description": "Port of Ruff's B033 (duplicate-value): a literal element of a set display (string, bytes, number, boolean, `None`, `...`, not an f- or t-string; parentheses are transparent) equal to an earlier literal element. Equality is Ruff's HashableExpr (`compare` `text: \"structure-hash\"`): numbers fold by value (`True == 1 == 1.0 == 0x1`), strings by decoded value (`'a' == \"\\x61\"`, implicit concatenation joined), and an int of 2**64 or more by its token.",
7
+ "scope": {
8
+ "include": [
9
+ "**/*"
10
+ ],
11
+ "exclude": []
12
+ },
13
+ "clauses": [
14
+ {
15
+ "id": "duplicate-value",
16
+ "forbid": {
17
+ "ast": {
18
+ "language": "python",
19
+ "utils": {
20
+ "literal": {
21
+ "any": [
22
+ {
23
+ "kind": "string",
24
+ "regex": "^[rRuUbB]{0,2}['\"]"
25
+ },
26
+ {
27
+ "kind": "concatenated_string",
28
+ "not": {
29
+ "has": {
30
+ "stopBy": "neighbor",
31
+ "kind": "string",
32
+ "not": {
33
+ "regex": "^[rRuUbB]{0,2}['\"]"
34
+ }
35
+ }
36
+ }
37
+ },
38
+ {
39
+ "kind": "integer"
40
+ },
41
+ {
42
+ "kind": "float"
43
+ },
44
+ {
45
+ "kind": "true"
46
+ },
47
+ {
48
+ "kind": "false"
49
+ },
50
+ {
51
+ "kind": "none"
52
+ },
53
+ {
54
+ "kind": "ellipsis"
55
+ }
56
+ ]
57
+ },
58
+ "literal-p": {
59
+ "any": [
60
+ {
61
+ "matches": "literal"
62
+ },
63
+ {
64
+ "kind": "parenthesized_expression",
65
+ "has": {
66
+ "stopBy": "neighbor",
67
+ "matches": "literal-p"
68
+ }
69
+ }
70
+ ]
71
+ },
72
+ "dup-slot": {
73
+ "any": [
74
+ {
75
+ "inside": {
76
+ "stopBy": "neighbor",
77
+ "kind": "set"
78
+ },
79
+ "count": {
80
+ "follows": {
81
+ "stopBy": "end",
82
+ "matches": "literal-p",
83
+ "pattern": "$F",
84
+ "compare": {
85
+ "left": "F",
86
+ "op": "eq",
87
+ "right": "V",
88
+ "text": "structure-hash"
89
+ }
90
+ },
91
+ "min": 1
92
+ }
93
+ },
94
+ {
95
+ "inside": {
96
+ "stopBy": "neighbor",
97
+ "kind": "parenthesized_expression",
98
+ "matches": "dup-slot"
99
+ }
100
+ }
101
+ ]
102
+ }
103
+ },
104
+ "rule": {
105
+ "matches": "literal",
106
+ "pattern": "$V",
107
+ "all": [
108
+ {
109
+ "matches": "dup-slot"
110
+ }
111
+ ]
112
+ }
113
+ }
114
+ },
115
+ "violation": {
116
+ "anchor": "witness.span",
117
+ "code": "B033",
118
+ "message": "Sets should not contain duplicate item `$V`",
119
+ "suppress": {
120
+ "noqa": {
121
+ "codes": [
122
+ "B033"
123
+ ]
124
+ }
125
+ }
126
+ }
127
+ }
128
+ ]
129
+ }
@@ -0,0 +1,159 @@
1
+ {
2
+ "format": "rerail.policy/v1",
3
+ "id": "ruff-b034-re-sub-positional-args",
4
+ "revision": 1,
5
+ "mode": "steer",
6
+ "description": "Port of Ruff's B034 (re-sub-positional-args): a call to `re.sub` or `re.subn` with more than three positional arguments, or to `re.split` with more than two (starred arguments count). The callee resolves with `resolves` (imports and shadowing as Ruff's semantic model sees them). Reported on the call.",
7
+ "scope": {
8
+ "include": [
9
+ "**/*"
10
+ ],
11
+ "exclude": []
12
+ },
13
+ "clauses": [
14
+ {
15
+ "id": "re-sub-positional-args",
16
+ "forbid": {
17
+ "ast": {
18
+ "language": "python",
19
+ "utils": {
20
+ "re-sub": {
21
+ "any": [
22
+ {
23
+ "any": [
24
+ {
25
+ "kind": "identifier"
26
+ },
27
+ {
28
+ "kind": "attribute"
29
+ }
30
+ ],
31
+ "resolves": {
32
+ "import": [
33
+ "re.sub",
34
+ "re.subn"
35
+ ]
36
+ }
37
+ },
38
+ {
39
+ "kind": "parenthesized_expression",
40
+ "has": {
41
+ "stopBy": "neighbor",
42
+ "matches": "re-sub"
43
+ }
44
+ }
45
+ ]
46
+ },
47
+ "re-split": {
48
+ "any": [
49
+ {
50
+ "any": [
51
+ {
52
+ "kind": "identifier"
53
+ },
54
+ {
55
+ "kind": "attribute"
56
+ }
57
+ ],
58
+ "resolves": {
59
+ "import": [
60
+ "re.split"
61
+ ]
62
+ }
63
+ },
64
+ {
65
+ "kind": "parenthesized_expression",
66
+ "has": {
67
+ "stopBy": "neighbor",
68
+ "matches": "re-split"
69
+ }
70
+ }
71
+ ]
72
+ }
73
+ },
74
+ "rule": {
75
+ "kind": "call",
76
+ "any": [
77
+ {
78
+ "has": {
79
+ "stopBy": "neighbor",
80
+ "kind": "argument_list",
81
+ "count": {
82
+ "has": {
83
+ "stopBy": "neighbor",
84
+ "not": {
85
+ "any": [
86
+ {
87
+ "kind": "keyword_argument"
88
+ },
89
+ {
90
+ "kind": "dictionary_splat"
91
+ },
92
+ {
93
+ "kind": "comment"
94
+ },
95
+ {
96
+ "regex": "^[(),]$"
97
+ }
98
+ ]
99
+ }
100
+ },
101
+ "min": 4
102
+ },
103
+ "follows": {
104
+ "stopBy": "neighbor",
105
+ "matches": "re-sub"
106
+ }
107
+ }
108
+ },
109
+ {
110
+ "has": {
111
+ "stopBy": "neighbor",
112
+ "kind": "argument_list",
113
+ "count": {
114
+ "has": {
115
+ "stopBy": "neighbor",
116
+ "not": {
117
+ "any": [
118
+ {
119
+ "kind": "keyword_argument"
120
+ },
121
+ {
122
+ "kind": "dictionary_splat"
123
+ },
124
+ {
125
+ "kind": "comment"
126
+ },
127
+ {
128
+ "regex": "^[(),]$"
129
+ }
130
+ ]
131
+ }
132
+ },
133
+ "min": 3
134
+ },
135
+ "follows": {
136
+ "stopBy": "neighbor",
137
+ "matches": "re-split"
138
+ }
139
+ }
140
+ }
141
+ ]
142
+ }
143
+ }
144
+ },
145
+ "violation": {
146
+ "anchor": "witness.span",
147
+ "code": "B034",
148
+ "message": "`re.sub` should pass `count` and `flags` as keyword arguments to avoid confusion due to unintuitive argument positions",
149
+ "suppress": {
150
+ "noqa": {
151
+ "codes": [
152
+ "B034"
153
+ ]
154
+ }
155
+ }
156
+ }
157
+ }
158
+ ]
159
+ }
@@ -0,0 +1,281 @@
1
+ {
2
+ "format": "rerail.policy/v1",
3
+ "id": "ruff-b039-mutable-contextvar-default",
4
+ "revision": 1,
5
+ "mode": "steer",
6
+ "description": "Port of Ruff's B039 (mutable-contextvar-default): the `default=` of a `contextvars.ContextVar(...)` call (the callee may be subscripted) is a list, dict or set display or comprehension, or a call to anything other than a function Ruff knows returns an immutable value (`is_immutable_return_type`: `datetime`, `decimal`, `fractions`, `operator`, `pathlib.Path`, `types.MappingProxyType`, `re.compile`, immutable builtins, and Ruff's option `flake8-bugbear.extend-immutable-calls`). Names resolve with `resolves` (imports, and builtins only when unshadowed). Reported on the default, inside any parentheses.",
7
+ "scope": {
8
+ "include": [
9
+ "**/*"
10
+ ],
11
+ "exclude": []
12
+ },
13
+ "clauses": [
14
+ {
15
+ "id": "options",
16
+ "define": {
17
+ "options": {
18
+ "flake8-bugbear.extend-immutable-calls": {
19
+ "type": "array",
20
+ "items": "string",
21
+ "default": [],
22
+ "description": "Qualified names of further calls that return immutable values."
23
+ }
24
+ }
25
+ }
26
+ },
27
+ {
28
+ "id": "mutable-contextvar-default",
29
+ "forbid": {
30
+ "ast": {
31
+ "language": "python",
32
+ "utils": {
33
+ "contextvar": {
34
+ "any": [
35
+ {
36
+ "any": [
37
+ {
38
+ "kind": "identifier"
39
+ },
40
+ {
41
+ "kind": "attribute"
42
+ }
43
+ ],
44
+ "resolves": {
45
+ "import": [
46
+ "contextvars.ContextVar"
47
+ ]
48
+ }
49
+ },
50
+ {
51
+ "kind": "parenthesized_expression",
52
+ "has": {
53
+ "stopBy": "neighbor",
54
+ "matches": "contextvar"
55
+ }
56
+ }
57
+ ]
58
+ },
59
+ "immutable-func": {
60
+ "any": [
61
+ {
62
+ "kind": "identifier"
63
+ },
64
+ {
65
+ "kind": "attribute"
66
+ }
67
+ ],
68
+ "resolves": {
69
+ "global": [
70
+ "bool",
71
+ "bytes",
72
+ "complex",
73
+ "float",
74
+ "frozenset",
75
+ "int",
76
+ "range",
77
+ "str",
78
+ "tuple",
79
+ "slice",
80
+ "frozendict"
81
+ ],
82
+ "import": [
83
+ "datetime.date",
84
+ "datetime.datetime",
85
+ "datetime.time",
86
+ "datetime.timedelta",
87
+ "datetime.timezone",
88
+ "datetime.tzinfo",
89
+ "decimal.Decimal",
90
+ "fractions.Fraction",
91
+ "operator.attrgetter",
92
+ "operator.itemgetter",
93
+ "operator.methodcaller",
94
+ "pathlib.Path",
95
+ "types.MappingProxyType",
96
+ "re.compile",
97
+ {
98
+ "$option": "flake8-bugbear.extend-immutable-calls",
99
+ "spread": true
100
+ }
101
+ ]
102
+ }
103
+ },
104
+ "callee-of-contextvar": {
105
+ "any": [
106
+ {
107
+ "matches": "contextvar"
108
+ },
109
+ {
110
+ "kind": "subscript",
111
+ "has": {
112
+ "stopBy": "neighbor",
113
+ "not": {
114
+ "follows": {
115
+ "stopBy": "neighbor",
116
+ "regex": "(?s)."
117
+ }
118
+ },
119
+ "matches": "contextvar"
120
+ }
121
+ },
122
+ {
123
+ "kind": "parenthesized_expression",
124
+ "has": {
125
+ "stopBy": "neighbor",
126
+ "matches": "callee-of-contextvar"
127
+ }
128
+ }
129
+ ]
130
+ },
131
+ "immutable-callee": {
132
+ "any": [
133
+ {
134
+ "matches": "immutable-func"
135
+ },
136
+ {
137
+ "kind": "subscript",
138
+ "has": {
139
+ "stopBy": "neighbor",
140
+ "not": {
141
+ "follows": {
142
+ "stopBy": "neighbor",
143
+ "regex": "(?s)."
144
+ }
145
+ },
146
+ "matches": "immutable-func"
147
+ }
148
+ },
149
+ {
150
+ "kind": "parenthesized_expression",
151
+ "has": {
152
+ "stopBy": "neighbor",
153
+ "matches": "immutable-callee"
154
+ }
155
+ }
156
+ ]
157
+ },
158
+ "mutable-default": {
159
+ "any": [
160
+ {
161
+ "any": [
162
+ {
163
+ "kind": "list"
164
+ },
165
+ {
166
+ "kind": "dictionary"
167
+ },
168
+ {
169
+ "kind": "set"
170
+ },
171
+ {
172
+ "kind": "list_comprehension"
173
+ },
174
+ {
175
+ "kind": "dictionary_comprehension"
176
+ },
177
+ {
178
+ "kind": "set_comprehension"
179
+ }
180
+ ]
181
+ },
182
+ {
183
+ "kind": "call",
184
+ "not": {
185
+ "has": {
186
+ "stopBy": "neighbor",
187
+ "not": {
188
+ "follows": {
189
+ "stopBy": "neighbor",
190
+ "regex": "(?s)."
191
+ }
192
+ },
193
+ "matches": "immutable-callee"
194
+ }
195
+ }
196
+ }
197
+ ]
198
+ },
199
+ "default-slot": {
200
+ "any": [
201
+ {
202
+ "follows": {
203
+ "stopBy": "neighbor",
204
+ "regex": "^=$"
205
+ },
206
+ "inside": {
207
+ "stopBy": "neighbor",
208
+ "kind": "keyword_argument",
209
+ "has": {
210
+ "stopBy": "neighbor",
211
+ "kind": "identifier",
212
+ "regex": "^default$",
213
+ "precedes": {
214
+ "stopBy": "neighbor",
215
+ "regex": "^=$"
216
+ }
217
+ },
218
+ "not": {
219
+ "follows": {
220
+ "stopBy": "end",
221
+ "kind": "keyword_argument",
222
+ "all": [
223
+ {
224
+ "has": {
225
+ "stopBy": "neighbor",
226
+ "kind": "identifier",
227
+ "regex": "^(default)$",
228
+ "precedes": {
229
+ "stopBy": "neighbor",
230
+ "regex": "^=$"
231
+ }
232
+ }
233
+ }
234
+ ]
235
+ }
236
+ },
237
+ "inside": {
238
+ "stopBy": "neighbor",
239
+ "kind": "argument_list",
240
+ "follows": {
241
+ "stopBy": "neighbor",
242
+ "matches": "callee-of-contextvar"
243
+ }
244
+ }
245
+ }
246
+ },
247
+ {
248
+ "inside": {
249
+ "stopBy": "neighbor",
250
+ "kind": "parenthesized_expression",
251
+ "matches": "default-slot"
252
+ }
253
+ }
254
+ ]
255
+ }
256
+ },
257
+ "rule": {
258
+ "matches": "mutable-default",
259
+ "all": [
260
+ {
261
+ "matches": "default-slot"
262
+ }
263
+ ]
264
+ }
265
+ }
266
+ },
267
+ "violation": {
268
+ "anchor": "witness.span",
269
+ "code": "B039",
270
+ "message": "Do not use mutable data structures for `ContextVar` defaults",
271
+ "suppress": {
272
+ "noqa": {
273
+ "codes": [
274
+ "B039"
275
+ ]
276
+ }
277
+ }
278
+ }
279
+ }
280
+ ]
281
+ }