-
Notifications
You must be signed in to change notification settings - Fork 855
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
Rubocop #460
Conversation
|
👍 makes sense On a related note, given the automated checks being added to the repo, maybe maintainers could refrain from committing non-critical changes directly to |
|
This looks good to me. |
We only know of running on Linux/BSD. Strange warning, even Windows supports using /.
Codebase doesn't use these often and definitely doesn't prefer them.
|
I don't really care about this code anymore so do whatever you want, but:
I think I was/am pretty consistent in my code style but most of this diff changes the style, not the code to conform to the existing style as you said. All of the existing code uses Similarly for spaces around brackets in array declarations. |
|
I didn't notice the codebase was consistent. I haven't seen another do it so it looks odd to me. I put no thought into that one, I autocorrected it and moved on. Edit: Spaces around brackets was pretty evenly split: 130 arrays without space, 142 with spaces. I considered disabling it, but I think it's come up in a PR so I went with the rubocop default. Double edit: As long as someone's reading these... the existing style As a warning to anyone paying attention to this PR: I will probably do a rebase |
|
As described, I've edited 1ea897a into b1f83f5 to remove the space between block curly braces and arguments. |
Rubocop doesn't have an option for our style, which is semantic (braces when mapping) except for DSL usage.
Disabling. The codebase almost always uses an explicit self receiver.
We're pretty evenly split on this.
I'm endlessly amused that we had 666 offenses against the default style.
It's a transitional thing, let future me suffer with Ruby 3.0.
Turned off everything but LineLength, which I bumped to 100 and manually tidied.
Seriously considered renaming vote_thusly_on_story_or_comment_for_user_because just becaues of how many weird linewraps it causes.
|
OK, no cops complaining and the merge conflicts are trivial. I'll merge Wednesday morning, if anyone wants to express an opinion before then. |
|
Good point, @sean-public -- would be nice to get outstanding PRs merged first, so the authors won't be forced to conform to style checks that didn't exist when they initially created the PRs. |
|
I merged the open PRs that were ready to go. |
|
OK, and merged this branch down, too. (I'm adding it to the test suite + travis in a separate commit because of hassles around the bumped deps.) |

I'm adding rubocop to enforce style issues to save human attention (and patience) in code reviews. The default config found 4,849 offenses and this branch will be merged when there are zero.
Like everybody I have opinions on style issues, but my preferred style for any codebase is whatever the codebase is already doing. With that in mind, I'm configuring cops to enforce the common usage and then tweaking outliers to match, eg. 988aa22 and fda61bb.
If you have opinions on how best to paint this bikeshed, this PR is the place to speak up. Once this is merged I'd like to change style config as rarely as possible because it's distracting churn when reading through history during bughunts. Speak now or forever hold your peace or, in the future, make a compelling, metrics-driven argument that a style change will materially improve code quality.
The current 3,382 offenses may seem like a lot, but if you sort by offense count you'll of course see a pareto-like distribution of 135 cops, so this PR hopefully won't linger for months.
rubocop | grep -o '[A-Z][^/]*/[A-Z][^ ]*' | sort | uniq -c | sort -rn | head -n 20TODO: run rubocop as part of the test suite so humans see it easily and Travis fails the build.