Skip to content

Commit

Permalink
Switch to voxpupuli-rubocop
Browse files Browse the repository at this point in the history
In the past puppetlabs_spec_helper pulls in an undefined version of
RuboCop. RuboCop is known for introducing breaking changes in minor
releases. voxupuli-rubocop provides a curated version of rubocop +
dependencies + a RuboCop config based on community best practices. In
addition dependabot is used to inform people about new voxpupuli-rubocop
updates. This will ensure that puppetlabs_spec_helper won't randomly
pull in new RuboCop versions that break CI again.
  • Loading branch information
bastelfreak committed Jun 11, 2024
1 parent 453910a commit 57263f6
Show file tree
Hide file tree
Showing 4 changed files with 118 additions and 64 deletions.
16 changes: 3 additions & 13 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
---
inherit_from: .rubocop_todo.yml

require:
- rubocop-performance
- rubocop-rspec

AllCops:
Exclude:
- Gemfile
- Rakefile
- spec/fixtures/**/*
- vendor/bundle/**/*
NewCops: enable
SuggestExtensions: false
TargetRubyVersion: '2.7'
inherit_gem:
voxpupuli-rubocop: rubocop.yml

# Disabled
Style/ClassAndModuleChildren:
Expand Down
159 changes: 113 additions & 46 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,55 +1,37 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2024-02-09 08:47:26 UTC using RuboCop version 1.50.2.
# on 2024-06-09 12:47:09 UTC using RuboCop version 1.63.5.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: Severity, Include.
# Include: **/*.gemspec
Gemspec/RequireMFA:
# Configuration parameters: Width, AllowedPatterns.
Layout/IndentationWidth:
Exclude:
- 'puppetlabs_spec_helper.gemspec'

# Offense count: 5
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
Metrics/AbcSize:
Max: 60

# Offense count: 3
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode.
# AllowedMethods: refine
Metrics/BlockLength:
Max: 33

# Offense count: 4
# Configuration parameters: AllowedMethods, AllowedPatterns.
Metrics/CyclomaticComplexity:
Max: 19

# Offense count: 11
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
Metrics/MethodLength:
Max: 65
- 'Rakefile'

# Offense count: 1
# Configuration parameters: CountComments, CountAsOne.
Metrics/ModuleLength:
Max: 277
Lint/MixedRegexpCaptureTypes:
Exclude:
- 'Gemfile'

# Offense count: 3
# Configuration parameters: CountKeywordArgs.
Metrics/ParameterLists:
MaxOptionalParameters: 4
Max: 7
# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: strict, consistent
Lint/SymbolConversion:
Exclude:
- 'lib/puppetlabs_spec_helper/puppetlabs_spec/puppet_internals.rb'

# Offense count: 3
# Configuration parameters: AllowedMethods, AllowedPatterns.
Metrics/PerceivedComplexity:
Max: 22
# Offense count: 7
# Configuration parameters: Prefixes, AllowedPatterns.
# Prefixes: when, with, without
RSpec/ContextWording:
Exclude:
- 'spec/unit/puppetlabs_spec_helper/tasks/fixtures_spec.rb'

# Offense count: 1
# Configuration parameters: IgnoredMetadata.
Expand All @@ -62,42 +44,74 @@ RSpec/DescribeClass:
- '**/spec/views/**/*'
- 'spec/acceptance/smoke_spec.rb'

# Offense count: 6
# Offense count: 12
# Configuration parameters: CountAsOne.
RSpec/ExampleLength:
Max: 13

# Offense count: 5
# Offense count: 1
# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
# Include: **/*_spec*rb*, **/spec/**/*
RSpec/FilePath:
Exclude:
- 'spec/unit/puppetlabs_spec_helper/tasks/fixtures_spec.rb'

# Offense count: 8
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: implicit, each, example
RSpec/HookArgument:
Exclude:
- 'spec/unit/puppetlabs_spec_helper/tasks/fixtures_spec.rb'

# Offense count: 7
# Configuration parameters: .
# SupportedStyles: have_received, receive
RSpec/MessageSpies:
EnforcedStyle: receive

# Offense count: 5
# Offense count: 8
RSpec/MultipleExpectations:
Max: 3

# Offense count: 7
# Offense count: 14
# Configuration parameters: AllowedGroups.
RSpec/NestedGroups:
Max: 5

