Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(maint) Fix rubocop lint warnings #93

Merged
merged 1 commit into from
Dec 5, 2023
Merged

Conversation

gavindidrichsen
Copy link

@gavindidrichsen gavindidrichsen commented Dec 4, 2023

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

  • 🟢 Spec tests.
  • 🟢 Acceptance tests.
  • Manually verified.

Signed-off-by: Gavin Didrichsen <[email protected]>
@gavindidrichsen gavindidrichsen changed the title Fix rubocop string-to-symbol conversion warnings (maint) Fix rubocop string-to-symbol conversion warnings Dec 4, 2023
@gavindidrichsen gavindidrichsen changed the title (maint) Fix rubocop string-to-symbol conversion warnings (maint) Fix rubocop lint warnings Dec 4, 2023
@gavindidrichsen gavindidrichsen marked this pull request as ready for review December 4, 2023 21:33
@gavindidrichsen gavindidrichsen requested review from bastelfreak and a team as code owners December 4, 2023 21:33
Copy link
Collaborator

@bastelfreak bastelfreak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think in addition https://github.com/puppetlabs/rspec-puppet/blob/main/Gemfile#L36 should be updated so rubocop is pinned to one minor version? then nightlies won't break anymore. we do the same at vox pupuli (or maybe consider using voxpupuli-rubocop?).

Copy link

@jordanbreen28 jordanbreen28 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jordanbreen28 jordanbreen28 merged commit e114a11 into main Dec 5, 2023
7 checks passed
@jordanbreen28 jordanbreen28 deleted the maint_fix_rubocop_warnings branch December 5, 2023 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants