Skip to content

Fixes violations of and reenables Style/UnneededInterpolation.#9183

Merged
ashercodeorg merged 3 commits into
stagingfrom
rubocopStyleUnneededInterpolation
Jun 29, 2016
Merged

Fixes violations of and reenables Style/UnneededInterpolation.#9183
ashercodeorg merged 3 commits into
stagingfrom
rubocopStyleUnneededInterpolation

Conversation

@ashercodeorg

@ashercodeorg ashercodeorg commented Jun 27, 2016

Copy link
Copy Markdown
Contributor

Fixes generated automatically via bundle exec rubocop --only Style/UnneededInterpolation --auto-correct. Then manual tweaks.

@joshlory

Copy link
Copy Markdown
Contributor

I don't have a good sense of whether the .to_s can be removed everywhere, but I trust that you've verified those changes. The risk would be that these are different things:

irb(main):001:0> {1 => 2}
=> {1=>2}
irb(main):002:0> {1.to_s => 2}
=> {"1"=>2}

@joshlory

Copy link
Copy Markdown
Contributor

The other risk is that .to_s will convert nil to "":

irb(main):003:0> nil.to_s
=> ""

@ashercodeorg

Copy link
Copy Markdown
Contributor Author

In all cases, I verified that the variable --if not nil-- is a string. Let me go back and confirm that the variable is never nil, I missed that.

"abuse type: #{params[:abuse_type]}",
"user detail:",
"#{params[:abuse_detail]}"
params[:abuse_detail]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though I can't guarantee that params[:abuse_detail] isn't nil, if it is nil, nothing will happen (body won't end with a blank line).

@ashercodeorg

Copy link
Copy Markdown
Contributor Author

Confirmed (see the one comment I added). Nice catch.

@joshlory

Copy link
Copy Markdown
Contributor

LGTM. Thanks for doing this cleanup!

@ashercodeorg ashercodeorg merged commit 12fda0e into staging Jun 29, 2016
@ashercodeorg ashercodeorg deleted the rubocopStyleUnneededInterpolation branch June 29, 2016 03:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants