Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use latest rubocop and target ruby 2.5 #40

Merged
merged 4 commits into from Oct 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/test.yml
Expand Up @@ -14,7 +14,6 @@ jobs:
fail-fast: false
matrix:
include:
- ruby: "2.4"
- ruby: "2.5"
- ruby: "2.6"
- ruby: "2.7"
ekohl marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
179 changes: 137 additions & 42 deletions rubocop.yml
Expand Up @@ -3,10 +3,10 @@
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
# Puppet agent 6 ships with ruby 2.5. Puppetserver 6 uses JRuby 9.2.x (Ruby 2.5 compatible) since version 6.1.0.
TargetRubyVersion: 2.5
Include:
- ./**/*.rb
- '**/*.rb'
Exclude:
- files/**/*
- vendor/**/*
Expand All @@ -18,7 +18,7 @@ AllCops:
- Guardfile
- Vagrantfile

Lint/ConditionPosition:
Layout/ConditionPosition:
Enabled: True

Lint/ElseLayout:
Expand All @@ -27,16 +27,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 +89,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 +110,7 @@ Lint/ParenthesesAsGroupedExpression:
Lint/RescueException:
Enabled: True

Lint/StringConversionInInterpolation:
Lint/RedundantStringCoercion:
Enabled: True

Lint/UnusedBlockArgument:
Expand All @@ -122,28 +122,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 +152,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 +186,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 +259,7 @@ Style/CommentAnnotation:
Metrics/CyclomaticComplexity:
Enabled: False

Style/ConstantName:
Naming/ConstantName:
Enabled: True

Style/Documentation:
Expand All @@ -292,10 +283,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 +305,7 @@ Style/EmptyLiteral:
Enabled: True

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

Style/MethodCallWithoutArgsParentheses:
Expand All @@ -335,7 +326,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 +371,7 @@ Style/UnlessElse:
Style/VariableInterpolation:
Enabled: True

Style/VariableName:
Naming/VariableName:
Enabled: True

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

Style/FileName:
Naming/FileName:
Enabled: True

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

Style/MethodName:
Naming/MethodName:
Enabled: True

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

Style/OpMethod:
Naming/BinaryOperatorParameterName:
Enabled: True

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

Style/PredicateName:
Naming/PredicateName:
Enabled: True

Style/RedundantException:
Expand Down Expand Up @@ -538,9 +532,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 +546,105 @@ Style/FormatStringToken:
# are located.
RSpec/FilePath:
Enabled: false

# Leaving these enabled creates too much busy work
RSpec/ContextWording:
Enabled: false
Naming/HeredocDelimiterNaming:
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
Layout/LineEndStringConcatenationIndentation: # new in 1.18
Enabled: true
Lint/AmbiguousOperatorPrecedence: # new in 1.21
Enabled: true
Lint/AmbiguousRange: # new in 1.19
Enabled: true
Lint/EmptyInPattern: # new in 1.16
Enabled: true
Lint/IncompatibleIoSelectWithFiberScheduler: # new in 1.21
Enabled: true
Lint/RequireRelativeSelfPath: # new in 1.22
Enabled: true
Security/IoMethods: # new in 1.22
Enabled: true
Style/InPatternThen: # new in 1.16
Enabled: true
Style/MultilineInPatternThen: # new in 1.16
Enabled: true
Style/NumberedParameters: # new in 1.22
Enabled: true
Style/NumberedParametersLimit: # new in 1.22
Enabled: true
Style/QuotedSymbols: # new in 1.16
Enabled: true
Style/RedundantSelfAssignmentBranch: # new in 1.19
Enabled: true
Style/SelectByRegexp: # new in 1.22
Enabled: true
Style/StringChars: # new in 1.12
Enabled: true
RSpec/ExcessiveDocstringSpacing: # new in 2.5
Enabled: true
RSpec/IdenticalEqualityAssertion: # new in 2.4
Enabled: true
RSpec/SubjectDeclaration: # new in 2.5
Enabled: true
RSpec/Rails/AvoidSetupHook: # new in 2.4
Enabled: true
10 changes: 7 additions & 3 deletions voxpupuli-test.gemspec
Expand Up @@ -12,19 +12,23 @@ Gem::Specification.new do |s|

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

s.required_ruby_version = '>= 2.5.0'

s.add_runtime_dependency 'rake'

# Testing
s.add_runtime_dependency 'facterdb', '>= 1.4.0'
s.add_runtime_dependency 'metadata-json-lint', '>= 3.0.1'
s.add_runtime_dependency 'parallel_tests'
s.add_runtime_dependency 'puppetlabs_spec_helper', '>= 2.16.0'
# 4.0.0 provides rubocop annotations in GitHub Actions
s.add_runtime_dependency 'puppetlabs_spec_helper', '>= 4.0.0'
s.add_runtime_dependency 'rspec-puppet-facts', '>= 2.0.1', '< 3'
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.22.3'
s.add_runtime_dependency 'rubocop-rspec', '~> 2.5.0'
s.add_runtime_dependency 'rubocop-rake', '~> 0.6.0'

# Linting
# meta gem to pull in all puppet-lint plugins + puppet-lint itself
Expand Down