# Offense count: 5
# Offense count: 1
# Configuration parameters: Include, CustomTransform, IgnoreMethods, IgnoreMetadata.
# Include: **/*_spec.rb
RSpec/SpecFilePathFormat:
Exclude:
- '**/spec/routing/**/*'
- 'spec/unit/puppetlabs_spec_helper/tasks/fixtures_spec.rb'

# Offense count: 7
RSpec/StubbedMock:
Exclude:
- 'spec/unit/puppetlabs_spec_helper/puppetlabs_spec/puppet_internals_spec.rb'
- 'spec/unit/puppetlabs_spec_helper/tasks/fixture_helpers_spec.rb'
- 'spec/unit/puppetlabs_spec_helper/tasks/fixtures_spec.rb'

# Offense count: 2
Security/Eval:
Exclude:
- 'lib/puppetlabs_spec_helper/tasks/fixtures.rb'

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/CombinableLoops:
Exclude:
- 'lib/puppetlabs_spec_helper/tasks/fixtures.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowedVars.
Style/FetchEnvVar:
Exclude:
- 'Gemfile'

# Offense count: 7
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: MaxUnannotatedPlaceholdersAllowed, AllowedMethods, AllowedPatterns.
Expand All @@ -111,16 +125,69 @@ Style/GlobalVars:
Exclude:
- 'lib/puppetlabs_spec_helper/puppetlabs_spec/files.rb'

# Offense count: 4
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: AllowedReceivers.
# AllowedReceivers: Thread.current
Style/HashEachMethods:
Exclude:
- 'lib/puppetlabs_spec_helper/tasks/fixtures.rb'

# Offense count: 1
Style/MixinUsage:
Exclude:
- 'lib/puppetlabs_spec_helper/tasks/fixtures.rb'

# Offense count: 9
# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
Style/RedundantRegexpEscape:
Exclude:
- 'Gemfile'

# Offense count: 3
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, AllowInnerSlashes.
# SupportedStyles: slashes, percent_r, mixed
Style/RegexpLiteral:
Exclude:
- 'Gemfile'
- 'spec/unit/puppetlabs_spec_helper/tasks/fixtures_spec.rb'

# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
# SupportedStyles: single_quotes, double_quotes
Style/StringLiterals:
Exclude:
- 'Rakefile'

# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, AllowSafeAssignment.
# SupportedStyles: require_parentheses, require_no_parentheses, require_parentheses_when_complex
Style/TernaryParentheses:
Exclude:
- 'lib/puppetlabs_spec_helper/tasks/fixtures.rb'
- 'spec/watchr.rb'

# Offense count: 12
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyleForMultiline.
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
Style/TrailingCommaInArguments:
Style/TrailingCommaInArrayLiteral:
Exclude:
- 'lib/puppetlabs_spec_helper/tasks/fixtures.rb'
- 'lib/puppetlabs_spec_helper/module_spec_helper.rb'
- 'lib/puppetlabs_spec_helper/tasks/check_symlinks.rb'
- 'spec/spec_helper.rb'
- 'spec/unit/puppetlabs_spec_helper/tasks/check_symlinks_spec.rb'
- 'spec/unit/puppetlabs_spec_helper/tasks/check_test_file_spec.rb'

# Offense count: 26
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyleForMultiline.
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
Style/TrailingCommaInHashLiteral:
Exclude:
- 'lib/puppetlabs_spec_helper/rake_tasks.rb'
- 'spec/unit/puppetlabs_spec_helper/tasks/check_symlinks_spec.rb'
- 'spec/unit/puppetlabs_spec_helper/tasks/fixture_helpers_spec.rb'
5 changes: 0 additions & 5 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ group :development do
gem 'rake'
gem 'rspec', '~> 3.1'
gem 'rspec-its', '~> 1.0'
gem 'rubocop', '~> 1.50.0', require: false
gem 'rubocop-rspec', '~> 2.19', require: false
gem 'rubocop-performance', '~> 1.16', require: false
gem 'rubocop-factory_bot', '!= 2.26.0', require: false
gem 'rubocop-rspec_rails', '!= 2.29.0', require: false

gem 'fakefs'
gem 'yard'
Expand Down
2 changes: 2 additions & 0 deletions puppetlabs_spec_helper.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,7 @@ Gem::Specification.new do |spec|
spec.add_runtime_dependency 'rspec-github', '~> 2.0'
spec.add_runtime_dependency 'rspec-puppet', '~> 4.0'

spec.add_development_dependency 'voxpupuli-rubocop', '~> 2.7.0'

spec.requirements << 'puppet, >= 7.0.0'
end

0 comments on commit 57263f6

Please sign in to comment.