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
Pathname#sub(...)
Pathname#delete_suffix(...)
Given standardrb_bug.rb:
standardrb_bug.rb
require "pathname" path = Pathname.new("path/to/some/ruby/file.rb").sub(/\.rb\z/, "") puts path
...when I run it, I get the following:
$ ruby standardrb_bug.rb path/to/some/ruby/file
...but when I run the following:
$ standardrb --version 1.1.1 $ standardrb standardrb_bug.rb --fix
...it changes standardrb_bug.rb like so:
require "pathname" path = Pathname.new("path/to/some/ruby/file.rb").delete_suffix(".rb") puts path
...which raises an error when run:
$ ruby standardrb_bug.rb Traceback (most recent call last): standardrb_bug.rb:3:in `<main>': undefined method `delete_suffix' for #<Pathname:path/to/some/ruby/file.rb> (NoMethodError)
Pathname objects have a sub method but not a delete_suffix method and it's not safe for standardrb to change it.
Pathname
sub
delete_suffix
The text was updated successfully, but these errors were encountered:
Huh. Totally agree that we should not be changing it. Now I just need to find the rule.
Sorry, something went wrong.
b210af5
Merge pull request #294 from testdouble/disable-delete-suffix
2d8dd2c
fix #292 and disable Performance/DeleteSuffix
No branches or pull requests
Given
standardrb_bug.rb
:...when I run it, I get the following:
...but when I run the following:
...it changes
standardrb_bug.rb
like so:...which raises an error when run:
Pathname
objects have asub
method but not adelete_suffix
method and it's not safe for standardrb to change it.The text was updated successfully, but these errors were encountered: