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

[Fix #115] DeletePrefix and DeleteSuffix cops detects sub/sub! String methods #116

Merged
merged 1 commit into from
May 26, 2020

Conversation

fatkodima
Copy link
Contributor

# bad
str.sub(/suffix\z/, '')
str.sub!(/suffix\z/, '')
str.sub(/suffix$/, '')
str.sub!(/suffix$/, '')

# good
str.delete_suffix('suffix')
str.delete_suffix!('suffix')

# bad
str.sub(/\Aprefix/, '')
str.sub!(/\Aprefix/, '')
str.sub(/^prefix/, '')
str.sub!(/^prefix/, '')

# good
str.delete_prefix('prefix')
str.delete_prefix!('prefix')

Closes #115

@koic koic merged commit aef2416 into rubocop:master May 26, 2020
@koic
Copy link
Member

koic commented May 26, 2020

The next release is planned for 1.6.1, but this change can be included. Thanks!

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

Successfully merging this pull request may close these issues.

DeletePrefix and DeleteSuffix should detect sub/sub! String methods
2 participants