eager_eye 1.1.6 → 1.1.8
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 +15 -0
- data/README.md +1 -1
- data/lib/eager_eye/detectors/custom_method_query.rb +12 -5
- 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: b43ce92b9c6437cbf79890d4bac363d23a81c1297429e70bd7d47ffda5c179ef
|
|
4
|
+
data.tar.gz: 913b85723206ed1c0b9d193bbad46394ff8bbf4cce6cbacf9b9e33ef6e7f7be3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d065cbff74e8d0499fc9cd2218b1e0c1ed2629200cb8447b0c9fd53bfc4814c914b942514872cd8b76181f41c773fb50737f108dc954fc58d1ad64cec6469991
|
|
7
|
+
data.tar.gz: 21b23f430fecc8a4137e18e55a0c9d0bcfb40ebb7c0c36adaff7c92f86eedec895ec37dd1073b0124199fe43833aed8d04fdc55107e3a1532a726f5c060f6b28
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.1.8] - 2026-01-10
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- **CustomMethodQuery False Positive** - Skip `[]` (bracket access) chains
|
|
15
|
+
- `data["items"].first` no longer flagged as ActiveRecord query
|
|
16
|
+
- Recognizes bracket access returns Array/Hash for subsequent enumerable calls
|
|
17
|
+
|
|
18
|
+
## [1.1.7] - 2026-01-09
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
|
|
22
|
+
- **CustomMethodQuery False Positive** - Skip `String#split` chains
|
|
23
|
+
- `url.split("?").first` no longer flagged as ActiveRecord query
|
|
24
|
+
|
|
10
25
|
## [1.1.6] - 2026-01-09
|
|
11
26
|
|
|
12
27
|
### 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.8-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>
|
|
@@ -7,6 +7,8 @@ module EagerEye
|
|
|
7
7
|
maximum].freeze
|
|
8
8
|
ARRAY_METHODS = %i[first last take].freeze
|
|
9
9
|
HASH_ARRAY_METHODS = %i[keys values].freeze
|
|
10
|
+
STRING_ARRAY_METHODS = %i[split].freeze
|
|
11
|
+
BRACKET_ARRAY_METHODS = %i[[]].freeze
|
|
10
12
|
ITERATION_METHODS = %i[each map select find_all reject collect detect find_index flat_map].freeze
|
|
11
13
|
|
|
12
14
|
def self.detector_name
|
|
@@ -63,10 +65,10 @@ module EagerEye
|
|
|
63
65
|
end
|
|
64
66
|
|
|
65
67
|
def skip_array_method?(node, block_var, is_array_collection)
|
|
66
|
-
return
|
|
68
|
+
return true if receiver_ends_with_hash_array_method?(node.children[0])
|
|
67
69
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
+
ARRAY_METHODS.include?(node.children[1]) &&
|
|
71
|
+
is_array_collection && receiver_is_only_block_var?(node.children[0], block_var)
|
|
70
72
|
end
|
|
71
73
|
|
|
72
74
|
def receiver_is_only_block_var?(node, block_var)
|
|
@@ -96,13 +98,18 @@ module EagerEye
|
|
|
96
98
|
|
|
97
99
|
case node.type
|
|
98
100
|
when :array then true
|
|
99
|
-
when :send then %i[map select collect flat_map to_a uniq compact keys values
|
|
101
|
+
when :send then %i[map select collect flat_map to_a uniq compact keys values split
|
|
102
|
+
[]].include?(node.children[1])
|
|
100
103
|
else false
|
|
101
104
|
end
|
|
102
105
|
end
|
|
103
106
|
|
|
104
107
|
def receiver_ends_with_hash_array_method?(node)
|
|
105
|
-
node.is_a?(Parser::AST::Node) && node.type == :send
|
|
108
|
+
return false unless node.is_a?(Parser::AST::Node) && node.type == :send
|
|
109
|
+
|
|
110
|
+
HASH_ARRAY_METHODS.include?(node.children[1]) ||
|
|
111
|
+
STRING_ARRAY_METHODS.include?(node.children[1]) ||
|
|
112
|
+
BRACKET_ARRAY_METHODS.include?(node.children[1])
|
|
106
113
|
end
|
|
107
114
|
|
|
108
115
|
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.8
|
|
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-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: ast
|