From 6bd8f1dda1b0cc23dac6c64480f1e3f7c4cf586f Mon Sep 17 00:00:00 2001 From: Lukas Audzevicius Date: Fri, 19 Jan 2024 14:47:50 +0000 Subject: [PATCH] (CAT-1688) Upgrade rubocop version 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. --- .rubocop_todo.yml | 39 ++++++++++++++++++------------------- Gemfile | 2 +- lib/pdk/config/namespace.rb | 2 +- lib/pdk/module/metadata.rb | 2 +- 4 files changed, 22 insertions(+), 23 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 65aa424d3..1a454f428 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -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 @@ -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: @@ -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' @@ -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 @@ -166,7 +164,7 @@ 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: 21 RSpec/RepeatedExampleGroupBody: Exclude: - 'package-testing/spec/package/unit_test_a_new_module_spec.rb' @@ -178,7 +176,7 @@ RSpec/RepeatedExampleGroupBody: - 'spec/acceptance/update_spec.rb' - 'spec/acceptance/version_changer_spec.rb' -# Offense count: 102 +# Offense count: 101 RSpec/StubbedMock: Enabled: false @@ -189,18 +187,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' diff --git a/Gemfile b/Gemfile index 61c16f204..d2b3e252e 100644 --- a/Gemfile +++ b/Gemfile @@ -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' diff --git a/lib/pdk/config/namespace.rb b/lib/pdk/config/namespace.rb index c09e5087d..bc4e839bf 100644 --- a/lib/pdk/config/namespace.rb +++ b/lib/pdk/config/namespace.rb @@ -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 diff --git a/lib/pdk/module/metadata.rb b/lib/pdk/module/metadata.rb index 58308f068..cf4c1f2de 100644 --- a/lib/pdk/module/metadata.rb +++ b/lib/pdk/module/metadata.rb @@ -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)