Skip to content

Fix RuboCop style offences#397

Merged
Koronen merged 50 commits into
masterfrom
rubocop-style
Jan 24, 2016
Merged

Fix RuboCop style offences#397
Koronen merged 50 commits into
masterfrom
rubocop-style

Conversation

@Koronen
Copy link
Copy Markdown
Contributor

@Koronen Koronen commented Dec 19, 2015

Fixes all remaining style offences reported by RuboCop.

TODO:

@Koronen
Copy link
Copy Markdown
Contributor Author

Koronen commented Dec 19, 2015

I'd like some feedback on how to fix the two remaining style offences.

  • Style/NumericLiterals

    Most of the offences reported by this cop are UNIX timestamps. I'm not sure if adding underscores improves readability in these cases.

  • Style/StringLiterals

    Enforcing one of the two supported styles would result in a lot of changes pretty much everywhere. Do we want to enforce single quotes (RuboCop default), enforce double quotes or just turn off this cop? I'd prefer enforcing one of the two options for consistency, but I don't have a strong opinion on which one. If I had to choose I'd go for single quotes because it's the RuboCop default.

@swanson
Copy link
Copy Markdown
Collaborator

swanson commented Dec 20, 2015

Style/NumericLiterals

Yeah I don't think the underscore here is the right answer -- I don't know if I would want that rule even for non-timestamp large numbers. +1 to disabling that.

Style/StringLiterals

I personally type double-quotes as my 'default'. I agree that consistency is for the best. One small thing that has me favoring double-quotes is that can't use #{foo.bar} style interpolation with single-quotes. But, hey, you're the one doing all the heavy lifting so I'm okay with your preference :)

@Koronen
Copy link
Copy Markdown
Contributor Author

Koronen commented Dec 20, 2015

I personally type double-quotes as my 'default'. I agree that consistency is for the best. One small thing that has me favoring double-quotes is that can't use #{foo.bar} style interpolation with single-quotes.

Let's enforce double quotes then?

But, hey, you're the one doing all the heavy lifting so I'm okay with your preference :)

My preference is not a strong one, and it will be RuboCop doing all the heavy lifting in this case. This cop supports auto-correction. 😃

@swanson
Copy link
Copy Markdown
Collaborator

swanson commented Dec 20, 2015

👍

@Koronen Koronen changed the title [WIP] Fix RuboCop style offences Fix RuboCop style offences Jan 17, 2016
Ignores offences in `SampleStory` since those methods mimic column definitions
in `Story`.
Me:
> Most of the offences reported by this cop are UNIX timestamps. I'm not sure if
> adding underscores improves readability in these cases.

Matt:
> Yeah I don't think the underscore here is the right answer -- I don't know if
> I would want that rule even for non-timestamp large numbers. +1 to disabling
> that.
Neither me nor Matt have a strong opinion on the question of single or double
quotes, but we settled on enforcing double quotes for consistency.
Koronen added a commit that referenced this pull request Jan 24, 2016
@Koronen Koronen merged commit 1fcb2ef into master Jan 24, 2016
@Koronen Koronen deleted the rubocop-style branch January 24, 2016 09:04
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.

2 participants