eager_eye 1.1.2 → 1.1.4
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/callback_query.rb +10 -2
- data/lib/eager_eye/detectors/serializer_nesting.rb +15 -0
- 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: 6ae532397830e96202bc3a3d10dc231570f4912d5df67085783123fbb2ebba5e
|
|
4
|
+
data.tar.gz: ddc5a6971c2c65c73260c59ff8b6acfd52711a2e1ce1d43ea8c44895be729016
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fa15940b451ebd100e908b4f9931c8f40708f9566451a0f1edb8a65c70fee15f832bd30d91d49f54c9b2f0ebe63cbdf2f5dbabfb5f7894db23d1a2f35c1e95c5
|
|
7
|
+
data.tar.gz: 80ea91965317596061db8a38cce960ac4f573a4c887de7a2fe88b7a4ad7e43f35f2b18b6716a6487e256e1ed292e8f79c437249e9dbef6cccded54397a7ecf8c
|
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.4] - 2026-01-06
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- **SerializerNesting False Positive** - Skip ActiveStorage attachments
|
|
15
|
+
- `user.avatar.attached?`, `user.avatar.variant(...)` no longer flagged
|
|
16
|
+
- Recognizes `attached?`, `attach`, `blob`, `variant`, `purge` methods
|
|
17
|
+
|
|
18
|
+
## [1.1.3] - 2026-01-04
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
|
|
22
|
+
- **CallbackQuery False Positive** - Skip iterations over constants, arrays, and ranges
|
|
23
|
+
- `CONDITIONS.each { |c| ... }` no longer triggers warning
|
|
24
|
+
- `[:a, :b].each { |x| ... }` and `(1..5).each { |i| ... }` are now ignored
|
|
25
|
+
|
|
10
26
|
## [1.1.2] - 2026-01-04
|
|
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.4-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>
|
|
@@ -109,8 +109,16 @@ module EagerEye
|
|
|
109
109
|
end
|
|
110
110
|
|
|
111
111
|
def iteration_block?(node)
|
|
112
|
-
node.type == :block && node.children[0]&.type == :send
|
|
113
|
-
|
|
112
|
+
return false unless node.type == :block && node.children[0]&.type == :send
|
|
113
|
+
return false unless ITERATION_METHODS.include?(node.children[0].children[1])
|
|
114
|
+
|
|
115
|
+
!static_collection?(node.children[0].children[0])
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def static_collection?(node)
|
|
119
|
+
return true unless node.is_a?(Parser::AST::Node)
|
|
120
|
+
|
|
121
|
+
%i[array const irange erange].include?(node.type)
|
|
114
122
|
end
|
|
115
123
|
|
|
116
124
|
def add_query_issue(node, method_name, callback_type)
|
|
@@ -6,6 +6,8 @@ module EagerEye
|
|
|
6
6
|
SERIALIZER_PATTERNS = %w[ActiveModel::Serializer ActiveModelSerializers::Model Blueprinter::Base Alba::Resource].freeze
|
|
7
7
|
ATTRIBUTE_METHODS = %i[attribute field attributes].freeze
|
|
8
8
|
OBJECT_REFS = %i[object record resource].freeze
|
|
9
|
+
ACTIVE_STORAGE_METHODS = %i[attached? attach attachment attachments blob blobs purge purge_later variant
|
|
10
|
+
preview].freeze
|
|
9
11
|
HAS_MANY_ASSOCIATIONS = %w[
|
|
10
12
|
authors users owners creators admins members customers clients
|
|
11
13
|
posts articles comments categories tags children companies organizations
|
|
@@ -100,8 +102,11 @@ module EagerEye
|
|
|
100
102
|
end
|
|
101
103
|
|
|
102
104
|
def find_association_in_block(block_body, file_path, issues)
|
|
105
|
+
storage_lines = collect_active_storage_lines(block_body)
|
|
106
|
+
|
|
103
107
|
traverse_ast(block_body) do |node|
|
|
104
108
|
next unless node.type == :send
|
|
109
|
+
next if storage_lines.include?(node.loc.line)
|
|
105
110
|
|
|
106
111
|
receiver = node.children[0]
|
|
107
112
|
method_name = node.children[1]
|
|
@@ -116,6 +121,16 @@ module EagerEye
|
|
|
116
121
|
end
|
|
117
122
|
end
|
|
118
123
|
|
|
124
|
+
def collect_active_storage_lines(block_body)
|
|
125
|
+
lines = Set.new
|
|
126
|
+
traverse_ast(block_body) do |node|
|
|
127
|
+
next unless node.type == :send && ACTIVE_STORAGE_METHODS.include?(node.children[1])
|
|
128
|
+
|
|
129
|
+
lines << node.loc.line
|
|
130
|
+
end
|
|
131
|
+
lines
|
|
132
|
+
end
|
|
133
|
+
|
|
119
134
|
def object_reference?(node)
|
|
120
135
|
return false unless node
|
|
121
136
|
|
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.4
|
|
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-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: ast
|