rails_best_practices 1.23.4 → 1.23.5

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: 4c5b1cab92f8155a04691799a09c7b8413a0ec4ce05c69f33a459e9652b4ed94
4
- data.tar.gz: dd20f5bfeca9f5d9cd4cec9de97dd5c740d572c777012765d584272a4de6f7ec
3
+ metadata.gz: 1b79a2271c8b3c7bb805e9dc8f77c9398c7ca059857fe1880a0afea162f1e316
4
+ data.tar.gz: 3c88065ef997537a0ebcca377e09b2cacebc547f93269ab2a68480aeeb639d0c
5
5
  SHA512:
6
- metadata.gz: bb67e06d2ff8fd8a933f6090c613a47067541801af8f73bf054a48c3c0a5fea6e74aca4e10d0fc46b7aeec629d37583d0d35bbe3aa537123d8e36141d1646f4c
7
- data.tar.gz: e3a0bdfa6cd8d25d1bfc78ea43440dc9319191f734408024c0b4a2b7b33218753da8b3cd7fff88e5e643f923a2fea328baadf99975034fac4f49cb33d239b006
6
+ metadata.gz: ad8bec7c01a84e0fd0d1b21d9e68a12c1621867d589eb9ad6d900d76683565499a4d6ef0ecf496cd36d54dda589c614db8c09b6b4842b0954372a49ba43ebccc
7
+ data.tar.gz: 688007d0ff2d631c945bc8fd40632a80d700091e7281487d872d0a88d1abbc6ab9ae740d441bb4de8046c71d001ad6aefb34e466ba2883b5ae5888dfa96485f9
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 4.0.3
1
+ 4.0.10
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Next Release
2
2
 
3
+ ## 1.23.5 (2026-12-04)
4
+
5
+ * Recognize Rails action callbacks as used controller methods
6
+
3
7
  ## 1.23.4 (2026-04-23)
4
8
 
5
9
  * Fix Haml 6+ template compilation in Runner (Temple Engine#call)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rails_best_practices (1.23.4)
4
+ rails_best_practices (1.23.5)
5
5
  activesupport
6
6
  code_analyzer (~> 0.5.5)
7
7
  erubis
@@ -61,7 +61,7 @@ module RailsBestPractices
61
61
  action_name = first_argument.hash_value('state').to_s
62
62
  call_method(action_name, current_class_name)
63
63
  end
64
- when 'around_filter', 'around_action'
64
+ when 'around_filter', /\A(?:append_|prepend_)?(?:before|after|around)_action\z/
65
65
  node.arguments.all.each { |argument| mark_used(argument) }
66
66
  when 'layout'
67
67
  first_argument = node.arguments.all.first
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsBestPractices
4
- VERSION = '1.23.4'
4
+ VERSION = '1.23.5'
5
5
  end
@@ -13,6 +13,38 @@ module RailsBestPractices
13
13
  end
14
14
 
15
15
  context 'private/protected' do
16
+ [
17
+ 'before_action :load_post, prepend: true',
18
+ 'before_action(:load_post)',
19
+ 'after_action(:load_post)',
20
+ 'prepend_before_action :load_post',
21
+ 'prepend_after_action(:load_post)',
22
+ 'prepend_around_action :load_post',
23
+ 'append_before_action(:load_post)',
24
+ 'append_after_action :load_post',
25
+ 'append_around_action(:load_post)'
26
+ ].each do |declaration|
27
+ it "recognizes the callback in #{declaration}" do
28
+ content = <<-EOF
29
+ class PostsController < ApplicationController
30
+ #{declaration}
31
+ skip_before_action :unused, raise: false
32
+
33
+ private
34
+
35
+ def load_post; end
36
+ def unused; end
37
+ end
38
+ EOF
39
+ runner.prepare('app/controllers/posts_controller.rb', content)
40
+ runner.review('app/controllers/posts_controller.rb', content)
41
+ runner.after_review
42
+ expect(runner.errors.map(&:to_s)).to eq([
43
+ 'app/controllers/posts_controller.rb:8 - remove unused methods (PostsController#unused)'
44
+ ])
45
+ end
46
+ end
47
+
16
48
  it 'removes unused methods' do
17
49
  content = <<-EOF
18
50
  RailsBestPracticesCom::Application.routes.draw do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_best_practices
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.23.4
4
+ version: 1.23.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Huang
@@ -419,7 +419,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
419
419
  - !ruby/object:Gem::Version
420
420
  version: 1.3.6
421
421
  requirements: []
422
- rubygems_version: 4.0.6
422
+ rubygems_version: 4.0.20
423
423
  specification_version: 4
424
424
  summary: a code metric tool for rails codes.
425
425
  test_files: