energy-state-analyzer 0.17.1 → 0.18.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 +19 -1
- package/README.md +21 -5
- package/dist/cli.js +1 -1
- package/docs/agent-integration.md +283 -0
- package/docs/cli.md +28 -15
- package/docs/configuration.md +3 -1
- package/docs/detectors/README.md +18 -16
- package/docs/detectors/cyclomatic-complexity.md +22 -10
- package/docs/detectors/error-shadowing.md +12 -12
- package/docs/detectors/inversion-opportunities.md +21 -7
- package/docs/detectors/magic-values.md +1 -1
- package/docs/detectors/oversized-recovery-block.md +13 -0
- package/docs/detectors/parse-dont-validate.md +1 -1
- package/docs/detectors/recovery-dominance.md +13 -0
- package/docs/energy-and-entropy.md +82 -8
- package/package.json +12 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
---
|
|
2
|
-
last_commit_released:
|
|
2
|
+
last_commit_released: 9cff149fd78949a772a402cc26bb4c29cf6857fe
|
|
3
3
|
name: energy-state-analyzer
|
|
4
4
|
updaters:
|
|
5
5
|
- command: npm version {version} --no-git-tag-version --allow-same-version
|
|
6
|
+
- regex:
|
|
7
|
+
file: src/Core/ReportSarif.fs
|
|
8
|
+
pattern: (?<=let private toolVersion = ").*(?=")
|
|
6
9
|
---
|
|
7
10
|
|
|
8
11
|
# Change Log
|
|
@@ -11,6 +14,21 @@ All notable changes to the "energy-state-analyzer" extension are generated by
|
|
|
11
14
|
[EasyBuild.ShipIt](https://github.com/easybuild-org/EasyBuild.ShipIt) from
|
|
12
15
|
[Conventional Commits](https://www.conventionalcommits.org/).
|
|
13
16
|
|
|
17
|
+
## 0.18.0 - 2026-09-14
|
|
18
|
+
|
|
19
|
+
### 🚀 Features
|
|
20
|
+
|
|
21
|
+
* Separate broad protected scope, recovery dominance, and oversized recovery blocks (#142) ([26564a3](https://github.com/cardamomcode/energy-state-analyzer/commit/26564a3e89d15fbe2abc0f4caf200fe48fb7392b))
|
|
22
|
+
|
|
23
|
+
### 🐞 Bug Fixes
|
|
24
|
+
|
|
25
|
+
* Make inversion feedback respect control flow (#136) ([271676f](https://github.com/cardamomcode/energy-state-analyzer/commit/271676f2043dd7fbc8c9ff593e859dd6c6b1c5da))
|
|
26
|
+
* Clarify energy-state model and report interpretation (#140) ([f2c9ae6](https://github.com/cardamomcode/energy-state-analyzer/commit/f2c9ae6879f76220d72b9a72b5afc53b142a6ca2))
|
|
27
|
+
* Report tool version in SARIF output (#141) ([ad611cf](https://github.com/cardamomcode/energy-state-analyzer/commit/ad611cf7f7d24b6f9daeb9e8bfb8413b585b6a40))
|
|
28
|
+
* Ordinal StartsWith comparison + watch task matcher (#145) ([9cff149](https://github.com/cardamomcode/energy-state-analyzer/commit/9cff149fd78949a772a402cc26bb4c29cf6857fe))
|
|
29
|
+
|
|
30
|
+
<strong><small>[View changes on Github](https://github.com/cardamomcode/energy-state-analyzer/compare/94105c06c3a96d2ab1bce15729fb26a64da92154..9cff149fd78949a772a402cc26bb4c29cf6857fe)</small></strong>
|
|
31
|
+
|
|
14
32
|
## 0.17.1 - 2026-09-13
|
|
15
33
|
|
|
16
34
|
### 🐞 Bug Fixes
|
package/README.md
CHANGED
|
@@ -15,7 +15,9 @@ Real-time analysis of the active Python, F#, TypeScript, Kotlin, C++, or C# file
|
|
|
15
15
|
- [Magic numbers](docs/detectors/magic-numbers.md), unnamed numeric literals.
|
|
16
16
|
- [Magic strings](docs/detectors/magic-strings.md), unnamed string literals at decision points.
|
|
17
17
|
- [Parameter explosion](docs/detectors/parameter-explosion.md), functions with too many parameters.
|
|
18
|
-
- [
|
|
18
|
+
- [Broad Protected Scope](docs/detectors/error-shadowing.md), overly broad protected try bodies.
|
|
19
|
+
- [Recovery Dominance](docs/detectors/recovery-dominance.md), recovery policy that dominates a function.
|
|
20
|
+
- [Oversized Recovery Block](docs/detectors/oversized-recovery-block.md), individual handlers or cleanup bodies exceeding their line limit.
|
|
19
21
|
- [Inversion opportunities](docs/detectors/inversion-opportunities.md), nested conditionals that could be guard clauses.
|
|
20
22
|
- [Primitive obsession](docs/detectors/primitive-obsession.md), strings/numbers standing in for a real type.
|
|
21
23
|
- [Match opportunities](docs/detectors/match-opportunities.md), if/elif chains that could be a match/switch.
|
|
@@ -33,17 +35,28 @@ For functions flagged as too complex (cyclomatic or cognitive), a progressive he
|
|
|
33
35
|
|
|
34
36
|
## Energy and Entropy
|
|
35
37
|
|
|
36
|
-
The
|
|
38
|
+
The energy-state model asks which possibilities a maintainer must distinguish, what knowledge
|
|
39
|
+
they need, and how relationships in a design allow a change to have unintended consequences.
|
|
40
|
+
The analyzer highlights selected signs of that work: branching, nesting, broad signatures,
|
|
41
|
+
implicit meanings, and dependency breadth. These are related signals, not interchangeable
|
|
42
|
+
quantities on a common scale, and source code has no thermodynamic unit.
|
|
43
|
+
|
|
44
|
+
Use findings to remove unnecessary possibilities, preserve domain knowledge, and keep
|
|
45
|
+
change local. Severity communicates the seriousness of the detected readability and
|
|
46
|
+
maintainability risks under the configured rules. Fix valid findings and document legitimate
|
|
47
|
+
exceptions; verify that each change improves the code rather than merely lowering a score. See
|
|
48
|
+
[Energy and Entropy](docs/energy-and-entropy.md) for the model, the maintainer's role in
|
|
49
|
+
interpreting code, and what the metrics reveal.
|
|
37
50
|
|
|
38
51
|
## Command-Line Usage
|
|
39
52
|
|
|
40
|
-
The same detectors also run headlessly, without VS Code, useful for CI or for an AI coding agent
|
|
53
|
+
The same detectors also run headlessly, without VS Code, useful for CI or for an AI coding agent fixing findings in code it just generated and verifying the result:
|
|
41
54
|
|
|
42
55
|
```bash
|
|
43
56
|
npx energy-state-analyzer path/to/file.py # or .fs / .fsx / .ts / .kt / .cpp / .cs
|
|
44
57
|
```
|
|
45
58
|
|
|
46
|
-
See [docs/cli.md](docs/cli.md) for scanning a whole repo, aggregated markdown/JSON/human reports, and diffing a PR against a base branch.
|
|
59
|
+
See [docs/cli.md](docs/cli.md) for scanning a whole repo, aggregated markdown/JSON/human reports, and diffing a PR against a base branch. See [docs/agent-integration.md](docs/agent-integration.md) for wiring the CLI into an AI coding agent's edit-and-verify loop.
|
|
47
60
|
|
|
48
61
|
## Requirements
|
|
49
62
|
|
|
@@ -85,7 +98,9 @@ Every detector has an `enabled` toggle, plus the magic-number/string switches an
|
|
|
85
98
|
- `energyStateAnalyzer.opaqueBoolean.enabled` (`true`)
|
|
86
99
|
- `energyStateAnalyzer.logicalControlFlow.enabled` (`true`)
|
|
87
100
|
- `energyStateAnalyzer.inversion.enabled` (`true`)
|
|
88
|
-
- `energyStateAnalyzer.errorShadowing.enabled` (`true
|
|
101
|
+
- `energyStateAnalyzer.errorShadowing.enabled` (`true`, family switch)
|
|
102
|
+
- `energyStateAnalyzer.recoveryDominance.enabled` (`true`)
|
|
103
|
+
- `energyStateAnalyzer.oversizedRecoveryBlock.enabled` (`true`)
|
|
89
104
|
- `energyStateAnalyzer.magicNumber.enabled` (`true`)
|
|
90
105
|
- `energyStateAnalyzer.magicString.enabled` (`true`)
|
|
91
106
|
- `energyStateAnalyzer.colors.highEnergy` / `.mediumEnergy` / `.lowEnergy` (`#fb8500` / `#ffb703` / `#99dd99`)
|
|
@@ -102,6 +117,7 @@ Set thresholds, ratios, and magic-number/string allowlists in an `.esaconfig.jso
|
|
|
102
117
|
- `parameterCount.mediumThreshold` / `highThreshold` (`5` / `8`)
|
|
103
118
|
- `errorShadowing.protectedScope.*` (`threshold` / `highThreshold` / `minItems`: `0.5` / `0.7` / `8`)
|
|
104
119
|
- `errorShadowing.recovery.*` (`threshold` / `highThreshold` / `minItems`: `0.5` / `0.7` / `5`)
|
|
120
|
+
- `errorShadowing.recoveryBlock.maxLines` (`20`)
|
|
105
121
|
- `magicNumber.allowlist` (`[0, 1, -1, 2]`)
|
|
106
122
|
- `magicString.minDuplicates` (`2`), `allowlist` (`["", "utf-8", "__main__"]`)
|
|
107
123
|
|