eager_eye 0.7.0 → 0.9.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: a8d34dc13a536c66ca82e9495ba5e53b81c31f1e2764dea3ba8d64c434da69ec
4
- data.tar.gz: d63753e0d80c366cc9b87fe6bcc5bc2f2ee1ba537e7363c2b6aadafffd5a4a05
3
+ metadata.gz: 171872ece399f7fb40631980c6a9a3691388f510f56bc1bf23307c47f4e71881
4
+ data.tar.gz: bc1d7e10759c6b20d3a05719891124e3221981ac5452a3bfd410c274c4ab09ab
5
5
  SHA512:
6
- metadata.gz: bf3ff2ba24314b8b6e22385c82685d8909729f12ffc9d48531bd7fe4c6a1683e2aadb5692934ec300430dfdbc0cde795489e9a68a98072658a9452cd8e6e338b
7
- data.tar.gz: fd73786c8c983b2bcc3d3860bf1036dc1525523dcce8ef06767760dfce57b813ee415679fa42cc7631830e8c4780f0bbbdecc61ae4563b964a983ada5c2c0d42
6
+ metadata.gz: cda4195e0e168cc83ec5fd069ff39bb9094d6b9f17c00b62f58241d694d4a0d1b8d97d8e94f467d0d01ac80fc44f2ac76b448d94c752cdaf65ff52a1d2b3914d
7
+ data.tar.gz: 79d78b12ffd9b6a6d087df6a25132b3e96832f375a0f29869ad3c630a30e73c8280a79af34190725ddcf02218302a506a5a8f5bfff477bb8c8f06231ba5b2535
data/CHANGELOG.md CHANGED
@@ -7,6 +7,31 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.9.0] - 2025-12-16
11
+
12
+ ### Added
13
+
14
+ - **VS Code Extension** - Released as a separate package
15
+ - Real-time diagnostics on file save
16
+ - Problem highlighting with squiggly underlines
17
+ - Quick fix actions for common issues
18
+ - Status bar showing issue count
19
+ - Commands: Analyze Current File, Analyze Workspace, Clear Diagnostics
20
+ - Configuration options for enabling/disabling features
21
+ - See: https://marketplace.visualstudio.com/items?itemName=hamzagedikkaya.eager-eye
22
+
23
+ ## [0.8.0] - 2025-12-16
24
+
25
+ ### Added
26
+
27
+ - **RSpec Integration** - RSpec matchers for testing your codebase
28
+ - `pass_eager_eye` matcher for testing files and directories
29
+ - `only` option to run specific detectors
30
+ - `exclude` option to exclude files by glob pattern
31
+ - `max_issues` option for gradual migration (allows up to N issues)
32
+ - `require "eager_eye/rspec"` for easy integration
33
+ - Helpful failure messages with issue details
34
+
10
35
  ## [0.7.0] - 2025-12-15
11
36
 
12
37
  ### Added
