eager_eye 1.1.12 → 1.2.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -0
- data/README.md +1 -1
- data/lib/eager_eye/detectors/custom_method_query.rb +1 -1
- data/lib/eager_eye/fixers/pluck_to_select.rb +7 -3
- 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: 717dbf77ddadff7da379108a74205cabaed1cdb2796ff8af8dce681fca07b1c9
|
|
4
|
+
data.tar.gz: 424b8b40da2e4bb69f54d58a5d2923346b016db3d1e69220c06e8bbde0dfa7c6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: efd5e760d3ea54457eb837011b538424553c532ca38a29660a3865c952a32a42ff82bbaeca5925fd423c56510800fc6bc961483a6c167e5a7b132eb06b2f93d3
|
|
7
|
+
data.tar.gz: 5d80c29a7a1648541377e10e990869293e9f1ba3c99490fec4aa4efab16b99ad56f7ac00b8ab5df9763c70dc41d3dbe2ee9984212f43e2d261f599c15aca8919
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.2.0] - 2026-01-18
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
- **Safer PluckToSelect Auto-fix** - Improved safety for `.pluck` to `.select` auto-fixer
|
|
15
|
+
- Skips `info` severity issues (small collections like `statuses`, `types`) to preserve caching
|
|
16
|
+
- Uses strict regex to ensure `.pluck` is inside `.where` arguments to prevent code breakage
|
|
17
|
+
- Prevents unsafe replacements like `User.where(active: 1).pluck(:id)` → `select` (which changes return type)
|
|
18
|
+
|
|
19
|
+
## [1.1.13] - 2026-01-16
|
|
20
|
+
|
|
21
|
+
### Fixed
|
|
22
|
+
|
|
23
|
+
- **CustomMethodQuery False Positive** - Skip `.ids` on SQL alias attributes
|
|
24
|
+
- `s_eod.ids` no longer flagged when `ids` is a SQL alias (e.g., `select('array_agg(...) AS ids')`)
|
|
25
|
+
- Deep chains like `item.comments.ids` still correctly detected
|
|
26
|
+
|
|
10
27
|
## [1.1.12] - 2026-01-15
|
|
11
28
|
|
|
12
29
|
### 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.
|
|
13
|
+
<a href="https://rubygems.org/gems/eager_eye"><img src="https://img.shields.io/badge/gem-v1.2.0-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>
|
|
@@ -5,7 +5,7 @@ module EagerEye
|
|
|
5
5
|
class CustomMethodQuery < Base
|
|
6
6
|
QUERY_METHODS = %i[where find_by find_by! exists? find first last take pluck ids count sum average minimum
|
|
7
7
|
maximum].freeze
|
|
8
|
-
SAFE_QUERY_METHODS = %i[first last take count sum find size length].freeze
|
|
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
|
ITERATION_METHODS = %i[each map select find_all reject collect detect find_index flat_map].freeze
|
|
11
11
|
|
|
@@ -4,19 +4,23 @@ module EagerEye
|
|
|
4
4
|
module Fixers
|
|
5
5
|
class PluckToSelect < Base
|
|
6
6
|
def fixable?
|
|
7
|
-
issue.detector == :pluck_to_array &&
|
|
7
|
+
issue.detector == :pluck_to_array &&
|
|
8
|
+
issue.severity != :info &&
|
|
9
|
+
single_line_pattern?
|
|
8
10
|
end
|
|
9
11
|
|
|
10
12
|
protected
|
|
11
13
|
|
|
12
14
|
def fixed_content
|
|
13
|
-
line_content.
|
|
15
|
+
line_content.sub(/(\.where\s*\([^)]*)(\.pluck)(\((?::\w+)\))/) do
|
|
16
|
+
"#{::Regexp.last_match(1)}.select#{::Regexp.last_match(3)}"
|
|
17
|
+
end
|
|
14
18
|
end
|
|
15
19
|
|
|
16
20
|
private
|
|
17
21
|
|
|
18
22
|
def single_line_pattern?
|
|
19
|
-
line_content&.
|
|
23
|
+
line_content&.match?(/\.where\s*\([^)]*\.pluck\(/)
|
|
20
24
|
end
|
|
21
25
|
end
|
|
22
26
|
end
|
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.
|
|
4
|
+
version: 1.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- hamzagedikkaya
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-01-
|
|
11
|
+
date: 2026-01-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: ast
|