Skip to content

Commit 69dd434

Browse files
committed
Enable new pending cops locally, fix offenses
1 parent b413db6 commit 69dd434

8 files changed

Lines changed: 206 additions & 63 deletions

File tree

.rubocop.yml

Lines changed: 194 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -116,61 +116,203 @@ Style/FormatStringToken:
116116
Exclude:
117117
- spec/rubocop/**/*.rb
118118

119+
Style/NumberedParameters:
120+
Enabled: true
121+
EnforcedStyle: disallow
122+
119123
Style/RequireOrder:
120124
Enabled: true
121125

122-
# Enable some of RuboCop's pending cops.
123126

124-
Layout/LineContinuationSpacing:
125-
Enabled: true
126-
Layout/LineEndStringConcatenationIndentation:
127-
Enabled: true
128-
Lint/AmbiguousOperatorPrecedence:
129-
Enabled: true
130-
Lint/NonAtomicFileOperation:
131-
Enabled: true
132-
Style/EmptyHeredoc:
133-
Enabled: true
134-
Style/RedundantHeredocDelimiterQuotes:
135-
Enabled: true
136-
Style/RedundantStringEscape:
137-
Enabled: true
138-
Style/ReturnNilInPredicateMethodDefinition:
139-
Enabled: true
127+
# Enable RuboCop's pending cops up to v1.89
140128

