eager_eye 1.1.7 → 1.1.9
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 +16 -0
- data/README.md +1 -1
- data/lib/eager_eye/detectors/custom_method_query.rb +17 -8
- 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: e5affda3dbf4ab9e59ce8c0a5fcbadd3b6b11bf60eba882031226050589a2a04
|
|
4
|
+
data.tar.gz: bfa17f748016257d75c7135908656c9bf920b3dc0ea6d8fbbd41352b8a3c96f4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e2d0edc257c6384c294a6f3a40037e2841c9c4a7d0f07cce69cf144ee01cf46353ec58d8db13da9549604206460d43efa4da91fb0966961a827e59cb3fe2518b
|
|
7
|
+
data.tar.gz: 665ba27b30fda25e287ecc7ac34d573d8f523ed1eaab9f52fb9f628ce74b0a562e57a3a92bd6ef70226b9ccadb825577ae7d21e7f674fe080dac01f1df463dbe
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.1.9] - 2026-01-11
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- **CustomMethodQuery False Positive** - Skip `ActionController::Parameters` and Hash tuple access
|
|
15
|
+
- `params.each { |p| p.last }` no longer flagged (tuple access)
|
|
16
|
+
- `hash.each { |k, v| [k, v].last }` no longer flagged
|
|
17
|
+
|
|
18
|
+
## [1.1.8] - 2026-01-10
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
|
|
22
|
+
- **CustomMethodQuery False Positive** - Skip `[]` (bracket access) chains
|
|
23
|
+
- `data["items"].first` no longer flagged as ActiveRecord query
|
|
24
|
+
- Recognizes bracket access returns Array/Hash for subsequent enumerable calls
|
|
25
|
+
|
|
10
26
|
## [1.1.7] - 2026-01-09
|
|
11
27
|
|
|
12
28
|
### 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
|
+
<a href="https://rubygems.org/gems/eager_eye"><img src="https://img.shields.io/badge/gem-v1.1.9-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>
|
|
@@ -8,6 +8,7 @@ module EagerEye
|
|
|
8
8
|
ARRAY_METHODS = %i[first last take].freeze
|
|
9
9
|
HASH_ARRAY_METHODS = %i[keys values].freeze
|
|
10
10
|
STRING_ARRAY_METHODS = %i[split].freeze
|
|
11
|
+
BRACKET_ARRAY_METHODS = %i[[]].freeze
|
|
11
12
|
ITERATION_METHODS = %i[each map select find_all reject collect detect find_index flat_map].freeze
|
|
12
13
|
|
|
13
14
|
def self.detector_name
|
|
@@ -64,10 +65,10 @@ module EagerEye
|
|
|
64
65
|
end
|
|
65
66
|
|
|
66
67
|
def skip_array_method?(node, block_var, is_array_collection)
|
|
67
|
-
return
|
|
68
|
+
return true if receiver_ends_with_hash_array_method?(node.children[0])
|
|
68
69
|
|
|
69
|
-
|
|
70
|
-
|
|
70
|
+
ARRAY_METHODS.include?(node.children[1]) &&
|
|
71
|
+
is_array_collection && receiver_is_only_block_var?(node.children[0], block_var)
|
|
71
72
|
end
|
|
72
73
|
|
|
73
74
|
def receiver_is_only_block_var?(node, block_var)
|
|
@@ -95,17 +96,25 @@ module EagerEye
|
|
|
95
96
|
def collection_is_array?(node)
|
|
96
97
|
return false unless node.is_a?(Parser::AST::Node)
|
|
97
98
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
99
|
+
return true if %i[array hash].include?(node.type)
|
|
100
|
+
|
|
101
|
+
if node.type == :send
|
|
102
|
+
method_name = node.children[1]
|
|
103
|
+
return true if %i[map select collect flat_map to_a uniq compact keys values split []
|
|
104
|
+
params sort].include?(method_name)
|
|
105
|
+
|
|
106
|
+
return collection_is_array?(node.children[0])
|
|
102
107
|
end
|
|
108
|
+
|
|
109
|
+
false
|
|
103
110
|
end
|
|
104
111
|
|
|
105
112
|
def receiver_ends_with_hash_array_method?(node)
|
|
106
113
|
return false unless node.is_a?(Parser::AST::Node) && node.type == :send
|
|
107
114
|
|
|
108
|
-
HASH_ARRAY_METHODS.include?(node.children[1]) ||
|
|
115
|
+
HASH_ARRAY_METHODS.include?(node.children[1]) ||
|
|
116
|
+
STRING_ARRAY_METHODS.include?(node.children[1]) ||
|
|
117
|
+
BRACKET_ARRAY_METHODS.include?(node.children[1])
|
|
109
118
|
end
|
|
110
119
|
|
|
111
120
|
def add_issue(node)
|
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.1.
|
|
4
|
+
version: 1.1.9
|
|
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-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: ast
|