|
9 | 9 | - [Use an opinionated set of rules for Rubocop](Use-an-opinionated-set-of-rules-for-Rubocop.md)
|
10 | 10 | - [Limit use of conditional modifiers to short, simple cases](Limit-use-of-conditional-modifiers-to-short-simple-cases.md)
|
11 | 11 | - Avoid multiple assignments per line (`one, two = 1, 2`). [#109]
|
12 |
| -- Avoid organizational comments (`# Validations`). [#63] |
13 | 12 | - Avoid ternary operators (`boolean ? true : false`). Use multi-line `if`
|
14 | 13 | instead to emphasize code branches. [36491dbb9]
|
15 |
| -- Avoid bang (!) method names. Prefer descriptive names. [#122] |
16 |
| -- Name variables created by a factory after the factory (`user_factory` creates |
17 |
| - `user`). |
18 | 14 | - Prefer nested class and module definitions over the shorthand version
|
19 | 15 | [Example](/ruby/sample_1.rb#L103) [#332]
|
20 | 16 | - Prefer `detect` over `find`. [0d819844]
|
|
23 | 19 | - Prefer `reduce` over `inject`. [#237]
|
24 | 20 | - Prefer `&:method_name` to `{ |item| item.method_name }` for simple method
|
25 | 21 | calls. [#183]
|
26 |
| -- Use `_` for unused block parameters. [0d819844] |
27 |
| -- Prefix unused variables or parameters with underscore (`_`). [#335] |
28 |
| -- Suffix variables holding a factory with `_factory` (`user_factory`). |
29 |
| -- Use a leading underscore when defining instance variables for memoization. |
30 |
| - [#373] |
31 | 22 | - Use `%()` for single-line strings containing double-quotes that require
|
32 | 23 | interpolation. [36491dbb9]
|
33 |
| -- Use `?` suffix for predicate methods. [0d819844] |
34 |
| -- Use `def self.method`, not `class << self`. [40090e22] |
35 |
| -- Use `def` with parentheses when there are arguments. [36491dbb9] |
36 | 24 | - Use heredocs for multi-line strings. [36491dbb9]
|
37 |
| -- Order class methods above instance methods. [#320] |
38 |
| -- Prefer method invocation over instance variables. [#331] |
39 |
| -- Avoid optional parameters. Does the method do too much? |
40 | 25 | - Avoid monkey-patching.
|
41 | 26 | - Generate necessary [Bundler binstubs] for the project, such as `rake` and
|
42 | 27 | `rspec`, and add them to version control.
|
43 | 28 | - Prefer classes to modules when designing functionality that is shared by
|
44 | 29 | multiple models.
|
| 30 | +- Avoid organizational comments (`# Validations`). [#63] |
| 31 | +- Use empty lines around multi-line blocks. |
| 32 | + |
| 33 | +--- |
| 34 | + |
| 35 | +- Avoid bang (!) method names. Prefer descriptive names. [#122] |
| 36 | +- Use `?` suffix for predicate methods. [0d819844] |
| 37 | +- Use `def self.method`, not `class << self`. [40090e22] |
| 38 | +- Use `def` with parentheses when there are arguments. [36491dbb9] |
| 39 | +- Avoid optional parameters. Does the method do too much? |
| 40 | +- Order class methods above instance methods. [#320] |
45 | 41 | - Prefer `private` when indicating scope. Use `protected` only with comparison
|
46 | 42 | methods like `def ==(other)`, `def <(other)`, and `def >(other)`.
|
47 |
| -- Use empty lines around multi-line blocks. |
| 43 | + |
| 44 | +--- |
| 45 | + |
| 46 | +- Prefix unused variables or parameters with underscore (`_`). [#335] |
| 47 | +- Name variables created by a factory after the factory (`user_factory` creates |
| 48 | + `user`). |
| 49 | +- Suffix variables holding a factory with `_factory` (`user_factory`). |
| 50 | +- Use a leading underscore when defining instance variables for memoization. |
| 51 | + [#373] |
| 52 | +- Prefer method invocation over instance variables. [#331] |
48 | 53 |
|
49 | 54 | [#63]: https://github.com/thoughtbot/guides/pull/63
|
50 | 55 | [#109]: https://github.com/thoughtbot/guides/pull/109
|
|
0 commit comments