141-
# Enable pending rubocop-performance cops.
129+
Gemspec/AddRuntimeDependency: {Enabled: true}
130+
Gemspec/AttributeAssignment: {Enabled: true}
131+
Gemspec/DeprecatedAttributeAssignment: {Enabled: true}
132+
Gemspec/DevelopmentDependencies: {Enabled: true}
133+
Gemspec/RequireMFA: {Enabled: true}
134+
Layout/EmptyLinesAfterModuleInclusion: {Enabled: true}
135+
Layout/LineContinuationLeadingSpace: {Enabled: true}
136+
Layout/LineContinuationSpacing: {Enabled: true}
137+
Layout/LineEndStringConcatenationIndentation: {Enabled: true}
138+
Layout/SpaceBeforeBrackets: {Enabled: true}
139+
Lint/AmbiguousAssignment: {Enabled: true}
140+
Lint/AmbiguousOperatorPrecedence: {Enabled: true}
141+
Lint/AmbiguousRange: {Enabled: true}
142+
Lint/ArrayLiteralInRegexp: {Enabled: true}
143+
Lint/ConstantOverwrittenInRescue: {Enabled: true}
144+
Lint/ConstantReassignment: {Enabled: true}
145+
Lint/CopDirectiveSyntax: {Enabled: true}
146+
Lint/DataDefineOverride: {Enabled: true}
147+
Lint/DeprecatedConstants: {Enabled: true}
148+
Lint/DeprecatedReference: {Enabled: true}
149+
Lint/DuplicateBranch: {Enabled: true}
150+
Lint/DuplicateMagicComment: {Enabled: true}
151+
Lint/DuplicateMatchPattern: {Enabled: true}
152+
Lint/DuplicateRegexpCharacterClassElement: {Enabled: true}
153+
Lint/DuplicateSetElement: {Enabled: true}
154+
Lint/EmptyBlock: {Enabled: true}
155+
Lint/EmptyClass: {Enabled: true}
156+
Lint/EmptyInPattern: {Enabled: true}
157+
Lint/HashNewWithKeywordArgumentsAsDefault: {Enabled: true}
158+
Lint/IncompatibleIoSelectWithFiberScheduler: {Enabled: true}
159+
Lint/ItWithoutArgumentsInBlock: {Enabled: true}
160+
Lint/LambdaWithoutLiteralBlock: {Enabled: true}
161+
Lint/LiteralAssignmentInCondition: {Enabled: true}
162+
Lint/MixedCaseRange: {Enabled: true}
163+
Lint/NameTypo: {Enabled: true}
164+
Lint/NonAtomicFileOperation: {Enabled: true}
165+
Lint/NoReturnInBeginEndBlocks: {Enabled: true}
166+
Lint/NumberedParameterAssignment: {Enabled: true}
167+
Lint/NumericOperationWithConstantResult: {Enabled: true}
168+
Lint/OrAssignmentToConstant: {Enabled: true}
169+
Lint/RedundantDirGlobSort: {Enabled: true}
170+
Lint/RedundantRegexpQuantifiers: {Enabled: true}
171+
Lint/RedundantTypeConversion: {Enabled: true}
172+
Lint/RefinementImportMethods: {Enabled: true}
173+
Lint/RequireRangeParentheses: {Enabled: true}
174+
Lint/RequireRelativeSelfPath: {Enabled: true}
175+
Lint/SharedMutableDefault: {Enabled: true}
176+
Lint/SuppressedExceptionInNumberConversion: {Enabled: true}
177+
Lint/SymbolConversion: {Enabled: true}
178+
Lint/ToEnumArguments: {Enabled: true}
179+
Lint/TripleQuotes: {Enabled: true}
180+
Lint/UnescapedBracketInRegexp: {Enabled: true}
181+
Lint/UnexpectedBlockArity: {Enabled: true}
182+
Lint/UnmodifiedReduceAccumulator: {Enabled: true}
183+
Lint/UnreachablePatternBranch: {Enabled: true}
184+
Lint/UselessConstantScoping: {Enabled: true}
185+
Lint/UselessDefaultValueArgument: {Enabled: true}
186+
Lint/UselessDefined: {Enabled: true}
187+
Lint/UselessNumericOperation: {Enabled: true}
188+
Lint/UselessOr: {Enabled: true}
189+
Lint/UselessRescue: {Enabled: true}
190+
Lint/UselessRuby2Keywords: {Enabled: true}
191+
Metrics/CollectionLiteralLength: {Enabled: true}
192+
Naming/BlockForwarding: {Enabled: true}
193+
Naming/PredicateMethod: {Enabled: true}
194+
Security/CompoundHash: {Enabled: true}
195+
Security/IoMethods: {Enabled: true}
196+
Style/AmbiguousEndlessMethodDefinition: {Enabled: true}
197+
Style/ArgumentsForwarding: {Enabled: true}
198+
Style/ArrayIntersect: {Enabled: true}
199+
Style/ArrayIntersectWithSingleElement: {Enabled: true}
200+
Style/BitwisePredicate: {Enabled: true}
201+
Style/CollectionCompact: {Enabled: true}
202+
Style/CollectionQuerying: {Enabled: true}
203+
Style/CombinableDefined: {Enabled: true}
204+
Style/ComparableBetween: {Enabled: true}
205+
Style/ComparableClamp: {Enabled: true}
206+
Style/ConcatArrayLiterals: {Enabled: true}
207+
Style/DataInheritance: {Enabled: true}
208+
Style/DigChain: {Enabled: true}
209+
Style/DirEmpty: {Enabled: true}
210+
Style/DocumentDynamicEvalDefinition: {Enabled: true}
211+
Style/EmptyClassDefinition: {Enabled: true}
212+
Style/EmptyHeredoc: {Enabled: true}
213+
Style/EmptyStringInsideInterpolation: {Enabled: true}
214+
Style/EndlessMethod: {Enabled: true}
215+
Style/EnvHome: {Enabled: true}
216+
Style/ExactRegexpMatch: {Enabled: true}
217+
Style/FetchEnvVar: {Enabled: true}
218+
Style/FileEmpty: {Enabled: true}
219+
Style/FileNull: {Enabled: true}
220+
Style/FileOpen: {Enabled: true}
221+
Style/FileRead: {Enabled: true}
222+
Style/FileTouch: {Enabled: true}
223+
Style/FileWrite: {Enabled: true}
224+
Style/HashConversion: {Enabled: true}
225+
Style/HashExcept: {Enabled: true}
226+
Style/HashFetchChain: {Enabled: true}
227+
Style/HashSlice: {Enabled: true}
228+
Style/IfWithBooleanLiteralBranches: {Enabled: true}
229+
Style/InPatternThen: {Enabled: true}
230+
Style/ItAssignment: {Enabled: true}
231+
Style/ItBlockParameter: {Enabled: true}
232+
Style/KeywordArgumentsMerging: {Enabled: true}
233+
Style/MagicCommentFormat: {Enabled: true}
234+
Style/MapCompactWithConditionalBlock: {Enabled: true}
235+
Style/MapIntoArray: {Enabled: true}
236+
Style/MapJoin: {Enabled: true}
237+
Style/MapToHash: {Enabled: true}
238+
Style/MapToSet: {Enabled: true}
239+
Style/MinMaxComparison: {Enabled: true}
240+
Style/ModuleMemberExistenceCheck: {Enabled: true}
241+
Style/MultilineInPatternThen: {Enabled: true}
242+
Style/NegatedIfElseCondition: {Enabled: true}
243+
Style/NegativeArrayIndex: {Enabled: true}
244+
Style/NestedFileDirname: {Enabled: true}
245+
Style/NilLambda: {Enabled: true}
246+
Style/NumberedParametersLimit: {Enabled: true}
247+
Style/ObjectThen: {Enabled: true}
248+
Style/OneClassPerFile: {Enabled: true}
249+
Style/OpenStructUse: {Enabled: true}
250+
Style/OperatorMethodCall: {Enabled: true}
251+
Style/PartitionInsteadOfDoubleSelect: {Enabled: true}
252+
Style/PredicateWithKind: {Enabled: true}
253+
Style/QuotedSymbols: {Enabled: true}
254+
Style/ReduceToHash: {Enabled: true}
255+
Style/RedundantArgument: {Enabled: true}
256+
Style/RedundantArrayConstructor: {Enabled: true}
257+
Style/RedundantArrayFlatten: {Enabled: true}
258+
Style/RedundantConstantBase: {Enabled: true}
259+
Style/RedundantCurrentDirectoryInPath: {Enabled: true}
260+
Style/RedundantDoubleSplatHashBraces: {Enabled: true}
261+
Style/RedundantEach: {Enabled: true}
262+
Style/RedundantFilterChain: {Enabled: true}
263+
Style/RedundantFormat: {Enabled: true}
264+
Style/RedundantHeredocDelimiterQuotes: {Enabled: true}
265+
Style/RedundantInitialize: {Enabled: true}
266+
Style/RedundantInterpolationUnfreeze: {Enabled: true}
267+
Style/RedundantLineContinuation: {Enabled: true}
268+
Style/RedundantMinMaxBy: {Enabled: true}
269+
Style/RedundantRegexpArgument: {Enabled: true}
270+
Style/RedundantRegexpConstructor: {Enabled: true}
271+
Style/RedundantSelfAssignmentBranch: {Enabled: true}
272+
Style/RedundantStringEscape: {Enabled: true}
273+
Style/ReturnNilInPredicateMethodDefinition: {Enabled: true}
274+
Style/ReverseFind: {Enabled: true}
275+
Style/SafeNavigationChainLength: {Enabled: true}
276+
Style/SelectByKind: {Enabled: true}
277+
Style/SelectByRange: {Enabled: true}
278+
Style/SelectByRegexp: {Enabled: true}
279+
Style/SendWithLiteralMethodName: {Enabled: true}
280+
Style/SingleLineDoEndBlock: {Enabled: true}
281+
Style/StringChars: {Enabled: true}
282+
Style/SuperArguments: {Enabled: true}
283+
Style/SuperWithArgsParentheses: {Enabled: true}
284+
Style/SwapValues: {Enabled: true}
285+
Style/TallyMethod: {Enabled: true}
286+
Style/YAMLFileRead: {Enabled: true}
142287

