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

Style/FormatString: Favor String#% over format. #1319

Closed
nekath opened this issue Sep 1, 2014 · 2 comments
Closed

Style/FormatString: Favor String#% over format. #1319

nekath opened this issue Sep 1, 2014 · 2 comments

Comments

@nekath
Copy link

nekath commented Sep 1, 2014

The problem occur when you have class macros. For instance macros from HTTParty:

class MyClass
  include HTTParty
  format :xml
end

Rubocop reports offense:

rubocop_example.rb:3:3: C: Favor String#% over format.
  format :xml
  ^^^^^^
❯ rubocop -v
0.25.0
@nekath nekath changed the title Style/FormatString (Favor String#% over format.) Style/FormatString: Favor String#% over format. Sep 1, 2014
@bbatsov
Copy link
Collaborator

bbatsov commented Sep 1, 2014

People should really stop overriding methods from Kernel... I guess we can check whether format is invoked with at least to arguments, but of course this won't be exactly bulletproof either.

@bbatsov bbatsov closed this as completed in d43e31e Sep 1, 2014
@nekath
Copy link
Author

nekath commented Sep 1, 2014

Thank you for fast response and fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants