Skip to content

Commit 5508ab3

Browse files
authored
Merge pull request #9216 from mhashizume/PUP-11773/main/rubocop-extensions
Enable Additional Rubocop Extensions
2 parents 67326dc + 57babd5 commit 5508ab3

File tree

3 files changed

+151
-15
lines changed

3 files changed

+151
-15
lines changed

.rubocop.yml

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
inherit_from: .rubocop_todo.yml
22

33
require:
4-
rubocop-i18n
4+
- rubocop-i18n
5+
- rubocop-performance
6+
- rubocop-rake
7+
- rubocop-rspec
58

69
AllCops:
710
TargetRubyVersion: 2.5
@@ -154,3 +157,45 @@ Naming/VariableName:
154157

155158
Naming/VariableNumber:
156159
Enabled: false
160+
161+
Performance/AncestorsInclude: # new in 1.7
162+
Enabled: true
163+
164+
Performance/BigDecimalWithNumericArgument: # new in 1.7
165+
Enabled: true
166+
167+
Performance/ConcurrentMonotonicTime: # new in 1.12
168+
Enabled: true
169+
170+
Performance/MapCompact: # new in 1.11
171+
Enabled: true
172+
173+
Performance/RedundantSortBlock: # new in 1.7
174+
Enabled: true
175+
176+
Performance/ReverseFirst: # new in 1.7
177+
Enabled: true
178+
179+
RSpec/BeEq: # new in 2.9.0
180+
Enabled: true
181+
182+
RSpec/BeNil: # new in 2.9.0
183+
Enabled: true
184+
185+
RSpec/ExcessiveDocstringSpacing: # new in 2.5
186+
Enabled: true
187+
188+
RSpec/IdenticalEqualityAssertion: # new in 2.4
189+
Enabled: true
190+
191+
RSpec/SubjectDeclaration: # new in 2.5
192+
Enabled: true
193+
194+
RSpec/VerifiedDoubleReference: # new in 2.10.0
195+
Enabled: true
196+
197+
RSpec/FactoryBot/SyntaxMethods: # new in 2.7
198+
Enabled: true
199+
200+
RSpec/Rails/AvoidSetupHook: # new in 2.4
201+
Enabled: true

.rubocop_todo.yml

Lines changed: 102 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,22 @@ I18n/RailsI18n/DecorateString:
2525
# Configuration parameters: AllowedMethods.
2626
# AllowedMethods: enums
2727
Lint/ConstantDefinitionInBlock:
28-
Enabled: false
28+
Exclude:
29+
- 'lib/puppet/face/config.rb'
30+
- 'lib/puppet/face/help.rb'
31+
- 'lib/puppet/face/node/clean.rb'
32+
- 'lib/puppet/provider/package/aix.rb'
33+
- 'lib/puppet/provider/package/apt.rb'
34+
- 'lib/puppet/provider/package/gem.rb'
35+
- 'lib/puppet/provider/package/pip.rb'
36+
- 'lib/puppet/provider/package/yum.rb'
37+
- 'lib/puppet/provider/service/upstart.rb'
38+
- 'lib/puppet/provider/user/directoryservice.rb'
39+
- 'lib/puppet/type/file.rb'
40+
- 'lib/puppet/type/file/source.rb'
41+
- 'lib/puppet/type/resources.rb'
42+
- 'lib/puppet/type/schedule.rb'
43+
- 'lib/puppet/type/tidy.rb'
2944

3045
Lint/MissingSuper:
3146
Enabled: false
@@ -85,6 +100,90 @@ Lint/ToJSON:
85100
Lint/UnusedMethodArgument:
86101
Enabled: false
87102

