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

redundantBackticks: Remove redundant raw values for escaped reserved words #585

Merged
merged 1 commit into from Mar 26, 2020

Conversation

@josh
Copy link

josh commented Mar 26, 2020

enum Foo: String {
  case `as` = "as"
  case bs = "bs"
}

Currently, redundantBackticks will correctly strip the "bs" rawValue but will miss the "as".

enum Foo: String {
  case `as` = "as"
  case bs
}

But the escaped as is also safe to cleanup.

This PR changes the token comparison to consider the unescaped value of the string to fix the issue.

enum Foo: String {
  case `as`
  case bs
}
@nicklockwood

This comment has been minimized.

Copy link
Owner

nicklockwood commented Mar 26, 2020

Nice catch, thanks!

@nicklockwood nicklockwood merged commit fa6af64 into nicklockwood:develop Mar 26, 2020
1 check passed
1 check passed
coverage/coveralls First build on redundant-raw-values-backticks at 93.179%
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.