We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Rubocop(master) looks make false nagative against typical sprintf/format cases.
Some example cases(picked from ruby-doc.org) will fail tests.
This patch will make the test suite is passing:
diff --git a/lib/rubocop/cop/style/format_string.rb b/lib/rubocop/cop/style/format_string.rb index e75095a..37c12df 100644 --- a/lib/rubocop/cop/style/format_string.rb +++ b/lib/rubocop/cop/style/format_string.rb @@ -31,13 +31,13 @@ def offending_node?(node) end def format_method?(name, node) - receiver, method_name, args = *node + receiver, method_name, *args = *node # commands have no explicit receiver return false unless !receiver && method_name == name # we do an argument count check to reduce false positives - args && args.children.size >= 2 + args.size >= 2 end def format?(node)
I'm not sure why format(something, a, b) registers an offense in spec but format("%d %04x", 123, 123) does not.
format(something, a, b)
format("%d %04x", 123, 123)
It would be great if you guys look into it.
The text was updated successfully, but these errors were encountered:
👍
Sorry, something went wrong.
ad6dc48
Merge pull request #1517 from jonas054/kakutani/fix-false-negative-fo…
7bc58d1
…rmat-string [Fix #1512] Fix false negative for typical string formatting examples
jonas054
No branches or pull requests
Rubocop(master) looks make false nagative against typical sprintf/format cases.
Some example cases(picked from ruby-doc.org) will fail tests.
This patch will make the test suite is passing:
I'm not sure why
format(something, a, b)
registers an offense in spec butformat("%d %04x", 123, 123)
does not.It would be great if you guys look into it.
The text was updated successfully, but these errors were encountered: