@pragmatiks/lint 0.12.0 → 0.13.0
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/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
rules:
|
|
2
|
+
- id: pra-no-underscore-members
|
|
3
|
+
pattern-either:
|
|
4
|
+
- patterns:
|
|
5
|
+
- patterns:
|
|
6
|
+
- pattern-either:
|
|
7
|
+
- pattern: $NAME = $VALUE
|
|
8
|
+
- pattern: "..., $NAME, ... = $VALUE"
|
|
9
|
+
- pattern: "[..., $NAME, ...] = $VALUE"
|
|
10
|
+
- pattern: "$NAME: $TYPE = $VALUE"
|
|
11
|
+
- pattern: "$NAME: $TYPE"
|
|
12
|
+
- pattern: $OBJECT.$NAME = $VALUE
|
|
13
|
+
- pattern: "..., $OBJECT.$NAME, ... = $VALUE"
|
|
14
|
+
- pattern: "$OBJECT.$NAME: $TYPE = $VALUE"
|
|
15
|
+
- metavariable-regex:
|
|
16
|
+
metavariable: $NAME
|
|
17
|
+
regex: '^(?!.*[^_]_$)_(?P<STEM>[a-z]\w*)$'
|
|
18
|
+
- pattern-not-inside: |
|
|
19
|
+
class $CLASS:
|
|
20
|
+
...
|
|
21
|
+
def $STEM(...): ...
|
|
22
|
+
- patterns:
|
|
23
|
+
- pattern-either:
|
|
24
|
+
- pattern: "def $NAME(...): ..."
|
|
25
|
+
- pattern: "async def $NAME(...): ..."
|
|
26
|
+
- metavariable-regex:
|
|
27
|
+
metavariable: $NAME
|
|
28
|
+
regex: '^(?!.*[^_]_$)_[a-z]\w*$'
|
|
29
|
+
message: "principle #13 leading underscore with no same-named public property or accessor in the class. Use the plain public name; keep the underscore only on a backing field behind a same-named property."
|
|
30
|
+
severity: WARNING
|
|
31
|
+
languages: [python]
|
|
32
|
+
metadata:
|
|
33
|
+
note: "A field target is allowlisted when its class defines a method named like it without the underscore (a property, setter or accessor). Parameters, dunders, sunders such as Enum's _missing_, self, cls and the throwaway _ are never flagged; a field backing a property inherited from a base class is flagged and needs reviewer judgment."
|