@pragmatiks/lint 0.10.0 → 0.11.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
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## js-v0.11.0 (2026-11-20)
4
+
5
+ ### Features
6
+
7
+ - **rules**: ban monkeypatch and mocker fixtures in tests (PRA-997)
8
+
9
+ ## js-v0.10.1 (2026-11-08)
10
+
11
+ ### Bug Fixes
12
+
13
+ - **rules**: flag pure-prefix results bound only to _ in pra-pure-call-result-dropped (PRA-733)
14
+
3
15
  ## js-v0.10.0 (2026-11-08)
4
16
 
5
17
  ### Features
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pragmatiks/lint",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "Pragmatiks engineering principles eslint config and bundled semgrep rules.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -0,0 +1,16 @@
1
+ rules:
2
+ - id: pra-no-test-double-fixture
3
+ patterns:
4
+ - pattern-either:
5
+ - pattern: "def $FUNCTION(..., $NAME, ...): ..."
6
+ - pattern: "def $FUNCTION(..., $NAME: $TYPE, ...): ..."
7
+ - pattern: "async def $FUNCTION(..., $NAME, ...): ..."
8
+ - pattern: "async def $FUNCTION(..., $NAME: $TYPE, ...): ..."
9
+ - pattern: "pytest.mark.usefixtures(..., \"$NAME\", ...)"
10
+ - pattern: "$REQUEST.getfixturevalue(\"$NAME\")"
11
+ - metavariable-regex:
12
+ metavariable: $NAME
13
+ regex: '^(monkeypatch|(class_|module_|package_|session_)?mocker)$'
14
+ message: "testing policy: no mocks. The monkeypatch and mocker fixtures replace real code; test against real code and services."
15
+ severity: ERROR
16
+ languages: [python]
@@ -1,16 +1,28 @@
1
1
  rules:
2
2
  - id: pra-pure-call-result-dropped
3
- patterns:
4
- - pattern-regex: '(?m)^[ \t]*(?:await[ \t]+)?(?:(?:self|cls)\.)?(?:compute|build|derive|format|parse|extract)_\w+\((?![^\n]*\)[ \t]*[.\[])(?:[^\n]*[(),])?[ \t]*$'
5
- - pattern-not-inside: $CALL(...)
6
- - pattern-not-inside: "[...]"
7
- - pattern-not-inside: "{...}"
8
- - pattern-not-inside: "(...)"
9
- - pattern-not-inside: '"..."'
10
- - pattern-not-inside: $TARGET = $VALUE
11
- - pattern-not-inside: "$TARGET: $TYPE = $VALUE"
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."