Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions STYLEGUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
This is GitHub's Ruby Style Guide, inspired by [RuboCop's guide][rubocop-guide].

## Table of Contents

1. [Layout](#layout)
1. [Indentation](#indentation)
2. [Inline](#inline)
Expand Down Expand Up @@ -763,6 +764,22 @@ if x > 10
end
```

* Don't use `unless` with a negated condition.
<a name="no-unless-negation"></a><sup>[[link](#no-unless-negation)]</sup>
* <a href="https://docs.rubocop.org/rubocop/cops_style.html#stylenegatedunless">RuboCop rule: Style/NegatedUnless</a>

```ruby
# bad
unless !condition?
do_something
end

# good
if condition?
do_something
end
```

### Ternary operator

* Avoid the ternary operator (`?:`) except in cases where all expressions are extremely
Expand Down
2 changes: 1 addition & 1 deletion config/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1370,7 +1370,7 @@ Style/NegatedIfElseCondition:
Enabled: false

Style/NegatedUnless:
Enabled: false
Enabled: true

Style/NegatedWhile:
Enabled: false
Expand Down
Loading