sevencop 0.32.1 → 0.33.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +4 -4
- data/README.md +1 -1
- data/config/default.yml +3 -25
- data/lib/rubocop/cop/sevencop/autoload_ordered.rb +2 -8
- data/lib/rubocop/cop/sevencop/rails_date_and_time_calculation.rb +30 -38
- data/lib/rubocop/cop/sevencop/{rails_order_field.rb → rails_order_field_arel_sql.rb} +1 -1
- data/lib/rubocop/cop/sevencop/rails_order_field_in_order_of.rb +56 -18
- data/lib/rubocop/cop/sevencop/rspec_empty_line_after_let.rb +0 -2
- data/lib/rubocop/cop/sevencop/rspec_examples_in_same_group.rb +12 -12
- data/lib/rubocop/cop/sevencop/rspec_memoized_helper_block_delimiter.rb +0 -2
- data/lib/sevencop/version.rb +1 -1
- data/lib/sevencop.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2aa8a2d8e7e48840c1bfdfd2c512e4117d52c5d525663ba0d25dbfe815ca1f70
|
4
|
+
data.tar.gz: 9d3a6b87ee268c2dddc82b7eaaf85bc431bce6a36dfb401717986a16e4445b79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14a1f39bda2b687ff9784812eb8600ce792f5bca38a7eb542f268ebb7f23b20b482ef424f50e953cd0f268fee652f787de4f556192ba479d90543521c9a955cd
|
7
|
+
data.tar.gz: '08a48ae20f4716f2ea593054e74c684f31e8392a70177eb9076cd4b41fde6bd800000c4655545ade7385b366cd82d7fc985bbc66c0a69d1d1220e22e3a342f5b'
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
sevencop (0.
|
4
|
+
sevencop (0.33.0)
|
5
5
|
activesupport
|
6
6
|
rubocop
|
7
7
|
|
@@ -25,7 +25,7 @@ GEM
|
|
25
25
|
ast (~> 2.4.1)
|
26
26
|
rainbow (3.1.1)
|
27
27
|
rake (13.0.6)
|
28
|
-
regexp_parser (2.6.
|
28
|
+
regexp_parser (2.6.1)
|
29
29
|
rexml (3.2.5)
|
30
30
|
rspec (3.12.0)
|
31
31
|
rspec-core (~> 3.12.0)
|
@@ -40,7 +40,7 @@ GEM
|
|
40
40
|
diff-lcs (>= 1.2.0, < 2.0)
|
41
41
|
rspec-support (~> 3.12.0)
|
42
42
|
rspec-support (3.12.0)
|
43
|
-
rubocop (1.
|
43
|
+
rubocop (1.39.0)
|
44
44
|
json (~> 2.3)
|
45
45
|
parallel (~> 1.10)
|
46
46
|
parser (>= 3.1.2.1)
|
@@ -52,7 +52,7 @@ GEM
|
|
52
52
|
unicode-display_width (>= 1.4.0, < 3.0)
|
53
53
|
rubocop-ast (1.23.0)
|
54
54
|
parser (>= 3.1.1.0)
|
55
|
-
rubocop-performance (1.15.
|
55
|
+
rubocop-performance (1.15.1)
|
56
56
|
rubocop (>= 1.7.0, < 2.0)
|
57
57
|
rubocop-ast (>= 0.4.0)
|
58
58
|
rubocop-rake (0.6.0)
|
data/README.md
CHANGED
@@ -39,7 +39,7 @@ Note that all cops are `Enabled: false` by default.
|
|
39
39
|
- [Sevencop/MethodDefinitionOrdered](lib/rubocop/cop/sevencop/method_definition_ordered.rb)
|
40
40
|
- [Sevencop/RailsBelongsToOptional](lib/rubocop/cop/sevencop/rails_belongs_to_optional.rb)
|
41
41
|
- [Sevencop/RailsDateAndTimeCalculation](lib/rubocop/cop/sevencop/rails_date_and_time_calculation.rb)
|
42
|
-
- [Sevencop/
|
42
|
+
- [Sevencop/RailsOrderFieldArelSql](lib/rubocop/cop/sevencop/rails_order_field_arel_sql.rb)
|
43
43
|
- [Sevencop/RailsOrderFieldInOrderOf](lib/rubocop/cop/sevencop/rails_order_field_in_order_of.rb)
|
44
44
|
- [Sevencop/RailsSpecificActionName](lib/rubocop/cop/sevencop/rails_specific_action_name.rb)
|
45
45
|
- [Sevencop/RailsUniquenessValidatorExplicitCaseSensitivity](lib/rubocop/cop/sevencop/rails_uniqueness_validator_explicit_case_sensitivity.rb)
|
data/config/default.yml
CHANGED
@@ -3,26 +3,22 @@ Sevencop/AutoloadOrdered:
|
|
3
3
|
Sort `autoload` in alphabetical order.
|
4
4
|
Enabled: false
|
5
5
|
Safe: false
|
6
|
-
VersionAdded: '0.12'
|
7
6
|
|
8
7
|
Sevencop/ConstantBase:
|
9
8
|
Description: |
|
10
9
|
Avoid unnecessary `::` prefix on constant.
|
11
10
|
Enabled: false
|
12
|
-
VersionAdded: '0.31'
|
13
11
|
|
14
12
|
Sevencop/FactoryBotAssociationOption:
|
15
13
|
Description: |
|
16
14
|
Avoid redundant options on FactoryBot associations.
|
17
15
|
Enabled: false
|
18
|
-
VersionAdded: '0.21'
|
19
16
|
|
20
17
|
Sevencop/FactoryBotAssociationStyle:
|
21
18
|
Description: |
|
22
19
|
Use consistent style in FactoryBot associations.
|
23
20
|
Enabled: false
|
24
21
|
Safe: false
|
25
|
-
VersionAdded: '0.21'
|
26
22
|
EnforcedStyle: implicit
|
27
23
|
SupportedStyles:
|
28
24
|
- explicit
|
@@ -45,68 +41,58 @@ Sevencop/HashElementOrdered:
|
|
45
41
|
Sort Hash elements by key.
|
46
42
|
Enabled: false
|
47
43
|
Safe: false
|
48
|
-
VersionAdded: '0.6'
|
49
44
|
|
50
45
|
Sevencop/MethodDefinitionArgumentsMultiline:
|
51
46
|
Description: |
|
52
47
|
Inserts new lines between method definition arguments.
|
53
48
|
Enabled: false
|
54
|
-
VersionAdded: '0.11'
|
55
49
|
|
56
50
|
Sevencop/MethodDefinitionInIncluded:
|
57
51
|
Description: |
|
58
52
|
Do not define methods in `included` blocks.
|
59
53
|
Enabled: false
|
60
54
|
Safe: false
|
61
|
-
VersionAdded: '0.19'
|
62
55
|
|
63
56
|
Sevencop/MethodDefinitionOrdered:
|
64
57
|
Description: |
|
65
58
|
Sort method definitions in alphabetical order.
|
66
59
|
Enabled: false
|
67
60
|
Safe: false
|
68
|
-
VersionAdded: '0.14'
|
69
61
|
|
70
62
|
Sevencop/MethodDefinitionKeywordArgumentOrdered:
|
71
63
|
Description: |
|
72
64
|
Sort method definition keyword arguments in alphabetical order.
|
73
65
|
Enabled: false
|
74
66
|
Safe: false
|
75
|
-
VersionAdded: '0.13'
|
76
67
|
|
77
68
|
Sevencop/RailsBelongsToOptional:
|
78
69
|
Description: |
|
79
70
|
Force `belongs_to` with `optional: true` option.
|
80
71
|
Enabled: false
|
81
72
|
Safe: false
|
82
|
-
VersionAdded: '0.5'
|
83
73
|
|
84
74
|
Sevencop/RailsDateAndTimeCalculation:
|
85
75
|
Description: |
|
86
76
|
Prefer ActiveSupport date and time helper.
|
87
77
|
Enabled: false
|
88
78
|
Safe: false
|
89
|
-
VersionAdded: '0.26'
|
90
79
|
|
91
|
-
Sevencop/
|
80
|
+
Sevencop/RailsOrderFieldArelSql:
|
92
81
|
Description: |
|
93
82
|
Wrap safe SQL String by `Arel.sql`.
|
94
83
|
Enabled: false
|
95
84
|
Safe: false
|
96
|
-
VersionAdded: '0.4'
|
97
85
|
|
98
86
|
Sevencop/RailsOrderFieldInOrderOf:
|
99
87
|
Description: |
|
100
|
-
Prefer `in_order_of` to MySQL `FIELD` function.
|
88
|
+
Prefer `in_order_of` to MySQL `FIELD` function if possible.
|
101
89
|
Enabled: false
|
102
|
-
|
90
|
+
Safe: false
|
103
91
|
|
104
92
|
Sevencop/RailsSpecificActionName:
|
105
93
|
Description: |
|
106
94
|
Use only specific action names.
|
107
95
|
Enabled: false
|
108
|
-
VersionAdded: '0.24'
|
109
|
-
VersionChanged: '0.29'
|
110
96
|
ActionNames:
|
111
97
|
- create
|
112
98
|
- destroy
|
@@ -123,27 +109,23 @@ Sevencop/RailsUniquenessValidatorExplicitCaseSensitivity:
|
|
123
109
|
Specify :case_sensitivity option on use of UniquenessValidator.
|
124
110
|
Enabled: false
|
125
111
|
Safe: false
|
126
|
-
VersionAdded: '0.3'
|
127
112
|
|
128
113
|
Sevencop/RailsWhereNot:
|
129
114
|
Description: |
|
130
115
|
Identifies passing multi-elements Hash literal to `where.not`.
|
131
116
|
Enabled: false
|
132
117
|
Safe: false
|
133
|
-
VersionAdded: '0.7'
|
134
118
|
|
135
119
|
Sevencop/RequireOrdered:
|
136
120
|
Description: |
|
137
121
|
Sort `require` and `require_relative` in alphabetical order.
|
138
122
|
Enabled: false
|
139
123
|
Safe: false
|
140
|
-
VersionAdded: '0.16'
|
141
124
|
|
142
125
|
Sevencop/RSpecDescribeHttpEndpoint:
|
143
126
|
Description: |
|
144
127
|
Pass HTTP endpoint identifier (e.g. `GET /users`) to top-level `describe` on request-specs.
|
145
128
|
Enabled: false
|
146
|
-
VersionAdded: '0.18'
|
147
129
|
Include:
|
148
130
|
- spec/requests/**/*.rb
|
149
131
|
|
@@ -151,7 +133,6 @@ Sevencop/RSpecEmptyLineAfterLet:
|
|
151
133
|
Description: |
|
152
134
|
Insert empty line after `let`.
|
153
135
|
Enabled: false
|
154
|
-
VersionAdded: '0.27'
|
155
136
|
Include:
|
156
137
|
- spec/**/*
|
157
138
|
|
@@ -159,7 +140,6 @@ Sevencop/RSpecExamplesInSameGroup:
|
|
159
140
|
Description: |
|
160
141
|
Combine examples in the same groups in the time-consuming kinds of specs.
|
161
142
|
Enabled: false
|
162
|
-
VersionAdded: '0.17'
|
163
143
|
IncludeSharedExamples: false
|
164
144
|
Include:
|
165
145
|
- spec/controllers/**/*
|
@@ -169,7 +149,6 @@ Sevencop/RSpecMemoizedHelperBlockDelimiter:
|
|
169
149
|
Description: |
|
170
150
|
Use do-end block delimiter on RSpec memoized helper.
|
171
151
|
Enabled: false
|
172
|
-
VersionAdded: '0.27'
|
173
152
|
Include:
|
174
153
|
- spec/**/*
|
175
154
|
|
@@ -178,7 +157,6 @@ Sevencop/RSpecRailsResponseParsedBody:
|
|
178
157
|
Prefer `response.parsed_body` to `JSON.parse(response.body)`.
|
179
158
|
Enabled: false
|
180
159
|
Safe: false
|
181
|
-
VersionAdded: '0.28'
|
182
160
|
Include:
|
183
161
|
- spec/controllers/**/*
|
184
162
|
- spec/requests/**/*
|
@@ -41,14 +41,8 @@ module RuboCop
|
|
41
41
|
|
42
42
|
add_offense(node) do |corrector|
|
43
43
|
swap(
|
44
|
-
|
45
|
-
|
46
|
-
include_final_newline: true
|
47
|
-
),
|
48
|
-
range_by_whole_lines(
|
49
|
-
node.location.expression,
|
50
|
-
include_final_newline: true
|
51
|
-
),
|
44
|
+
range_with_comments_and_lines(previous_older_sibling),
|
45
|
+
range_with_comments_and_lines(node),
|
52
46
|
corrector: corrector
|
53
47
|
)
|
54
48
|
end
|
@@ -1,7 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'set'
|
4
|
-
|
5
3
|
module RuboCop
|
6
4
|
module Cop
|
7
5
|
module Sevencop
|
@@ -110,42 +108,36 @@ module RuboCop
|
|
110
108
|
class RailsDateAndTimeCalculation < Base
|
111
109
|
extend AutoCorrector
|
112
110
|
|
113
|
-
CALCULATION_METHOD_NAMES =
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
week
|
144
|
-
weeks
|
145
|
-
year
|
146
|
-
years
|
147
|
-
]
|
148
|
-
).freeze
|
111
|
+
CALCULATION_METHOD_NAMES = %i[
|
112
|
+
-
|
113
|
+
+
|
114
|
+
].to_set.freeze
|
115
|
+
|
116
|
+
COMPARISON_METHOD_NAMES = %i[
|
117
|
+
<
|
118
|
+
>
|
119
|
+
after?
|
120
|
+
before?
|
121
|
+
].to_set.freeze
|
122
|
+
|
123
|
+
DURATION_METHOD_NAMES = %i[
|
124
|
+
day
|
125
|
+
days
|
126
|
+
fortnight
|
127
|
+
fortnights
|
128
|
+
hour
|
129
|
+
hours
|
130
|
+
minute
|
131
|
+
minutes
|
132
|
+
month
|
133
|
+
months
|
134
|
+
second
|
135
|
+
seconds
|
136
|
+
week
|
137
|
+
weeks
|
138
|
+
year
|
139
|
+
years
|
140
|
+
].to_set.freeze
|
149
141
|
|
150
142
|
MSG = 'Prefer ActiveSupport date and time helper.'
|
151
143
|
|
@@ -3,7 +3,26 @@
|
|
3
3
|
module RuboCop
|
4
4
|
module Cop
|
5
5
|
module Sevencop
|
6
|
-
# Prefer `in_order_of` to MySQL `FIELD` function.
|
6
|
+
# Prefer `in_order_of` to MySQL `FIELD` function if possible.
|
7
|
+
#
|
8
|
+
# @safety
|
9
|
+
# This cop is unsafe because `in_order_of` also adds `WHERE` clause.
|
10
|
+
#
|
11
|
+
# This cop's autocorrection is unsafe because in the original code the array value is interpolated as
|
12
|
+
# literals on SQL query, but after its autocorrection, the value will be now passed directly to in_order_of,
|
13
|
+
# which may produce different results.
|
14
|
+
#
|
15
|
+
# For example, the following code is valid where the id column is a integer column:
|
16
|
+
#
|
17
|
+
# ids = %w[1 2 3]
|
18
|
+
# order("FIELD(id, #{ids.join(', ')})") # "FIELD(id, 1, 2, 3)"
|
19
|
+
#
|
20
|
+
# But after its autocorrection, it will be like this:
|
21
|
+
#
|
22
|
+
# ids = %w[1 2 3]
|
23
|
+
# in_order_of(:id, ids) # We need to change this code as `ids.map(&:to_i)`.
|
24
|
+
#
|
25
|
+
# And this code will raise an error because `ids` is not an array of Integer but an array of String.
|
7
26
|
#
|
8
27
|
# @example
|
9
28
|
# # bad
|
@@ -37,7 +56,7 @@ module RuboCop
|
|
37
56
|
\s*
|
38
57
|
field\(
|
39
58
|
\s*
|
40
|
-
(?<column_name
|
59
|
+
(?<column_name>[^,]+)
|
41
60
|
,\s*
|
42
61
|
\z
|
43
62
|
/ix.freeze
|
@@ -59,7 +78,7 @@ module RuboCop
|
|
59
78
|
\s*
|
60
79
|
field\(
|
61
80
|
\s*
|
62
|
-
(?<column_name
|
81
|
+
(?<column_name>[^,]+)
|
63
82
|
,\s*
|
64
83
|
(?<values>.+)
|
65
84
|
\s*
|
@@ -72,7 +91,7 @@ module RuboCop
|
|
72
91
|
\z
|
73
92
|
/ix.freeze
|
74
93
|
|
75
|
-
MSG = 'Prefer `in_order_of` to MySQL `FIELD` function.'
|
94
|
+
MSG = 'Prefer `in_order_of` to MySQL `FIELD` function if possible.'
|
76
95
|
|
77
96
|
RESTRICT_ON_SEND = %i[
|
78
97
|
order
|
@@ -84,7 +103,9 @@ module RuboCop
|
|
84
103
|
def on_send(node)
|
85
104
|
return unless bad?(node)
|
86
105
|
|
87
|
-
add_offense(
|
106
|
+
add_offense(
|
107
|
+
convert_to_autocorrected_range(node)
|
108
|
+
) do |corrector|
|
88
109
|
autocorrect(corrector, node)
|
89
110
|
end
|
90
111
|
end
|
@@ -148,17 +169,23 @@ module RuboCop
|
|
148
169
|
node
|
149
170
|
)
|
150
171
|
corrector.replace(
|
151
|
-
node
|
152
|
-
begin_pos: node.location.selector.begin_pos
|
153
|
-
),
|
172
|
+
convert_to_autocorrected_range(node),
|
154
173
|
format_in_order_of(node)
|
155
174
|
)
|
156
175
|
end
|
157
176
|
|
177
|
+
# @param node [RuboCop::AST::SendNode]
|
178
|
+
# @return [Parser::Source::Range]
|
179
|
+
def convert_to_autocorrected_range(node)
|
180
|
+
node.location.expression.with(
|
181
|
+
begin_pos: node.location.selector.begin_pos
|
182
|
+
)
|
183
|
+
end
|
184
|
+
|
158
185
|
# @param node [RuboCop::AST::SendNode]
|
159
186
|
# @return [String, nil]
|
160
187
|
def extract_column_name(node)
|
161
|
-
if node
|
188
|
+
if search_from_arguments(node, type: :dstr).any?
|
162
189
|
extract_column_name_from_dstr(node)
|
163
190
|
else
|
164
191
|
extract_column_name_from_str(node)
|
@@ -168,25 +195,25 @@ module RuboCop
|
|
168
195
|
# @param node [RuboCop::AST::SendNode]
|
169
196
|
# @return [String]
|
170
197
|
def extract_column_name_from_dstr(node)
|
171
|
-
node
|
198
|
+
search_from_arguments(node, type: :str).first.value[REGEXP_FIELD_DSTR_HEAD, :column_name].delete('`')
|
172
199
|
end
|
173
200
|
|
174
201
|
# @param node [RuboCop::AST::SendNode]
|
175
202
|
# @return [String]
|
176
203
|
def extract_column_name_from_str(node)
|
177
|
-
node
|
204
|
+
search_from_arguments(node, type: :str).first.value[REGEXP_FIELD_STR, :column_name].delete('`')
|
178
205
|
end
|
179
206
|
|
180
207
|
# @param node [RuboCop::AST::SendNode]
|
181
208
|
# @return [String, nil]
|
182
209
|
def extract_order_from_dstr(node)
|
183
|
-
node
|
210
|
+
search_from_arguments(node, type: :str).to_a.last.value[REGEXP_FIELD_DSTR_TAIL, :order]
|
184
211
|
end
|
185
212
|
|
186
213
|
# @param node [RuboCop::AST::SendNode]
|
187
214
|
# @return [String, nil]
|
188
215
|
def extract_order_from_str(node)
|
189
|
-
node
|
216
|
+
search_from_arguments(node, type: :str).first.value[REGEXP_FIELD_STR, :order]
|
190
217
|
end
|
191
218
|
|
192
219
|
# @param node [RuboCop::AST::SendNode]
|
@@ -216,7 +243,7 @@ module RuboCop
|
|
216
243
|
# @param node [RuboCop::AST::SendNode]
|
217
244
|
# @return [String]
|
218
245
|
def extract_values_from_dstr(node)
|
219
|
-
node.
|
246
|
+
search_from_arguments(node).find do |descendant|
|
220
247
|
match_field_dstr_body?(descendant)
|
221
248
|
end.children.first.receiver.source
|
222
249
|
end
|
@@ -226,14 +253,14 @@ module RuboCop
|
|
226
253
|
def extract_values_from_str(node)
|
227
254
|
format(
|
228
255
|
'[%<values>s]',
|
229
|
-
values: node
|
256
|
+
values: search_from_arguments(node, type: :str).first.value[REGEXP_FIELD_STR, :values].split(',').map(&:strip).join(', ')
|
230
257
|
)
|
231
258
|
end
|
232
259
|
|
233
260
|
# @param node [RuboCop::AST::SendNode]
|
234
261
|
# @return [String]
|
235
262
|
def format_in_order_of(node)
|
236
|
-
if node
|
263
|
+
if search_from_arguments(node, type: :dstr).any?
|
237
264
|
format_in_order_of_on_dstr(node)
|
238
265
|
else
|
239
266
|
format_in_order_of_on_str(node)
|
@@ -244,7 +271,7 @@ module RuboCop
|
|
244
271
|
# @return [String]
|
245
272
|
def format_in_order_of_on_dstr(node)
|
246
273
|
format(
|
247
|
-
|
274
|
+
"in_order_of(:'%<column_name>s', %<values>s)%<reverse_order>s%<rest_order>s",
|
248
275
|
column_name: extract_column_name_from_dstr(node),
|
249
276
|
rest_order: extract_rest_order(node),
|
250
277
|
reverse_order: extract_reverse_order_from_dstr(node),
|
@@ -256,7 +283,7 @@ module RuboCop
|
|
256
283
|
# @return [String]
|
257
284
|
def format_in_order_of_on_str(node)
|
258
285
|
format(
|
259
|
-
|
286
|
+
"in_order_of(:'%<column_name>s', %<values>s)%<reverse_order>s%<rest_order>s",
|
260
287
|
column_name: extract_column_name_from_str(node),
|
261
288
|
rest_order: extract_rest_order(node),
|
262
289
|
reverse_order: extract_reverse_order_from_str(node),
|
@@ -310,6 +337,17 @@ module RuboCop
|
|
310
337
|
node.str_type? &&
|
311
338
|
node.value.match?(REGEXP_FIELD_STR)
|
312
339
|
end
|
340
|
+
|
341
|
+
# @param node [RuboCop::AST::SendNode]
|
342
|
+
# @param type [Symbol]
|
343
|
+
def search_from_arguments(
|
344
|
+
node,
|
345
|
+
type: nil
|
346
|
+
)
|
347
|
+
node.arguments.flat_map do |argument|
|
348
|
+
argument.each_node(*Array(type)).to_a
|
349
|
+
end
|
350
|
+
end
|
313
351
|
end
|
314
352
|
end
|
315
353
|
end
|
@@ -36,19 +36,19 @@ module RuboCop
|
|
36
36
|
# includes_examples 'creates Foo'
|
37
37
|
# end
|
38
38
|
class RSpecExamplesInSameGroup < Base
|
39
|
-
METHOD_NAMES_FOR_REGULAR_EXAMPLE =
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
].freeze
|
39
|
+
METHOD_NAMES_FOR_REGULAR_EXAMPLE = %i[
|
40
|
+
example
|
41
|
+
it
|
42
|
+
its
|
43
|
+
scenario
|
44
|
+
specify
|
45
|
+
].to_set.freeze
|
46
46
|
|
47
|
-
METHOD_NAMES_FOR_SHARED_EXAMPLES =
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
]
|
47
|
+
METHOD_NAMES_FOR_SHARED_EXAMPLES = %i[
|
48
|
+
include_examples
|
49
|
+
it_behaves_like
|
50
|
+
it_should_behave_like
|
51
|
+
].to_set.freeze
|
52
52
|
|
53
53
|
MSG = 'Combine examples in the same group in the time-consuming kinds of specs.'
|
54
54
|
|
data/lib/sevencop/version.rb
CHANGED
data/lib/sevencop.rb
CHANGED
@@ -15,7 +15,7 @@ require_relative 'rubocop/cop/sevencop/method_definition_keyword_argument_ordere
|
|
15
15
|
require_relative 'rubocop/cop/sevencop/method_definition_ordered'
|
16
16
|
require_relative 'rubocop/cop/sevencop/rails_belongs_to_optional'
|
17
17
|
require_relative 'rubocop/cop/sevencop/rails_date_and_time_calculation'
|
18
|
-
require_relative 'rubocop/cop/sevencop/
|
18
|
+
require_relative 'rubocop/cop/sevencop/rails_order_field_arel_sql'
|
19
19
|
require_relative 'rubocop/cop/sevencop/rails_order_field_in_order_of'
|
20
20
|
require_relative 'rubocop/cop/sevencop/rails_specific_action_name'
|
21
21
|
require_relative 'rubocop/cop/sevencop/rails_uniqueness_validator_explicit_case_sensitivity'
|
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.
|
4
|
+
version: 0.33.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
|
+
date: 2022-12-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -67,7 +67,7 @@ files:
|
|
67
67
|
- lib/rubocop/cop/sevencop/method_definition_ordered.rb
|
68
68
|
- lib/rubocop/cop/sevencop/rails_belongs_to_optional.rb
|
69
69
|
- lib/rubocop/cop/sevencop/rails_date_and_time_calculation.rb
|
70
|
-
- lib/rubocop/cop/sevencop/
|
70
|
+
- lib/rubocop/cop/sevencop/rails_order_field_arel_sql.rb
|
71
71
|
- lib/rubocop/cop/sevencop/rails_order_field_in_order_of.rb
|
72
72
|
- lib/rubocop/cop/sevencop/rails_specific_action_name.rb
|
73
73
|
- lib/rubocop/cop/sevencop/rails_uniqueness_validator_explicit_case_sensitivity.rb
|
@@ -107,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
107
|
- !ruby/object:Gem::Version
|
108
108
|
version: '0'
|
109
109
|
requirements: []
|
110
|
-
rubygems_version: 3.3.
|
110
|
+
rubygems_version: 3.3.26
|
111
111
|
signing_key:
|
112
112
|
specification_version: 4
|
113
113
|
summary: Opinionated custom cops for RuboCop.
|