eager_eye 1.2.15 → 1.3.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +51 -0
- data/README.md +227 -541
- data/README.tr.md +489 -0
- data/lib/eager_eye/analyzer.rb +31 -4
- data/lib/eager_eye/baseline.rb +46 -0
- data/lib/eager_eye/cli.rb +15 -1
- data/lib/eager_eye/detectors/custom_method_query.rb +52 -1
- data/lib/eager_eye/detectors/loop_association.rb +65 -9
- data/lib/eager_eye/detectors/serializer_nesting.rb +47 -5
- data/lib/eager_eye/detectors/validation_n_plus_one.rb +25 -0
- data/lib/eager_eye/issue.rb +18 -6
- data/lib/eager_eye/schema_parser.rb +128 -0
- data/lib/eager_eye/serializer_usage_parser.rb +230 -0
- data/lib/eager_eye/version.rb +1 -1
- data/lib/eager_eye.rb +3 -0
- metadata +6 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: edf21044e597735154b0b1acdcda9230749bf027e8b8acafe70c6aaa1da22b62
|
|
4
|
+
data.tar.gz: b7d6b716ff42f9e160c292a54ecf0344027c73e24eae29f6aecd34aae27d60ac
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1849caab263614bdb85ed1ddcd15f63ae4199cd978ae56e2c8a690ca0e4c0e4616851f9a09f835d95e61adb457e35d5d07fbb3cb189c6394812f7064901cfaed
|
|
7
|
+
data.tar.gz: fe737b046298753a2fb9739f26307d46fbe4852a47f2a147fae56169259824dff4ced9f3f4cc3c6a37c58dbaea03785d2a1003d230d6b5c7cba56c4224ad011e
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,57 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.3.1] - 2026-06-12
|
|
11
|
+
|
|
12
|
+
### Changed — precision (fewer false positives)
|
|
13
|
+
|
|
14
|
+
Validated against two large production apps (~1,080 hand-checked findings). These
|
|
15
|
+
changes cut false positives by ~53% (339 → 158) with near-zero recall loss
|
|
16
|
+
(5 findings), and lift the trustworthy detectors toward 100% precision.
|
|
17
|
+
|
|
18
|
+
- **Schema-aware column guard.** New `SchemaParser` reads `db/schema.rb` (found by
|
|
19
|
+
walking up from the scanned path) to learn every table's real columns. When a
|
|
20
|
+
receiver's model can't be inferred, a method whose name the schema knows as a
|
|
21
|
+
column (`comsn_rate`, `vat_rate`, `service_fee_rate`) is no longer mistaken for
|
|
22
|
+
an association/query method. `loop_association` and `custom_method_query` no
|
|
23
|
+
longer flag column reads on unresolved receivers.
|
|
24
|
+
- **Per-iteration association dedup.** `loop_association` reports a memoized
|
|
25
|
+
`belongs_to`/`has_one` read once per iteration instead of on every line — a
|
|
26
|
+
repeated read hits Rails' instance cache, not the database. Associations used
|
|
27
|
+
as a query-chain base (`x.assoc.find_by`, `x.assoc.where`) still report each
|
|
28
|
+
occurrence, since those re-query.
|
|
29
|
+
- **Serializer render-site awareness.** New `SerializerUsageParser` scans render
|
|
30
|
+
sites (`XxxBlueprint.render*`, AMS `(each_)serializer:`) and records, per
|
|
31
|
+
serializer + Blueprinter view, which associations are eager-loaded and whether
|
|
32
|
+
only single records are passed. `serializer_nesting` stays silent when an
|
|
33
|
+
association is preloaded at every render site of that view, or the serializer
|
|
34
|
+
is only ever handed single records. It never concludes "safe" for a view it
|
|
35
|
+
can't see rendered, so genuine N+1s are preserved.
|
|
36
|
+
- **`custom_method_query` refinements.** Skips Enumerable aggregates with a block
|
|
37
|
+
argument (`relation.sum(&:amount)`), per-batch queries inside
|
|
38
|
+
`in_batches`/`find_in_batches`, and relation query methods called directly on a
|
|
39
|
+
single iteration element (a SELECT alias such as `record.ids`, not a query).
|
|
40
|
+
- **`validation_n_plus_one`** ignores saves that skip validations
|
|
41
|
+
(`save(validate: false)` / `create(..., validate: false)`).
|
|
42
|
+
|
|
43
|
+
### Added
|
|
44
|
+
|
|
45
|
+
- **`--baseline FILE` flag** — compare the current scan against a previously
|
|
46
|
+
captured JSON report and surface only issues that are NOT in the baseline.
|
|
47
|
+
Designed for the brownfield CI workflow: accept existing N+1s as the
|
|
48
|
+
baseline, fail builds only on regressions (new issues introduced by a PR).
|
|
49
|
+
Baseline files are produced by the existing `--format json` output (the
|
|
50
|
+
flag accepts either the full report-shaped object or a bare array of
|
|
51
|
+
issues). Malformed/missing baselines exit with a clear error message.
|
|
52
|
+
- **`EagerEye::Issue.from_h(hash)`** — public factory that rebuilds an
|
|
53
|
+
`Issue` from its serialized form (e.g. a parsed JSON entry). Coerces
|
|
54
|
+
`detector`/`severity` strings back to symbols and defaults severity to
|
|
55
|
+
`:warning` when absent. Round-trips through `to_h` and `to_json`.
|
|
56
|
+
- **`EagerEye::Baseline`** — the helper behind `--baseline`. Loads issues
|
|
57
|
+
from a JSON path (`Baseline.load_issues(path)`) and filters a current
|
|
58
|
+
issue list against them (`Baseline.filter(issues, path)`). Useful
|
|
59
|
+
programmatically for projects that wrap EagerEye in their own runner.
|
|
60
|
+
|
|
10
61
|
## [1.2.15] - 2026-05-01
|
|
11
62
|
|
|
12
63
|
### Fixed
|