puppetlabs / rspec-puppet

RSpec tests for your Puppet manifests
https://puppetlabs.github.io/rspec-puppet/
MIT License
13 stars 18 forks source link

(maint) Fix rubocop lint warnings #93

Closed gavindidrichsen closed 10 months ago

gavindidrichsen commented 10 months ago

Summary

Fix rubocop string-to-symbol conversion nightly CI failures:

➜  rspec-puppet git:(maint_fix_rubocop_warnings) bundle exec rubocop --format github

::error file=lib/rspec-puppet/example/function_example_group.rb,line=103,col=61::Lint/SymbolConversion: Unnecessary symbol conversion; use `:"function_#{function_name}"` instead.
::error file=lib/rspec-puppet/matchers/create_generic.rb,line=306,col=18::Lint/SymbolConversion: Unnecessary symbol conversion; use `:"eachauto#{type}"` instead.
::error file=lib/rspec-puppet/matchers/type_matchers.rb,line=126,col=28::Lint/SymbolConversion: Unnecessary symbol conversion; use `:"valid#{attr_type}?"` instead.
::error file=spec/types/valid_provider_spec.rb,line=22,col=53::Lint/SymbolConversion: Unnecessary symbol conversion; use `:"with_#{k}"` instead.
::error file=spec/types/valid_provider_spec.rb,line=32,col=51::Lint/SymbolConversion: Unnecessary symbol conversion; use `:"with_#{k}"` instead.
➜  rspec-puppet git:(maint_fix_rubocop_warnings) 

For example:

?➜  rspec-puppet git:(maint_fix_rubocop_warnings) git diff main..HEAD
diff --git a/lib/rspec-puppet/example/function_example_group.rb b/lib/rspec-puppet/example/function_example_group.rb
index df34fb0..6836129 100644
--- a/lib/rspec-puppet/example/function_example_group.rb
+++ b/lib/rspec-puppet/example/function_example_group.rb
@@ -100,7 +100,7 @@ module RSpec::Puppet
         return func if func.func

         if Puppet::Parser::Functions.function(function_name)
-          V3FunctionWrapper.new(function_name, scope.method("function_#{function_name}".intern))
+          V3FunctionWrapper.new(function_name, scope.method(:"function_#{function_name}"))
         end
       end
     end

Checklist