eager_eye 1.2.2 → 1.2.3
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 +12 -0
- data/README.md +1 -1
- data/lib/eager_eye/detectors/callback_query.rb +7 -2
- data/lib/eager_eye/detectors/count_in_iteration.rb +2 -1
- data/lib/eager_eye/detectors/custom_method_query.rb +2 -1
- data/lib/eager_eye/detectors/loop_association.rb +2 -1
- data/lib/eager_eye/detectors/missing_counter_cache.rb +2 -1
- data/lib/eager_eye/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2fbde5efcfa326afaf12645241e817095fbe2ac39ad69576f101d81f294b8337
|
|
4
|
+
data.tar.gz: dbd0a6d263aab997fe358cbf2194ce55629d587feffcd4652e7f13d58d459343
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4b0ddfa32f3e65955cc6da31339ca86985554709f229a7cc2ebc1ce84262f767c5104451df34e359e3d9f9470d4c916192652ed44ea958dbfcfe680b057b8996
|
|
7
|
+
data.tar.gz: 1cf0da613bed275088977144260c1b44ddd3ddadc72f063bce5ac3706a827a63e526dd043cc1e76a544fabe809b7c48432782900ac1602f25c3f218d44b426d0
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.2.3] - 2026-02-15
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **Batch Iteration Support** - All detectors now recognize `find_each`, `find_in_batches`, and `in_batches`
|
|
15
|
+
- `LoopAssociation`: Detects association calls inside `find_each` blocks
|
|
16
|
+
- `CallbackQuery`: Detects query iterations inside `find_each` in callbacks
|
|
17
|
+
- `MissingCounterCache`: Detects `.count`/`.size`/`.length` inside `find_each` blocks
|
|
18
|
+
- `CountInIteration`: Detects `.count` inside `find_each` blocks
|
|
19
|
+
- `CustomMethodQuery`: Detects `.where`/`.find_by` etc. inside `find_each` blocks
|
|
20
|
+
- Previously, `User.find_each { |u| u.posts }` was not flagged — now correctly detected as N+1
|
|
21
|
+
|
|
10
22
|
## [1.2.2] - 2026-01-31
|
|
11
23
|
|
|
12
24
|
### Fixed
|
data/README.md
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
<p align="center">
|
|
12
12
|
<a href="https://github.com/hamzagedikkaya/eager_eye/actions/workflows/main.yml"><img src="https://github.com/hamzagedikkaya/eager_eye/actions/workflows/main.yml/badge.svg" alt="CI"></a>
|
|
13
|
-
<a href="https://rubygems.org/gems/eager_eye"><img src="https://img.shields.io/badge/gem-v1.2.
|
|
13
|
+
<a href="https://rubygems.org/gems/eager_eye"><img src="https://img.shields.io/badge/gem-v1.2.3-red.svg" alt="Gem Version"></a>
|
|
14
14
|
<a href="https://github.com/hamzagedikkaya/eager_eye"><img src="https://img.shields.io/badge/coverage-95%25-brightgreen.svg" alt="Coverage"></a>
|
|
15
15
|
<a href="https://www.ruby-lang.org/"><img src="https://img.shields.io/badge/ruby-%3E%3D%203.1-ruby.svg" alt="Ruby"></a>
|
|
16
16
|
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a>
|
|
@@ -26,7 +26,9 @@ module EagerEye
|
|
|
26
26
|
reload
|
|
27
27
|
].freeze
|
|
28
28
|
|
|
29
|
-
ITERATION_METHODS = %i[each map select find_all reject collect
|
|
29
|
+
ITERATION_METHODS = %i[each map select find_all reject collect
|
|
30
|
+
find_each find_in_batches in_batches].freeze
|
|
31
|
+
AR_BATCH_METHODS = %i[find_each find_in_batches in_batches].freeze
|
|
30
32
|
|
|
31
33
|
def self.detector_name
|
|
32
34
|
:callback_query
|
|
@@ -110,7 +112,10 @@ module EagerEye
|
|
|
110
112
|
|
|
111
113
|
def iteration_block?(node)
|
|
112
114
|
return false unless node.type == :block && node.children[0]&.type == :send
|
|
113
|
-
|
|
115
|
+
|
|
116
|
+
method_name = node.children[0].children[1]
|
|
117
|
+
return false unless ITERATION_METHODS.include?(method_name)
|
|
118
|
+
return true if AR_BATCH_METHODS.include?(method_name)
|
|
114
119
|
|
|
115
120
|
!static_collection?(node.children[0].children[0])
|
|
116
121
|
end
|
|
@@ -4,7 +4,8 @@ module EagerEye
|
|
|
4
4
|
module Detectors
|
|
5
5
|
class CountInIteration < Base
|
|
6
6
|
COUNT_METHODS = %i[count].freeze
|
|
7
|
-
ITERATION_METHODS = %i[each map select find_all reject collect each_with_index each_with_object flat_map
|
|
7
|
+
ITERATION_METHODS = %i[each map select find_all reject collect each_with_index each_with_object flat_map
|
|
8
|
+
find_each find_in_batches in_batches].freeze
|
|
8
9
|
|
|
9
10
|
def self.detector_name
|
|
10
11
|
:count_in_iteration
|
|
@@ -8,7 +8,8 @@ module EagerEye
|
|
|
8
8
|
SAFE_QUERY_METHODS = %i[first last take count sum find size length ids].freeze
|
|
9
9
|
SAFE_TRANSFORM_METHODS = %i[keys values split [] params sort pluck ids to_s to_a to_i chars bytes].freeze
|
|
10
10
|
ARRAY_COLUMN_SUFFIXES = %w[_ids _tags _types _codes _names _values].freeze
|
|
11
|
-
ITERATION_METHODS = %i[each map select find_all reject collect detect find_index flat_map
|
|
11
|
+
ITERATION_METHODS = %i[each map select find_all reject collect detect find_index flat_map
|
|
12
|
+
find_each find_in_batches in_batches].freeze
|
|
12
13
|
|
|
13
14
|
def self.detector_name
|
|
14
15
|
:custom_method_query
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
module EagerEye
|
|
4
4
|
module Detectors
|
|
5
5
|
class LoopAssociation < Base
|
|
6
|
-
ITERATION_METHODS = %i[each map collect select find find_all reject filter filter_map flat_map
|
|
6
|
+
ITERATION_METHODS = %i[each map collect select find find_all reject filter filter_map flat_map
|
|
7
|
+
find_each find_in_batches in_batches].freeze
|
|
7
8
|
PRELOAD_METHODS = %i[includes preload eager_load].freeze
|
|
8
9
|
SINGLE_RECORD_METHODS = %i[find find_by find_by! first first! last last! take take! second third fourth fifth
|
|
9
10
|
forty_two sole find_sole_by].freeze
|
|
@@ -10,7 +10,8 @@ module EagerEye
|
|
|
10
10
|
likes favorites bookmarks votes children replies responses answers questions
|
|
11
11
|
].freeze
|
|
12
12
|
ITERATION_METHODS = %i[each map collect select reject find_all filter filter_map flat_map
|
|
13
|
-
each_with_index each_with_object reduce inject sum
|
|
13
|
+
each_with_index each_with_object reduce inject sum
|
|
14
|
+
find_each find_in_batches in_batches].freeze
|
|
14
15
|
|
|
15
16
|
def self.detector_name
|
|
16
17
|
:missing_counter_cache
|
data/lib/eager_eye/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: eager_eye
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.2.
|
|
4
|
+
version: 1.2.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- hamzagedikkaya
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-02-
|
|
11
|
+
date: 2026-02-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: ast
|