103+
Performance/BlockGivenWithExplicitBlock: # new in 1.9
104+
Enabled: false
105+
106+
Performance/CollectionLiteralInLoop: # new in 1.8
107+
Enabled: false
108+
109+
Performance/ConstantRegexp: # new in 1.9
110+
Enabled: false
111+
112+
# This cop supports safe auto-correction (--auto-correct).
113+
Performance/Count:
114+
Exclude:
115+
- 'lib/puppet/confine/any.rb'
116+
- 'lib/puppet/confine/false.rb'
117+
- 'lib/puppet/confine/true.rb'
118+
- 'lib/puppet/graph/relationship_graph.rb'
119+
- 'lib/puppet/provider.rb'
120+
121+
# This cop supports unsafe auto-correction (--auto-correct-all).
122+
Performance/InefficientHashSearch:
123+
Exclude:
124+
- 'lib/puppet/face/node/clean.rb'
125+
- 'lib/puppet/provider/nameservice/directoryservice.rb'
126+
- 'lib/puppet/provider/user/directoryservice.rb'
127+
- 'lib/puppet/resource.rb'
128+
- 'lib/puppet/util/windows/adsi.rb'
129+
130+
Performance/MethodObjectAsBlock: # new in 1.9
131+
Enabled: false
132+
133+
# This cop supports safe auto-correction (--auto-correct).
134+
Performance/RedundantBlockCall:
135+
Exclude:
136+
- 'lib/puppet/application.rb'
137+
- 'lib/puppet/context.rb'
138+
- 'lib/puppet/file_bucket/file.rb'
139+
- 'lib/puppet/functions/max.rb'
140+
- 'lib/puppet/functions/min.rb'
141+
- 'lib/puppet/gettext/stubs.rb'
142+
- 'lib/puppet/network/http/api/server/v3.rb'
143+
- 'lib/puppet/pal/pal_impl.rb'
144+
- 'lib/puppet/pops/adaptable.rb'
145+
- 'lib/puppet/pops/lookup/invocation.rb'
146+
- 'lib/puppet/pops/model/factory.rb'
147+
- 'lib/puppet/util.rb'
148+
149+
Performance/RedundantEqualityComparisonBlock: # new in 1.10
150+
Enabled: false
151+
152+
# This cop supports unsafe auto-correction (--auto-correct-all).
153+
# Configuration parameters: MaxKeyValuePairs.
154+
Performance/RedundantMerge:
155+
Exclude:
156+
- 'lib/puppet/x509/cert_provider.rb'
157+
158+
Performance/RedundantSplitRegexpArgument: # new in 1.10
159+
Enabled: false
160+
161+
Performance/RedundantStringChars: # new in 1.7
162+
Enabled: false
163+
164+
# This cop supports safe auto-correction (--auto-correct).
165+
Performance/RegexpMatch:
166+
Enabled: false
167+
168+
Performance/SortReverse: # new in 1.7
169+
Enabled: false
170+
171+
Performance/Squeeze: # new in 1.7
172+
Enabled: false
173+
174+
Performance/StringIdentifierArgument: # new in 1.13
175+
Enabled: false
176+
177+
Performance/StringInclude: # new in 1.7
178+
Enabled: false
179+
180+
Performance/Sum: # new in 1.8
181+
Enabled: false
182+
183+
# This cop supports safe auto-correction (--auto-correct).
184+
Performance/UnfreezeString:
185+
Enabled: false
186+
88187
# Configuration parameters: EnforcedStyle, AllowModifiersOnSymbols.
89188
# SupportedStyles: inline, group
90189
Style/AccessModifierDeclarations:
@@ -280,7 +379,6 @@ Style/EmptyBlockParameter:
280379
# This cop supports safe auto-correction (--auto-correct).
281380
Style/EmptyCaseCondition:
282381
Exclude:
283-
- 'lib/puppet/pops/lookup/hiera_config.rb'
284382
- 'lib/puppet/pops/serialization/serializer.rb'
285383
- 'lib/puppet/pops/types/type_calculator.rb'
286384
- 'lib/puppet/settings.rb'
@@ -298,7 +396,6 @@ Style/EmptyElse:
298396
# This cop supports safe auto-correction (--auto-correct).
299397
Style/EmptyLiteral:
300398
Exclude:
301-
- 'lib/puppet/indirector/face.rb'
302399
- 'lib/puppet/parser/scope.rb'
303400
- 'lib/puppet/pops/puppet_stack.rb'
304401
- 'lib/puppet/pops/visitor.rb'
@@ -327,11 +424,6 @@ Style/Encoding:
327424
- 'lib/puppet/type/package.rb'
328425
- 'lib/puppet/util/windows/service.rb'
329426

330-
# This cop supports safe auto-correction (--auto-correct).
331-
Style/EvalWithLocation:
332-
Exclude:
333-
- 'lib/puppet/interface/action_builder.rb'
334-
335427
# This cop supports safe auto-correction (--auto-correct).
336428
Style/EvenOdd:
337429
Exclude:
@@ -511,7 +603,6 @@ Style/MethodDefParentheses:
511603
Exclude:
512604
- 'lib/puppet/pops/evaluator/evaluator_impl.rb'
513605
- 'lib/puppet/pops/evaluator/relationship_operator.rb'
514-
- 'lib/puppet/pops/evaluator/runtime3_support.rb'
515606
- 'lib/puppet/pops/issues.rb'
516607
- 'lib/puppet/pops/label_provider.rb'
517608
- 'lib/puppet/pops/model/factory.rb'
@@ -622,7 +713,6 @@ Style/NestedModifier:
622713
Style/NestedParenthesizedCalls:
623714
Exclude:
624715
- 'lib/puppet/provider/user/directoryservice.rb'
625-
- 'lib/puppet/type/service.rb'
626716

627717
# This cop supports safe auto-correction (--auto-correct).
628718
Style/NestedTernaryOperator:
@@ -648,7 +738,6 @@ Style/Next:
648738
# SupportedStyles: predicate, comparison
649739
Style/NilComparison:
650740
Exclude:
651-
- 'lib/puppet/pops/model/ast.rb'
652741
- 'lib/puppet/pops/types/type_factory.rb'
653742
- 'lib/puppet/pops/types/types.rb'
654743
- 'lib/puppet/provider/package/dnfmodule.rb'
@@ -681,7 +770,7 @@ Style/NumericLiteralPrefix:
681770
# This cop supports safe auto-correction (--auto-correct).
682771
# Configuration parameters: Strict, AllowedNumbers.
683772
Style/NumericLiterals:
684-
MinDigits: 20
773+
MinDigits: 11
685774

686775
# This cop supports unsafe auto-correction (--auto-correct-all).
687776
# Configuration parameters: EnforcedStyle, IgnoredMethods.
@@ -832,7 +921,6 @@ Style/RedundantException:
832921
# Configuration parameters: SafeForConstants.
833922
Style/RedundantFetchBlock:
834923
Exclude:
835-
- 'lib/puppet/pops/model/ast.rb'
836924
- 'lib/puppet/pops/types/p_sem_ver_range_type.rb'
837925

838926
# This cop supports safe auto-correction (--auto-correct).
@@ -1187,4 +1275,4 @@ Style/ZeroLengthPredicate:
11871275
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, IgnoredPatterns.
11881276
# URISchemes: http, https
11891277
Layout/LineLength:
1190-
Enabled: false
1278+
Max: 582

Gemfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ group(:test) do
4949

5050
gem 'rubocop', '1.28.0', require: false, platforms: [:ruby]
5151
gem 'rubocop-i18n', '~> 3.0', require: false, platforms: [:ruby]
52+
gem 'rubocop-performance', '1.13.3', require: false, platforms: [:ruby]
53+
gem 'rubocop-rake', '0.6.0', require: false, platforms: [:ruby]
54+
gem 'rubocop-rspec', '2.10.0', require: false, platforms: [:ruby]
5255
end
5356

5457
group(:development, optional: true) do

0 commit comments

Comments
 (0)