From cb526f0014f3d78b652bf352d45bdf4eda796852 Mon Sep 17 00:00:00 2001 From: jordanbreen28 Date: Mon, 2 Oct 2023 10:19:22 +0100 Subject: [PATCH] (maint) - Regenerate todo --- .rubocop_todo.yml | 85 ++++++++----------- lib/rspec-puppet/adapters.rb | 2 +- .../example/function_example_group.rb | 4 +- lib/rspec-puppet/monkey_patches.rb | 2 +- spec/classes/hash_spec.rb | 2 +- .../example/function_example_group_spec.rb | 2 + spec/unit/matchers/compile_spec.rb | 2 +- 7 files changed, 43 insertions(+), 56 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 01e42ede8..e0243cd06 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2023-09-29 10:39:55 UTC using RuboCop version 1.56.4. +# on 2023-10-02 10:16:22 UTC using RuboCop version 1.56.4. # 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 @@ -13,6 +13,11 @@ Lint/DuplicateBranch: - 'lib/rspec-puppet/matchers/compile.rb' - 'lib/rspec-puppet/matchers/run.rb' +# Offense count: 1 +Lint/DuplicateMethods: + Exclude: + - 'lib/rspec-puppet/adapters.rb' + # Offense count: 2 # Configuration parameters: AllowComments, AllowEmptyLambdas. Lint/EmptyBlock: @@ -59,10 +64,10 @@ Lint/UselessAssignment: - 'lib/rspec-puppet/matchers/create_generic.rb' - 'lib/rspec-puppet/monkey_patches.rb' -# Offense count: 29 +# Offense count: 27 # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes. Metrics/AbcSize: - Max: 47 + Max: 56 # Offense count: 7 # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode. @@ -70,37 +75,37 @@ Metrics/AbcSize: Metrics/BlockLength: Max: 111 -# Offense count: 3 +# Offense count: 1 # Configuration parameters: CountBlocks. Metrics/BlockNesting: Max: 4 -# Offense count: 5 +# Offense count: 6 # Configuration parameters: CountComments, CountAsOne. Metrics/ClassLength: Max: 297 -# Offense count: 19 +# Offense count: 18 # Configuration parameters: AllowedMethods, AllowedPatterns. Metrics/CyclomaticComplexity: Max: 18 -# Offense count: 53 +# Offense count: 47 # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns. Metrics/MethodLength: - Max: 37 + Max: 49 # Offense count: 2 # Configuration parameters: CountComments, CountAsOne. Metrics/ModuleLength: - Max: 422 + Max: 388 # Offense count: 2 # Configuration parameters: CountKeywordArgs, MaxOptionalParameters. Metrics/ParameterLists: Max: 9 -# Offense count: 14 +# Offense count: 13 # Configuration parameters: AllowedMethods, AllowedPatterns. Metrics/PerceivedComplexity: Max: 20 @@ -181,42 +186,27 @@ RSpec/BeforeAfterAll: - '**/spec/support/**/*.rb' - 'spec/unit/coverage_spec.rb' -# Offense count: 76 +# Offense count: 74 # Configuration parameters: Prefixes, AllowedPatterns. # Prefixes: when, with, without RSpec/ContextWording: Enabled: false -# Offense count: 90 +# Offense count: 89 # Configuration parameters: IgnoredMetadata. RSpec/DescribeClass: Enabled: false -# Offense count: 25 +# Offense count: 23 # Configuration parameters: CountAsOne. RSpec/ExampleLength: Max: 12 -# Offense count: 15 +# Offense count: 16 # Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly. # Include: **/*_spec*rb*, **/spec/**/* RSpec/FilePath: - Exclude: - - 'spec/cache_spec.rb' - - 'spec/classes/test_multi_os.rb' - - 'spec/raw_string_spec.rb' - - 'spec/support_spec.rb' - - 'spec/unit/coverage_spec.rb' - - 'spec/unit/example/function_example_group_spec.rb' - - 'spec/unit/facter_impl_spec.rb' - - 'spec/unit/matchers/allow_value_spec.rb' - - 'spec/unit/matchers/count_generic_spec.rb' - - 'spec/unit/matchers/parameter_matcher_spec.rb' - - 'spec/unit/matchers/raise_error_spec.rb' - - 'spec/unit/matchers/run_spec.rb' - - 'spec/unit/monkey_patches/win32/taskscheduler_spec.rb' - - 'spec/unit/raw_string_spec.rb' - - 'spec/unit/sensitive_spec.rb' + Enabled: false # Offense count: 2 RSpec/ImplicitBlockExpectation: @@ -234,7 +224,7 @@ RSpec/InstanceVariable: - 'spec/types/cleanup_spec.rb' - 'spec/unit/coverage_spec.rb' -# Offense count: 11 +# Offense count: 10 # Configuration parameters: . # SupportedStyles: have_received, receive RSpec/MessageSpies: @@ -248,10 +238,10 @@ RSpec/MultipleDescribes: - 'spec/classes/sysctl_common_spec.rb' - 'spec/defines/sysctl_before_spec.rb' - 'spec/functions/test_function_spec.rb' - - 'spec/unit/adapters_spec.rb' + - 'spec/unit/example/function_example_group_spec.rb' - 'spec/unit/monkey_patches_spec.rb' -# Offense count: 46 +# Offense count: 45 RSpec/MultipleExpectations: Max: 8 @@ -260,13 +250,13 @@ RSpec/MultipleExpectations: RSpec/MultipleMemoizedHelpers: Max: 7 -# Offense count: 284 +# Offense count: 263 # Configuration parameters: EnforcedStyle, IgnoreSharedExamples. # SupportedStyles: always, named_only RSpec/NamedSubject: Enabled: false -# Offense count: 20 +# Offense count: 26 # Configuration parameters: AllowedGroups. RSpec/NestedGroups: Max: 5 @@ -291,14 +281,15 @@ RSpec/RepeatedExample: Exclude: - 'spec/types/valid_provider_spec.rb' -# Offense count: 7 +# Offense count: 9 RSpec/RepeatedExampleGroupDescription: Exclude: - 'spec/classes/facts_spec.rb' - 'spec/classes/sysctl_common_spec.rb' - 'spec/defines/sysctl_before_spec.rb' + - 'spec/unit/adapters_spec.rb' -# Offense count: 14 +# Offense count: 15 # Configuration parameters: Include, CustomTransform, IgnoreMethods, IgnoreMetadata. # Include: **/*_spec.rb RSpec/SpecFilePathFormat: @@ -307,10 +298,11 @@ RSpec/SpecFilePathFormat: - 'spec/cache_spec.rb' - 'spec/raw_string_spec.rb' - 'spec/support_spec.rb' + - 'spec/unit/adapters_spec.rb' - 'spec/unit/coverage_spec.rb' - - 'spec/unit/example/function_example_group_spec.rb' - 'spec/unit/facter_impl_spec.rb' - 'spec/unit/matchers/allow_value_spec.rb' + - 'spec/unit/matchers/compile_spec.rb' - 'spec/unit/matchers/count_generic_spec.rb' - 'spec/unit/matchers/parameter_matcher_spec.rb' - 'spec/unit/matchers/raise_error_spec.rb' @@ -326,18 +318,12 @@ RSpec/SpecFilePathSuffix: Exclude: - 'spec/classes/test_multi_os.rb' -# Offense count: 3 +# Offense count: 2 RSpec/SubjectStub: Exclude: - - 'spec/unit/adapters_spec.rb' - 'spec/unit/coverage_spec.rb' -# Offense count: 1 -RSpec/UnspecifiedException: - Exclude: - - 'spec/support_spec.rb' - -# Offense count: 16 +# Offense count: 7 # Configuration parameters: IgnoreNameless, IgnoreSymbolicNames. RSpec/VerifiedDoubles: Exclude: @@ -365,7 +351,7 @@ Style/CombinableLoops: Exclude: - 'spec/classes/catalogue_cache_spec.rb' -# Offense count: 65 +# Offense count: 55 # Configuration parameters: AllowedConstants. Style/Documentation: Enabled: false @@ -378,7 +364,7 @@ Style/FormatString: Exclude: - 'lib/rspec-puppet/coverage.rb' -# Offense count: 15 +# Offense count: 14 # This cop supports safe autocorrection (--autocorrect). Style/IfUnlessModifier: Exclude: @@ -386,7 +372,6 @@ Style/IfUnlessModifier: - 'lib/rspec-puppet/coverage.rb' - 'lib/rspec-puppet/example/function_example_group.rb' - 'lib/rspec-puppet/matchers/create_generic.rb' - - 'lib/rspec-puppet/monkey_patches.rb' - 'lib/rspec-puppet/support.rb' # Offense count: 5 @@ -424,7 +409,7 @@ Style/StringConcatenation: - 'lib/rspec-puppet/matchers/compile.rb' - 'lib/rspec-puppet/support.rb' -# Offense count: 28 +# Offense count: 26 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns. # URISchemes: http, https diff --git a/lib/rspec-puppet/adapters.rb b/lib/rspec-puppet/adapters.rb index 32753e14c..0cf9904d2 100644 --- a/lib/rspec-puppet/adapters.rb +++ b/lib/rspec-puppet/adapters.rb @@ -162,7 +162,7 @@ def setup_puppet(example_group) { environments: loader, current_environment: env, - loaders: (Puppet::Pops::Loaders.new(env)) + loaders: Puppet::Pops::Loaders.new(env) }, 'Setup rspec-puppet environments' ) diff --git a/lib/rspec-puppet/example/function_example_group.rb b/lib/rspec-puppet/example/function_example_group.rb index 577534a96..df34fb0ea 100644 --- a/lib/rspec-puppet/example/function_example_group.rb +++ b/lib/rspec-puppet/example/function_example_group.rb @@ -93,7 +93,7 @@ def find_function(function_name = self.class.top_level_description) loaders = Puppet.lookup(:loaders) Puppet.override(context_overrides, 'rspec-test scope') do func = V4FunctionWrapper.new(function_name, - loaders.private_environment_loader.load(:function, function_name), context_overrides) + loaders.private_environment_loader.load(:function, function_name), context_overrides) @scope = context_overrides[:global_scope] end @@ -175,7 +175,7 @@ def build_compiler compiler end - def build_scope(compiler, node_name) + def build_scope(compiler, _node_name) compiler.context_overrides[:global_scope] end diff --git a/lib/rspec-puppet/monkey_patches.rb b/lib/rspec-puppet/monkey_patches.rb index 456d34d0b..798fb257d 100644 --- a/lib/rspec-puppet/monkey_patches.rb +++ b/lib/rspec-puppet/monkey_patches.rb @@ -284,7 +284,7 @@ class Pops::Lookup::ModuleDataProvider unless mod raise Puppet::DataBinding::LookupError, format(_("Environment '%s', cannot find module '%s'"), env: env.name, - module_name: module_name) + module_name: module_name) end return Pathname.new(mod.hiera_conf_file) diff --git a/spec/classes/hash_spec.rb b/spec/classes/hash_spec.rb index eea883ec8..ccbf89e52 100644 --- a/spec/classes/hash_spec.rb +++ b/spec/classes/hash_spec.rb @@ -23,7 +23,7 @@ context 'puppet 4 or greater' do it { expect(subject).to contain_structured_data__def('thing').with( - { 'data' => { 1 => 'uno', 2 => 'dos' } } + { 'data' => { 1 => 'uno', 2 => 'dos' } } ) } end diff --git a/spec/unit/example/function_example_group_spec.rb b/spec/unit/example/function_example_group_spec.rb index ca729f23f..b0faafb50 100644 --- a/spec/unit/example/function_example_group_spec.rb +++ b/spec/unit/example/function_example_group_spec.rb @@ -10,6 +10,7 @@ describe 'when calling with params' do subject { described_class.new(name, func, overrides) } + it do expect(func).to receive(:call).with(global_scope, 1, 2).once subject.call({}, 1, 2) @@ -18,6 +19,7 @@ describe 'when executing with params' do subject { described_class.new(name, func, overrides) } + it do expect(func).to receive(:call).with(global_scope, 1, 2).once subject.execute(1, 2) diff --git a/spec/unit/matchers/compile_spec.rb b/spec/unit/matchers/compile_spec.rb index e9792659d..595df1eb5 100644 --- a/spec/unit/matchers/compile_spec.rb +++ b/spec/unit/matchers/compile_spec.rb @@ -174,10 +174,10 @@ let(:expected_error) do 'Evaluation Error: Error while evaluating a Function Call, failure (line: 52, column: 1) on node rspec::puppet::manifestmatchers::compile' end + let(:error_detail) { 'failure (line: 52, column: 1)' } before { subject.and_raise_error(expected_error) } - let(:error_detail) { 'failure (line: 52, column: 1)' } it('matches') { is_expected.to be_matches catalogue } it {