sevencop 0.28.0 → 0.29.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: 79bb602015c9eea9c89de44bfbd22274ef1197412a420f274280cc3cac7fe8c5
4
- data.tar.gz: 8fe918f1ad6031ec0b4886a778e5333d9574ecf23c5658f133e32423349d2a28
3
+ metadata.gz: d415f24d882b17eb832c22fa9a17d40ebf1ea91fda15e5a25e8e5ceea6824633
4
+ data.tar.gz: b770d04a2620d1ef6e5f7a0e0b0cd1e6f440b44a5173bd8c26890f0707a4e9b5
5
5
  SHA512:
6
- metadata.gz: 0bdc4d1d137ea5c3a3b2048e8c1aa37bfff81672aef0b10d75cc361f4ff10938d9327ec1193f7936b6180b8fc2e2f6e51909723a9b036279c2852d76e810990b
7
- data.tar.gz: 4235669bbd83b5f460663877b3e47272bffa0aadec21e1f413a7e957c6f0bdafe851443d0bbff5985553978b495e4b8c0d418b7736b9ebc9f2ee941859885f85
6
+ metadata.gz: ddd45cdafff3edc2512a962f32d817cd5836f5435547d987c76f96a0d3a873f8398506dc567caea00ed165f7bd206378bcdbea71eec0516fe05ce7249a2b88e9
7
+ data.tar.gz: 737bd07f00679aa77fce2209f9692b5babff560362a03c412f228584f74d4cd213bbfc5a1223ed999e3ba66abb3f6f7cd7cfcd1d702ee4fed7f8f80d4940e0a3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sevencop (0.28.0)
4
+ sevencop (0.29.0)
5
5
  activesupport
6
6
  rubocop
7
7
 
data/README.md CHANGED
@@ -36,11 +36,11 @@ Note that all cops are `Enabled: false` by default.
36
36
  - [Sevencop/MethodDefinitionInIncluded](lib/rubocop/cop/sevencop/method_definition_in_included.rb)
37
37
  - [Sevencop/MethodDefinitionKeywordArgumentOrdered](lib/rubocop/cop/sevencop/method_definition_keyword_argument_ordered.rb)
38
38
  - [Sevencop/MethodDefinitionOrdered](lib/rubocop/cop/sevencop/method_definition_ordered.rb)
39
- - [Sevencop/RailsActionName](lib/rubocop/cop/sevencop/rails_action_name.rb)
40
39
  - [Sevencop/RailsBelongsToOptional](lib/rubocop/cop/sevencop/rails_belongs_to_optional.rb)
41
40
  - [Sevencop/RailsDateAndTimeCalculation](lib/rubocop/cop/sevencop/rails_date_and_time_calculation.rb)
42
41
  - [Sevencop/RailsInferredSpecType](lib/rubocop/cop/sevencop/rails_inferred_spec_type.rb)
43
42
  - [Sevencop/RailsOrderField](lib/rubocop/cop/sevencop/rails_order_field.rb)
43
+ - [Sevencop/RailsSpecificActionName](lib/rubocop/cop/sevencop/rails_specific_action_name.rb)
44
44
  - [Sevencop/RailsUniquenessValidatorExplicitCaseSensitivity](lib/rubocop/cop/sevencop/rails_uniqueness_validator_explicit_case_sensitivity.rb)
45
45
  - [Sevencop/RailsWhereNot](lib/rubocop/cop/sevencop/rails_where_not.rb)
46
46
  - [Sevencop/RequireOrdered](lib/rubocop/cop/sevencop/require_ordered.rb)
data/config/default.yml CHANGED
@@ -68,22 +68,6 @@ Sevencop/MethodDefinitionKeywordArgumentOrdered:
68
68
  Safe: false
69
69
  VersionAdded: '0.13'
70
70
 
71
- Sevencop/RailsActionName:
72
- Description: |
73
- Use only specific action names.
74
- Enabled: false
75
- VersionAdded: '0.24'
76
- ActionNames:
77
- - create
78
- - destroy
79
- - edit
80
- - index
81
- - new
82
- - show
83
- - update
84
- Include:
85
- - app/controllers/**/*.rb
86
-
87
71
  Sevencop/RailsBelongsToOptional:
88
72
  Description: |
89
73
  Force `belongs_to` with `optional: true` option.
@@ -112,6 +96,23 @@ Sevencop/RailsOrderField:
112
96
  Safe: false
113
97
  VersionAdded: '0.4'
114
98
 