143-
Performance/AncestorsInclude:
144-
Enabled: true
145-
Performance/BlockGivenWithExplicitBlock:
146-
Enabled: true
147-
Performance/CollectionLiteralInLoop:
148-
Enabled: true
149-
Performance/ConstantRegexp:
150-
Enabled: true
151-
Performance/MapCompact:
152-
Enabled: true
153-
Performance/MapMethodChain:
154-
Enabled: true
155-
Performance/MethodObjectAsBlock:
156-
Enabled: true
157-
Performance/RedundantEqualityComparisonBlock:
158-
Enabled: true
159-
Performance/RedundantSortBlock:
160-
Enabled: true
161-
Performance/RedundantSplitRegexpArgument:
162-
Enabled: true
163-
Performance/RedundantStringChars:
164-
Enabled: true
165-
Performance/ReverseFirst:
166-
Enabled: true
167-
Performance/SortReverse:
168-
Enabled: true
169-
Performance/Squeeze:
170-
Enabled: true
171-
Performance/StringIdentifierArgument:
172-
Enabled: true
173-
Performance/StringInclude:
174-
Enabled: true
175-
Performance/Sum:
176-
Enabled: true
288+
# Enable RuboCop Performance's pending cops up to v1.26
289+
290+
Performance/AncestorsInclude: {Enabled: true}
291+
Performance/BigDecimalWithNumericArgument: {Enabled: true}
292+
Performance/BlockGivenWithExplicitBlock: {Enabled: true}
293+
Performance/CollectionLiteralInLoop: {Enabled: true}
294+
Performance/ConcurrentMonotonicTime: {Enabled: true}
295+
Performance/ConstantRegexp: {Enabled: true}
296+
Performance/MapCompact: {Enabled: true}
297+
Performance/MapMethodChain: {Enabled: true}
298+
Performance/MethodObjectAsBlock: {Enabled: true}
299+
Performance/RedundantEqualityComparisonBlock: {Enabled: true}
300+
Performance/RedundantSortBlock: {Enabled: true}
301+
Performance/RedundantSplitRegexpArgument: {Enabled: true}
302+
Performance/RedundantStringChars: {Enabled: true}
303+
Performance/ReverseFirst: {Enabled: true}
304+
Performance/SortReverse: {Enabled: true}
305+
Performance/Squeeze: {Enabled: true}
306+
Performance/StringBytesize: {Enabled: true}
307+
Performance/StringIdentifierArgument: {Enabled: true}
308+
Performance/StringInclude: {Enabled: true}
309+
Performance/Sum: {Enabled: true}
310+
Performance/ZipWithoutBlock: {Enabled: true}
311+
312+
# Enable RuboCop RSpec's pending cops up to v3.10
313+
314+
RSpec/DiscardedMatcher: {Enabled: true}
315+
RSpec/IncludeExamples: {Enabled: true}
316+
RSpec/LeakyLocalVariable: {Enabled: true}
317+
RSpec/MatchWithSimpleRegex: {Enabled: true}
318+
RSpec/Output: {Enabled: true}

