Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: howaboutwe/ruby-style-guide
base: 40d51a6902
...
head fork: howaboutwe/ruby-style-guide
compare: 0cf9ab4a1e
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 1 file changed
  • 0 commit comments
  • 1 contributor
Commits on Aug 31, 2012
@oggy oggy Remove some annotation stuff.
We've yet to settle on anything here, but the built-in Rails tasks do
not honor HACK or REVIEW, and neither seem particularly useful.

The indenting remark seems odd and I see no reason to be inconsistent
with other comment paragraphs.
1f092f6
@oggy oggy Simplify the File.join remark.
It's really when using static strings that it's so grossly
unnecessary.
0cf9ab4
Showing with 7 additions and 17 deletions.
  1. +7 −17 README.md
View
24 README.md
@@ -923,8 +923,6 @@ An outdated comment is worse than no comment at all.
the relevant code.
* The annotation keyword is followed by a colon and a space, then a note
describing the problem.
-* If multiple lines are required to describe the problem, subsequent
- lines should be indented two spaces after the `#`.
```Ruby
def bar
@@ -949,11 +947,6 @@ An outdated comment is worse than no comment at all.
* Use `FIXME` to note broken code that needs to be fixed.
* Use `OPTIMIZE` to note slow or inefficient code that may cause
performance problems.
-* Use `HACK` to note code smells where questionable coding practices
- were used and should be refactored away.
-* Use `REVIEW` to note anything that should be looked at to confirm it
- is working as intended. For example: `REVIEW: Are we sure this is how the
- client does X currently?`
* Use other custom annotation keywords if it feels appropriate, but be
sure to document them in your project's `README` or similar.
@@ -1501,22 +1494,19 @@ syntax.
* Use `OptionParser` for parsing complex command line options and
`ruby -s` for trivial command line options.
-* Don't use File.join to piece together file names unless:
- * Segments may contain a trailing '/' (usually optional - most file
- operations clean given paths of duplicate slashes)
- * You're displaying the resulting string to a user (required on
- Windows)
-
- ```Ruby
+* Don't use File.join to piece together file names from static strings.
+ ```Ruby
# bad
path = File.join(Rails.root, 'config', 'blah.yml')
- # good
+ # better - works because Rails.root is a Pathname
+ path = Rails.root.join('config/blah.yml')
+
+ # best
path = "#{Rails.root}/config/blah.yml"
```
- (Contrary to popular belief, even if this was actually run on
- Windows, it'd run just fine.)
+ (Contrary to popular belief, this runs just fine on Windows.)
* Code in a functional way, avoiding mutation when that makes sense.
* Avoid needless metaprogramming.

No commit comments for this range

Something went wrong with that request. Please try again.