99
+ Sevencop/RailsSpecificActionName:
100
+ Description: |
101
+ Use only specific action names.
102
+ Enabled: false
103
+ VersionAdded: '0.24'
104
+ VersionChanged: '0.29'
105
+ ActionNames:
106
+ - create
107
+ - destroy
108
+ - edit
109
+ - index
110
+ - new
111
+ - show
112
+ - update
113
+ Include:
114
+ - app/controllers/**/*.rb
115
+
115
116
  Sevencop/RailsUniquenessValidatorExplicitCaseSensitivity:
116
117
  Description: |
117
118
  Specify :case_sensitivity option on use of UniquenessValidator.
@@ -5,6 +5,9 @@ module RuboCop
5
5
  module Sevencop
6
6
  # Use only specific action names.
7
7
  #
8
+ # It is good practice to separate controller classes rather than adding more actions as needed.
9
+ # By default, the 7 CRUD action names are specified that are generated by the Rails scaffold.
10
+ #
8
11
  # @example
9
12
  # # bad
10
13
  # class UsersController < ApplicationController
@@ -17,7 +20,7 @@ module RuboCop
17
20
  # def index
18
21
  # end
19
22
  # end
20
- class RailsActionName < Base
23
+ class RailsSpecificActionName < Base
21
24
  include VisibilityHelp
22
25
 
23
26
  MSG = 'Use only specific action names.'
@@ -27,7 +30,13 @@ module RuboCop
27
30
  def on_def(node)
28
31
  return unless bad?(node)
29
32
 
30
- add_offense(node.location.name)
33
+ add_offense(
34
+ node.location.name,
35
+ message: format(
36
+ 'Use only specific action names (%<action_names>s).',
37
+ action_names: configured_action_names.join(', ')
38
+ )
39
+ )
31
40
  end
32
41
 
33
42
  private
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Sevencop
4
- VERSION = '0.28.0'
4
+ VERSION = '0.29.0'
5
5
  end
data/lib/sevencop.rb CHANGED
@@ -12,11 +12,11 @@ require_relative 'rubocop/cop/sevencop/method_definition_arguments_multiline'
12
12
  require_relative 'rubocop/cop/sevencop/method_definition_in_included'
13
13
  require_relative 'rubocop/cop/sevencop/method_definition_keyword_argument_ordered'
14
14
  require_relative 'rubocop/cop/sevencop/method_definition_ordered'
15
- require_relative 'rubocop/cop/sevencop/rails_action_name'
16
15
  require_relative 'rubocop/cop/sevencop/rails_belongs_to_optional'
17
16
  require_relative 'rubocop/cop/sevencop/rails_date_and_time_calculation'
18
17
  require_relative 'rubocop/cop/sevencop/rails_inferred_spec_type'
19
18
  require_relative 'rubocop/cop/sevencop/rails_order_field'
19
+ require_relative 'rubocop/cop/sevencop/rails_specific_action_name'
20
20
  require_relative 'rubocop/cop/sevencop/rails_uniqueness_validator_explicit_case_sensitivity'
21
21
  require_relative 'rubocop/cop/sevencop/rails_where_not'
22
22
  require_relative 'rubocop/cop/sevencop/require_ordered'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sevencop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.28.0
4
+ version: 0.29.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryo Nakamura
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-11-05 00:00:00.000000000 Z
11
+ date: 2022-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -64,11 +64,11 @@ files:
64
64
  - lib/rubocop/cop/sevencop/method_definition_in_included.rb
65
65
  - lib/rubocop/cop/sevencop/method_definition_keyword_argument_ordered.rb
66
66
  - lib/rubocop/cop/sevencop/method_definition_ordered.rb
67
- - lib/rubocop/cop/sevencop/rails_action_name.rb
68
67
  - lib/rubocop/cop/sevencop/rails_belongs_to_optional.rb
69
68
  - lib/rubocop/cop/sevencop/rails_date_and_time_calculation.rb
70
69
  - lib/rubocop/cop/sevencop/rails_inferred_spec_type.rb
71
70
  - lib/rubocop/cop/sevencop/rails_order_field.rb
71
+ - lib/rubocop/cop/sevencop/rails_specific_action_name.rb
72
72
  - lib/rubocop/cop/sevencop/rails_uniqueness_validator_explicit_case_sensitivity.rb
73
73
  - lib/rubocop/cop/sevencop/rails_where_not.rb
74
74
  - lib/rubocop/cop/sevencop/require_ordered.rb