eager_eye 1.1.13 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2016440524db060dc267545c436a7f3ed33958efc344bba2a6c14b94a69dd0a3
4
- data.tar.gz: 61961e507f36c1929f0d1d68a8b05ec8169667aac2e8f941e155d94af01d011f
3
+ metadata.gz: 717dbf77ddadff7da379108a74205cabaed1cdb2796ff8af8dce681fca07b1c9
4
+ data.tar.gz: 424b8b40da2e4bb69f54d58a5d2923346b016db3d1e69220c06e8bbde0dfa7c6
5
5
  SHA512:
6
- metadata.gz: 9ff57ccdd2efe4fa5cf526a6833caa534e429cf45b84ac5e8e578b1bc280d088ec0aa65553879da5d654561a963b80d7381928fcb8e2275060d78271600b8468
7
- data.tar.gz: ccc2892f3bfb35d89fd2a2b2b7976e80ecae008d9341f93231a1e23fc4d444a614402253e28d1c2f6b3e8a4bab8c5c5d42ae8e6c4ad22d888f9aef0315f1f895
6
+ metadata.gz: efd5e760d3ea54457eb837011b538424553c532ca38a29660a3865c952a32a42ff82bbaeca5925fd423c56510800fc6bc961483a6c167e5a7b132eb06b2f93d3
7
+ data.tar.gz: 5d80c29a7a1648541377e10e990869293e9f1ba3c99490fec4aa4efab16b99ad56f7ac00b8ab5df9763c70dc41d3dbe2ee9984212f43e2d261f599c15aca8919
data/CHANGELOG.md CHANGED
@@ -7,6 +7,15 @@ 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
+
10
19
  ## [1.1.13] - 2026-01-16
11
20
 
12
21
  ### 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.1.13-red.svg" alt="Gem Version"></a>
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>
@@ -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 && single_line_pattern?
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.gsub(/\.pluck\((:\w+)\)/, '.select(\1)')
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&.include?(".pluck(") && line_content.include?(".where(")
23
+ line_content&.match?(/\.where\s*\([^)]*\.pluck\(/)
20
24
  end
21
25
  end
22
26
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EagerEye
4
- VERSION = "1.1.13"
4
+ VERSION = "1.2.0"
5
5
  end
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.1.13
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-16 00:00:00.000000000 Z
11
+ date: 2026-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ast