Skip to content

Commit

Permalink
Use latest rubocop and target ruby 2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
alexjfisher committed Mar 13, 2021
1 parent f6c85fe commit 25de071
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 44 deletions.
137 changes: 95 additions & 42 deletions rubocop.yml
Expand Up @@ -3,10 +3,12 @@
require: rubocop-rspec

AllCops:
# Puppet Server 5 defaults to jruby 1.7 so TargetRubyVersion must stay at 1.9 until we drop support for puppet 5
TargetRubyVersion: 1.9
# Ruby 2.4 is the oldest version we can use with the latest version of rubocop (1.11.0 as of 13/03/2021).
# Puppet agent 5 ships with ruby 2.4. Puppetserver 5 has JRuby 2.1.x which is only ruby 2.3 compatible, but this
# is unlikely to cause many issues. If/when it does, we can disable the relevant cop inline as appropriate.
TargetRubyVersion: 2.4
Include:
- ./**/*.rb
- '**/*.rb'
Exclude:
- files/**/*
- vendor/**/*
Expand All @@ -18,7 +20,7 @@ AllCops:
- Guardfile
- Vagrantfile

Lint/ConditionPosition:
Layout/ConditionPosition:
Enabled: True

Lint/ElseLayout:
Expand All @@ -27,16 +29,16 @@ Lint/ElseLayout:
Lint/UnreachableCode:
Enabled: True

Lint/UselessComparison:
Lint/BinaryOperatorWithIdenticalOperands:
Enabled: True

Lint/EnsureReturn:
Enabled: True

Lint/HandleExceptions:
Lint/SuppressedException:
Enabled: True

Lint/LiteralInCondition:
Lint/LiteralAsCondition:
Enabled: True

Lint/ShadowingOuterLocalVariable:
Expand Down Expand Up @@ -89,13 +91,13 @@ Lint/AmbiguousRegexpLiteral:
Security/Eval:
Enabled: True

Lint/BlockAlignment:
Layout/BlockAlignment:
Enabled: True

Lint/DefEndAlignment:
Layout/DefEndAlignment:
Enabled: True

Lint/EndAlignment:
Layout/EndAlignment:
Enabled: True

Lint/DeprecatedClassMethods:
Expand All @@ -110,7 +112,7 @@ Lint/ParenthesesAsGroupedExpression:
Lint/RescueException:
Enabled: True

Lint/StringConversionInInterpolation:
Lint/RedundantStringCoercion:
Enabled: True

Lint/UnusedBlockArgument:
Expand All @@ -122,28 +124,25 @@ Lint/UnusedMethodArgument:
Lint/UselessAccessModifier:
Enabled: True

Lint/UselessAssignment:
Enabled: True

Lint/Void:
Enabled: True

Layout/AccessModifierIndentation:
Enabled: True

Style/AccessorMethodName:
Naming/AccessorMethodName:
Enabled: True

Style/Alias:
Enabled: True

Layout/AlignArray:
Layout/ArrayAlignment:
Enabled: True

Layout/AlignHash:
Layout/HashAlignment:
Enabled: True

Layout/AlignParameters:
Layout/ParameterAlignment:
Enabled: True

Metrics/BlockNesting:
Expand All @@ -155,22 +154,16 @@ Style/AsciiComments:
Style/Attr:
Enabled: True

Style/BracesAroundHashParameters:
Enabled: False

Style/CaseEquality:
Enabled: True

Style/TrailingCommaInArguments:
Enabled: False

Layout/CaseIndentation:
Enabled: True

Style/CharacterLiteral:
Enabled: True

Style/ClassAndModuleCamelCase:
Naming/ClassAndModuleCamelCase:
Enabled: True

Style/ClassAndModuleChildren:
Expand All @@ -195,22 +188,22 @@ Style/WhenThen:
Style/WordArray:
Enabled: True

Style/UnneededPercentQ:
Style/RedundantPercentQ:
Enabled: True

Layout/Tab:
Layout/IndentationStyle:
Enabled: True

Layout/SpaceBeforeSemicolon:
Enabled: True

Layout/TrailingBlankLines:
Layout/TrailingEmptyLines:
Enabled: True

Layout/SpaceInsideBlockBraces:
Enabled: True

Layout/SpaceInsideBrackets:
Layout/SpaceBeforeBrackets:
Enabled: True

Layout/SpaceInsideHashLiteralBraces:
Expand Down Expand Up @@ -268,7 +261,7 @@ Style/CommentAnnotation:
Metrics/CyclomaticComplexity:
Enabled: False

Style/ConstantName:
Naming/ConstantName:
Enabled: True

Style/Documentation:
Expand All @@ -292,10 +285,10 @@ Style/EachWithObject:
Layout/EmptyLineBetweenDefs:
Enabled: True

Layout/IndentArray:
Layout/FirstArrayElementIndentation:
Enabled: True

Layout/IndentHash:
Layout/FirstHashElementIndentation:
Enabled: True

Layout/IndentationConsistency:
Expand All @@ -314,7 +307,7 @@ Style/EmptyLiteral:
Enabled: True

# Configuration parameters: AllowURI, URISchemes.
Metrics/LineLength:
Layout/LineLength:
Enabled: False