.rubocop_todo.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config --no-offense-counts --no-auto-gen-timestamp`
3-
# using RuboCop version 1.81.7.
3+
# using RuboCop version 1.89.0.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new

lib/rubocop/cop/capybara/redundant_within_find.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ module Capybara
2929
class RedundantWithinFind < ::RuboCop::Cop::Base
3030
include CssSelector
3131
extend AutoCorrector
32+
3233
MSG = 'Redundant `within %<method>s(...)` call detected.'
3334
RESTRICT_ON_SEND = %i[within].freeze
3435
FIND_METHODS = Set.new(%i[find find_by_id]).freeze

lib/rubocop/cop/capybara/rspec/predicate_matcher.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module InflectedHelper
99
extend NodePattern::Macros
1010

1111
EXPLICIT_MATCHER = %w[css selector style xpath].map do |suffix|
12-
"matches_#{suffix}?".to_sym
12+
:"matches_#{suffix}?"
1313
end.freeze
1414
MSG_INFLECTED = 'Prefer using `%<matcher_name>s` matcher over ' \
1515
'`%<predicate_name>s`.'

lib/rubocop/cop/capybara/rspec/visibility_matcher.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class VisibilityMatcher < ::RuboCop::Cop::Base
4040
unchecked_field
4141
xpath
4242
].flat_map do |element|
43-
["have_#{element}".to_sym, "have_no_#{element}".to_sym]
43+
[:"have_#{element}", :"have_no_#{element}"]
4444
end
4545

4646
RESTRICT_ON_SEND = CAPYBARA_MATCHER_METHODS

spec/project/default_config_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ def cop_configuration(config_key)
9999
end
100100
end
101101

102-
it 'is expected that all cops documented with `@safety` are `Safe: false`' \
103-
' or `SafeAutoCorrect: false`' do
102+
it 'is expected that all cops documented with `@safety` are `Safe: false` ' \
103+
'or `SafeAutoCorrect: false`' do
104104
unsafe_cop_names.each do |cop_name|
105105
unsafe = default_config[cop_name]['Safe'] == false ||
106106
default_config[cop_name]['SafeAutoCorrect'] == false

spec/rubocop/cop/capybara/find_all_first_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@
133133
RUBY
134134
end
135135

136-
it 'does not register an offense when using `all` with argument' \
137-
' without `first`' do
136+
it 'does not register an offense when using `all` with argument ' \
137+
'without `first`' do
138138
expect_no_offenses(<<~RUBY)
139139
all('a', text: 'b')
140140
RUBY

spec/rubocop/cop/capybara/rspec/predicate_matcher_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
context 'when `Strict: true`' do
4848
let(:strict) { true }
4949

50-
include_examples 'inflected common'
50+
it_behaves_like 'inflected common'
5151

5252
it 'does not register an offense when strict checking boolean matcher' do
5353
expect_no_offenses(<<~RUBY)
@@ -60,7 +60,7 @@
6060
context 'when `Strict: false`' do
6161
let(:strict) { false }
6262

63-
include_examples 'inflected common'
63+
it_behaves_like 'inflected common'
6464

6565
it 'registers an offense when predicate method in actual' do
6666
expect_offense(<<~RUBY)
@@ -182,13 +182,13 @@
182182
context 'when `Strict: true`' do
183183
let(:strict) { true }
184184

185-
include_examples 'explicit', 'be(true)', 'be(false)'
185+
it_behaves_like 'explicit', 'be(true)', 'be(false)'
186186
end
187187

188188
context 'when `Strict: false`' do
189189
let(:strict) { false }
190190

191-
include_examples 'explicit', 'be_truthy', 'be_falsey'
191+
it_behaves_like 'explicit', 'be_truthy', 'be_falsey'
192192
end
193193
end
194194
end

0 commit comments

Comments
 (0)