data/README.md CHANGED
@@ -4,6 +4,7 @@
4
4
  [![Gem Version](https://badge.fury.io/rb/eager_eye.svg)](https://badge.fury.io/rb/eager_eye)
5
5
  [![Ruby](https://img.shields.io/badge/ruby-%3E%3D%203.1-ruby.svg)](https://www.ruby-lang.org/)
6
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
+ [![VS Code Extension](https://img.shields.io/badge/VS%20Code-Extension-blue.svg)](https://marketplace.visualstudio.com/items?itemName=hamzagedikkaya.eager-eye)
7
8
 
8
9
  **Static analysis tool for detecting N+1 queries in Rails applications.**
9
10
 
@@ -358,6 +359,46 @@ Apply this fix? [y/n/q] y
358
359
 
359
360
  > **Warning:** Auto-fix is experimental. Always review changes and run your test suite after applying fixes.
360
361
 
362
+ ## RSpec Integration
363
+
364
+ EagerEye provides RSpec matchers for testing your codebase:
365
+
366
+ ```ruby
367
+ # spec/rails_helper.rb
368
+ require "eager_eye/rspec"
369
+
370
+ # spec/eager_eye_spec.rb
371
+ RSpec.describe "EagerEye Analysis" do
372
+ it "controllers have no N+1 issues" do
373
+ expect("app/controllers").to pass_eager_eye
374
+ end
375
+
376
+ it "serializers are clean" do
377
+ expect("app/serializers").to pass_eager_eye(only: [:serializer_nesting])
378
+ end
379
+
380
+ # Allow some issues during migration
381
+ it "legacy code is acceptable" do
382
+ expect("app/services/legacy").to pass_eager_eye(max_issues: 10)
383
+ end
384
+
385
+ it "models have no callback issues except legacy" do
386
+ expect("app/models").to pass_eager_eye(
387
+ only: [:callback_query],
388
+ exclude: ["app/models/legacy/**"]
389
+ )
390
+ end
391
+ end
392
+ ```
393
+
394
+ ### Matcher Options
395
+
396
+ | Option | Type | Description |
397
+ |--------|------|-------------|
398
+ | `only` | `Array<Symbol>` | Run only specified detectors |
399
+ | `exclude` | `Array<String>` | Glob patterns to exclude |
400
+ | `max_issues` | `Integer` | Maximum allowed issues (default: 0) |
401
+
361
402
  ## Configuration
362
403
 
363
404
  ### Config File (.eager_eye.yml)
@@ -491,6 +532,18 @@ EagerEye uses static analysis, which means:
491
532
 
492
533
  For best results, use EagerEye alongside runtime tools like Bullet for comprehensive N+1 detection.
493
534
 
535
+ ## VS Code Extension
536
+
537
+ EagerEye is also available as a VS Code extension for real-time analysis while coding.
538
+
539
+ **Features:**
540
+ - Real-time analysis on file save
541
+ - Problem highlighting with squiggly underlines
542
+ - Quick fix actions for common issues
543
+ - Status bar showing issue count
544
+
545
+ **Install:** Search for "EagerEye" in VS Code Extensions or visit the [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=hamzagedikkaya.eager-eye).
546
+
494
547
  ## Development
495
548
 
496
549
  ```bash
@@ -0,0 +1,71 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EagerEye
4
+ module RSpec
5
+ module Matchers
6
+ def pass_eager_eye(options = {})
7
+ PassEagerEyeMatcher.new(options)
8
+ end
9
+
10
+ class PassEagerEyeMatcher
11
+ def initialize(options = {})
12
+ @only = options[:only]
13
+ @exclude = options[:exclude] || []
14
+ @max_issues = options[:max_issues] || 0
15
+ @issues = []
16
+ @path = nil
17
+ end
18
+
19
+ def matches?(path)
20
+ @path = path
21
+ configure_eager_eye
22
+ analyzer = build_analyzer
23
+ @issues = analyzer.run
24
+ @issues.count <= @max_issues
25
+ end
26
+
27
+ def failure_message
28
+ message = "expected #{@path} to pass EagerEye analysis"
29
+ message += " (max #{@max_issues} issues)" if @max_issues.positive?
30
+ message += ", but found #{@issues.count} issue(s):\n\n"
31
+
32
+ @issues.group_by(&:file_path).each do |file, file_issues|
33
+ message += "#{file}:\n"
34
+ file_issues.each do |issue|
35
+ message += " Line #{issue.line_number}: [#{issue.detector}] #{issue.message}\n"
36
+ end
37
+ message += "\n"
38
+ end
39
+
40
+ message
41
+ end
42
+
43
+ def failure_message_when_negated
44
+ "expected #{@path} to have EagerEye issues, but it passed"
45
+ end
46
+
47
+ def description
48
+ desc = "pass EagerEye analysis"
49
+ desc += " for #{@only.join(", ")}" if @only
50
+ desc += " (max #{@max_issues} issues)" if @max_issues.positive?
51
+ desc
52
+ end
53
+
54
+ private
55
+
56
+ def configure_eager_eye
57
+ EagerEye.reset_configuration!
58
+ EagerEye.configure do |config|
59
+ config.enabled_detectors = @only if @only
60
+ config.excluded_paths = @exclude unless @exclude.empty?
61
+ config.fail_on_issues = false
62
+ end
63
+ end
64
+
65
+ def build_analyzer
66
+ EagerEye::Analyzer.new(paths: [@path])
67
+ end
68
+ end
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "eager_eye"
4
+ require "eager_eye/rspec/matchers"
5
+
6
+ RSpec.configure do |config|
7
+ config.include EagerEye::RSpec::Matchers
8
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EagerEye
4
- VERSION = "0.7.0"
4
+ VERSION = "0.9.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: 0.7.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - hamzagedikkaya
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-12-15 00:00:00.000000000 Z
11
+ date: 2025-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ast
@@ -80,6 +80,8 @@ files:
80
80
  - lib/eager_eye/reporters/base.rb
81
81
  - lib/eager_eye/reporters/console.rb
82
82
  - lib/eager_eye/reporters/json.rb
83
+ - lib/eager_eye/rspec.rb
84
+ - lib/eager_eye/rspec/matchers.rb
83
85
  - lib/eager_eye/version.rb
84
86
  - sig/eager_eye.rbs
85
87
  homepage: https://github.com/hamzagedikkaya/eager_eye