@pragmatiks/lint 0.10.0 → 0.10.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/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,16 +1,28 @@
|
|
|
1
1
|
rules:
|
|
2
2
|
- id: pra-pure-call-result-dropped
|
|
3
|
-
|
|
4
|
-
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
pattern-either:
|
|
4
|
+
- patterns:
|
|
5
|
+
- pattern-either:
|
|
6
|
+
- pattern: _ = $FUNCTION(...)
|
|
7
|
+
- pattern: _ = await $FUNCTION(...)
|
|
8
|
+
- pattern: _ = self.$FUNCTION(...)
|
|
9
|
+
- pattern: _ = await self.$FUNCTION(...)
|
|
10
|
+
- pattern: _ = cls.$FUNCTION(...)
|
|
11
|
+
- pattern: _ = await cls.$FUNCTION(...)
|
|
12
|
+
- metavariable-regex:
|
|
13
|
+
metavariable: $FUNCTION
|
|
14
|
+
regex: '^(compute|build|derive|format|parse|extract)_\w+$'
|
|
15
|
+
- patterns:
|
|
16
|
+
- pattern-regex: '(?m)^[ \t]*(?:await[ \t]+)?(?:(?:self|cls)\.)?(?:compute|build|derive|format|parse|extract)_\w+\((?![^\n]*\)[ \t]*[.\[])(?:[^\n]*[(),])?[ \t]*$'
|
|
17
|
+
- pattern-not-inside: $CALL(...)
|
|
18
|
+
- pattern-not-inside: "[...]"
|
|
19
|
+
- pattern-not-inside: "{...}"
|
|
20
|
+
- pattern-not-inside: "(...)"
|
|
21
|
+
- pattern-not-inside: '"..."'
|
|
22
|
+
- pattern-not-inside: $TARGET = $VALUE
|
|
23
|
+
- pattern-not-inside: "$TARGET: $TYPE = $VALUE"
|
|
12
24
|
message: "principle #7 a compute, build, derive, format, parse or extract function is pure, so a call whose result is dropped does nothing. Use the result, or call the function that performs the side effect."
|
|
13
25
|
severity: WARNING
|
|
14
26
|
languages: [python]
|
|
15
27
|
metadata:
|
|
16
|
-
note: "Matches a call statement that opens its own line, so a call used as an argument, element, assignment value or chained receiver is not flagged. Principle #7 makes these prefixes pure; a result consumed only to raise on bad input belongs in a validate function that says so."
|
|
28
|
+
note: "Matches a call statement that opens its own line, or a call bound to _ alone, so a call used as an argument, element, assignment value or chained receiver is not flagged. Principle #7 makes these prefixes pure; a result consumed only to raise on bad input belongs in a validate function that says so."
|