Permalink
Browse files

Change bad/good to avoid/prefer

  • Loading branch information...
mveytsman committed Mar 5, 2018
1 parent 2fc2cfb commit 803913be6cbc5ad359fad11eaefbe70039928d61
Showing with 2 additions and 3 deletions.
  1. +2 −3 STYLEGUIDE.md
View
@@ -229,15 +229,15 @@ end
Avoid calling `send` and its cousins unless you really need it. Metaprogramming can be extremely powerful, but in most cases you can write code that captures your meaning by being explicit:
``` ruby
# Bad
# avoid
unless [:base, :head].include?(base_or_head)
raise ArgumentError, "base_or_head must be either :base or :head"
end
repository = pull.send("#{base_or_head}_repository")
branch = pull.send("#{base_or_head}_ref_name")
# Good
# prefer
case base_or_head
when :base
repository = pull.base_repository
@@ -249,7 +249,6 @@ else
raise ArgumentError, "base_or_head must be either :base or :head"
end
```
## Exceptions
* Don't use exceptions for flow of control.

0 comments on commit 803913b

Please sign in to comment.