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

False positive for Lint/FormatParameterMismatch when '0' flag and dynamic width are used at the same time #2540

Closed
taichi-ishitani opened this issue Dec 25, 2015 · 5 comments

Comments

@taichi-ishitani
Copy link
Contributor

Example

puts format('%0*x', 2, 1)

Rubocop output

$ cat test.rb
puts format('%0*x', 2, 1)

$ rubocop -V
0.35.1 (using Parser 2.2.3.0, running on ruby 2.2.3 x64-mingw32)

$ rubocop test.rb
Inspecting 1 file
W

Offenses:

test.rb:1:6: W: Number arguments (2) to format mismatches expected fields (0).
puts format('%0*x', 2, 1)
     ^^^^^^

1 file inspected, 1 offense detected

I think it is not offense, so Rubocop should not report it.

@alexdowad
Copy link
Contributor

Thanks for the report! It will be looked into soon.

@alexdowad
Copy link
Contributor

@taichi-ishitani, thank you for reporting this issue. I have pushed a fix to my open PR, which hopefully will be merged soon.

@taichi-ishitani
Copy link
Contributor Author

Hi @alexdowad san,
I have confirmed this issue is resolved with the latest Rubocop.
Thank you for your support!

@alexdowad
Copy link
Contributor

どういたしまして。RuboCopを楽しんで使ってください!

@bbatsov
Copy link
Collaborator

bbatsov commented Dec 30, 2015

@alexdowad You know Japanese? Impressive! :-)

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

3 participants