Style/MethodCallWithoutArgsParentheses:
Expand All @@ -335,7 +328,10 @@ Style/StringLiterals:
Style/TrailingCommaInArguments:
Enabled: True

Style/TrailingCommaInLiteral:
Style/TrailingCommaInArrayLiteral:
Enabled: False

Style/TrailingCommaInHashLiteral:
Enabled: False

Style/GlobalVars:
Expand Down Expand Up @@ -377,7 +373,7 @@ Style/UnlessElse:
Style/VariableInterpolation:
Enabled: True

Style/VariableName:
Naming/VariableName:
Enabled: True

Style/WhileUntilDo:
Expand All @@ -386,7 +382,7 @@ Style/WhileUntilDo:
Style/EvenOdd:
Enabled: True

Style/FileName:
Naming/FileName:
Enabled: True

Style/For:
Expand All @@ -395,7 +391,7 @@ Style/For:
Style/Lambda:
Enabled: True

Style/MethodName:
Naming/MethodName:
Enabled: True

Style/MultilineTernaryOperator:
Expand Down Expand Up @@ -431,7 +427,7 @@ Style/NumericLiterals:
Style/OneLineConditional:
Enabled: True

Style/OpMethod:
Naming/BinaryOperatorParameterName:
Enabled: True

Style/ParenthesesAroundCondition:
Expand All @@ -443,7 +439,7 @@ Style/PercentLiteralDelimiters:
Style/PerlBackrefs:
Enabled: True

Style/PredicateName:
Naming/PredicateName:
Enabled: True

Style/RedundantException:
Expand Down Expand Up @@ -538,9 +534,8 @@ RSpec/NestedGroups:
RSpec/MultipleExpectations:
Enabled: false

# this is broken on ruby1.9
Layout/IndentHeredoc:
Enabled: False
Layout/HeredocIndentation:
Enabled: True

Security/YAMLLoad:
Enabled: True
Expand All @@ -553,3 +548,61 @@ Style/FormatStringToken:
# are located.
RSpec/FilePath:
Enabled: false

# New cops available after rubocop upgrade
Gemspec/DateAssignment: # (new in 1.10)
Enabled: true
Lint/AmbiguousAssignment: # (new in 1.7)
Enabled: true
Lint/DeprecatedConstants: # (new in 1.8)
Enabled: true
Lint/DuplicateBranch: # (new in 1.3)
Enabled: true
Lint/DuplicateRegexpCharacterClassElement: # (new in 1.1)
Enabled: true
Lint/EmptyBlock: # (new in 1.1)
Enabled: true
Lint/EmptyClass: # (new in 1.3)
Enabled: true
Lint/LambdaWithoutLiteralBlock: # (new in 1.8)
Enabled: true
Lint/NoReturnInBeginEndBlocks: # (new in 1.2)
Enabled: true
Lint/NumberedParameterAssignment: # (new in 1.9)
Enabled: true
Lint/OrAssignmentToConstant: # (new in 1.9)
Enabled: true
Lint/RedundantDirGlobSort: # (new in 1.8)
Enabled: true
Lint/SymbolConversion: # (new in 1.9)
Enabled: true
Lint/ToEnumArguments: # (new in 1.1)
Enabled: true
Lint/TripleQuotes: # (new in 1.9)
Enabled: true
Lint/UnexpectedBlockArity: # (new in 1.5)
Enabled: true
Lint/UnmodifiedReduceAccumulator: # (new in 1.1)
Enabled: true
Style/ArgumentsForwarding: # (new in 1.1)
Enabled: true
Style/CollectionCompact: # (new in 1.2)
Enabled: true
Style/DocumentDynamicEvalDefinition: # (new in 1.1)
Enabled: true
Style/EndlessMethod: # (new in 1.8)
Enabled: true
Style/HashConversion: # (new in 1.10)
Enabled: true
Style/HashExcept: # (new in 1.7)
Enabled: true
Style/IfWithBooleanLiteralBranches: # (new in 1.9)
Enabled: true
Style/NegatedIfElseCondition: # (new in 1.2)
Enabled: true
Style/NilLambda: # (new in 1.3)
Enabled: true
Style/RedundantArgument: # (new in 1.4)
Enabled: true
Style/SwapValues: # (new in 1.1)
Enabled: true
7 changes: 5 additions & 2 deletions voxpupuli-test.gemspec
Expand Up @@ -12,6 +12,8 @@ Gem::Specification.new do |s|

s.files = Dir['lib/**/*.rb', 'rubocop.yml']

s.required_ruby_version = '>= 2.4.0'

s.add_runtime_dependency 'rake'

# Testing
Expand All @@ -23,8 +25,9 @@ Gem::Specification.new do |s|
s.add_runtime_dependency 'rspec-puppet-utils', '>= 1.9.5'

# Rubocop
s.add_runtime_dependency 'rubocop', '~> 0.49.1'
s.add_runtime_dependency 'rubocop-rspec', '~> 1.16.0'
s.add_runtime_dependency 'rubocop', '~> 1.11.0'
s.add_runtime_dependency 'rubocop-rspec', '~> 2.2.0'
s.add_runtime_dependency 'rubocop-rake', '~> 0.5.1'

# Linting
s.add_runtime_dependency 'puppet-lint-absolute_classname-check', '>= 2.0.0'
Expand Down

0 comments on commit 25de071

Please sign in to comment.