Skip to content

Commit

Permalink
(CAT-1688) Upgrade rubocop version
Browse files Browse the repository at this point in the history
Following a recent team decision, we are implementing a Rubocop Upgrade,
moving the version from 1.48.1 to 1.50.0. This should be the final
version until Puppet 7 is unsupported.
  • Loading branch information
LukasAud committed Jan 19, 2024
1 parent 4270a2d commit f9e8e8f
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 24 deletions.
44 changes: 24 additions & 20 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2023-04-19 10:55:51 UTC using RuboCop version 1.50.2.
# on 2024-01-19 14:46:17 UTC using RuboCop version 1.50.2.
# 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
Expand Down Expand Up @@ -33,40 +33,38 @@ Lint/EmptyBlock:
Metrics/AbcSize:
Max: 110

# Offense count: 27
# Offense count: 25
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode.
# AllowedMethods: refine
Metrics/BlockLength:
Exclude:
- lib/pdk/cli/console.rb
Max: 105

# Offense count: 16
# Configuration parameters: CountComments, CountAsOne.
Metrics/ClassLength:
Max: 260
Max: 258

# Offense count: 53
# Configuration parameters: AllowedMethods, AllowedPatterns.
Metrics/CyclomaticComplexity:
Max: 24

# Offense count: 138
# Offense count: 137
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
Metrics/MethodLength:
Max: 145

# Offense count: 5
# Offense count: 6
# Configuration parameters: CountComments, CountAsOne.
Metrics/ModuleLength:
Max: 200
Max: 197

# Offense count: 45
# Configuration parameters: AllowedMethods, AllowedPatterns.
Metrics/PerceivedComplexity:
Max: 28

# Offense count: 38
# Offense count: 37
# Configuration parameters: ForbiddenDelimiters.
# ForbiddenDelimiters: (?i-mx:(^|\s)(EO[A-Z]{1}|END)(\s|$))
Naming/HeredocDelimiterNaming:
Expand Down Expand Up @@ -99,28 +97,28 @@ Naming/MemoizedInstanceVariableName:
- 'lib/pdk/util/git.rb'
- 'spec/unit/pdk/config_spec.rb'

# Offense count: 472
# Offense count: 473
# Configuration parameters: Prefixes, AllowedPatterns.
# Prefixes: when, with, without
RSpec/ContextWording:
Enabled: false

# Offense count: 62
# Offense count: 57
# Configuration parameters: IgnoredMetadata.
RSpec/DescribeClass:
Enabled: false

# Offense count: 176
# Offense count: 173
# Configuration parameters: CountAsOne.
RSpec/ExampleLength:
Max: 40

# Offense count: 56
# Offense count: 54
RSpec/ExpectInHook:
Enabled: false

# Offense count: 4
# Configuration parameters: Max.
# Configuration parameters: Max, AllowedIdentifiers, AllowedPatterns.
RSpec/IndexedLet:
Exclude:
- 'spec/unit/pdk/template/renderer/v1/renderer_spec.rb'
Expand All @@ -134,11 +132,11 @@ RSpec/LeakyConstantDeclaration:
- 'spec/unit/pdk/config_spec.rb'
- 'spec/unit/pdk/validate/invokable_validator_spec.rb'

# Offense count: 359
# Offense count: 335
RSpec/MultipleExpectations:
Max: 6

# Offense count: 455
# Offense count: 452
# Configuration parameters: AllowSubject.
RSpec/MultipleMemoizedHelpers:
Max: 14
Expand Down Expand Up @@ -166,7 +164,12 @@ RSpec/PendingWithoutReason:
- 'spec/unit/pdk/config/json_with_schema_spec.rb'
- 'spec/unit/pdk/config/yaml_with_schema_spec.rb'

# Offense count: 23
# Offense count: 1
RSpec/RemoveConst:
Exclude:
- 'package-testing/spec/package/support/serverspec_monkeypatch.rb'

# Offense count: 21
RSpec/RepeatedExampleGroupBody:
Exclude:
- 'package-testing/spec/package/unit_test_a_new_module_spec.rb'
Expand All @@ -178,7 +181,7 @@ RSpec/RepeatedExampleGroupBody:
- 'spec/acceptance/update_spec.rb'
- 'spec/acceptance/version_changer_spec.rb'

# Offense count: 102
# Offense count: 101
RSpec/StubbedMock:
Enabled: false

Expand All @@ -189,18 +192,19 @@ RSpec/SubjectStub:
- 'spec/unit/pdk/config/namespace_spec.rb'
- 'spec/unit/pdk/template/renderer/v1/renderer_spec.rb'

# Offense count: 181
# Offense count: 177
# Configuration parameters: AllowedConstants.
Style/Documentation:
Enabled: false

# Offense count: 340
# Offense count: 330
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: always, always_true, never
Style/FrozenStringLiteralComment:
Enabled: false

# Offense count: 4
Style/OpenStructUse:
Exclude:
- 'lib/pdk/template/renderer/v1/template_file.rb'
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ group :test do
gem 'parallel_tests'
gem 'rake'
gem 'rspec', '~> 3.0'
gem 'rubocop', '~> 1.48', require: false
gem 'rubocop', '~> 1.50.0', require: false
gem 'rubocop-performance', '~> 1.16', require: false
gem 'rubocop-rspec', '~> 2.19', require: false
gem 'simplecov-console'
Expand Down
2 changes: 1 addition & 1 deletion lib/pdk/config/namespace.rb
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def to_h
new_hash = {}
settings.each_pair { |k, v| new_hash[k] = v.value }
@mounts.each_pair { |k, mount_point| new_hash[k] = mount_point.to_h if mount_point.include_in_parent? }
new_hash.delete_if { |_k, v| v.nil? } # rubocop :disable Style/CollectionCompact
new_hash.delete_if { |_k, v| v.nil? }
new_hash
end

Expand Down
2 changes: 1 addition & 1 deletion lib/pdk/module/metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def update!(data)
def to_json(*_args)
require 'json'

JSON.pretty_generate(@data.dup.delete_if { |_key, value| value.nil? }) # rubocop:disable Style/CollectionCompact
JSON.pretty_generate(@data.dup.delete_if { |_key, value| value.nil? })
end

def write!(path)
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/pdk/config/namespace_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def spec_simple_validator
expect([config.fetch(:foo, 'default'), config.fetch('foo', 'default')]).to all(eq('bar'))
end

it 'will return the specified default value for unknown values' do
it 'returns the specified default value for unknown values' do
expect([config.fetch(:missing, 'default'), config.fetch('missing', 'default')]).to all(eq('default'))
end

Expand Down

0 comments on commit f9e8e8f

Please sign in to comment.