ruby-style-guide
ruby-style-guide copied to clipboard
Shopify’s Ruby Style Guide
This might be a personal pet peeve of mine, but I find all the examples inside the `# bad` to be hard to read, and even lead me to simply...
Regex anchoring was missing an IMO pretty important _why_ this is preferred, so added that. For the `match?` addition I considered merging it with the non-capturing group recommendation, but figured...
I couldn't find any discussion about this cop, but I believe it's a positive one. First there's the correctness argument. If a constant is mutable is it really a constant?...
## What This enables the [`Lint/SymbolConversion` cop](https://docs.rubocop.org/rubocop/cops_lint.html#lintsymbolconversion). ## Why A common mistake in Ruby is to assume that wrapping `Symbol` `Hash` keys in quotes makes the `Hash` use `String` keys....
Listening for both events triggers a redundant build. All PRs will have involved pushing a branch, so the build will have already been triggered. There is no need to trigger...
This adds a rule elaborating on some of the pitfalls of `||=`. _"Avoid using `||=` to initialize boolean variables"_ provides a good explanation about `false` not being safe to use...
Per the discussion on Slack earlier today, where we reviewed internal code where seemingly the authors were not aware of the `self
This cop makes it more cumbersome to use custom exception classes that do not use a message as only argument to its constructor, e.g. ``` ruby Class CommandFailure def initialize(command)...
This is a follow up on #99, more specifically to this [comment](https://github.com/Shopify/ruby-style-guide/pull/99#discussion_r234640657). This PR removes the `IgnoreMacros: true` for the `Style/MethodCallWithArgsParentheses` cop, effectively meaning that we'll start asking devs to...
I'm quite reluctant to do this, but here's the proposition: not require parens for `test` method arguments. My rationale is only that I'm afraid that having to write `test("the thing...