Skip to content

Commit 0d4cf5e

Browse files
authored
Don't use foo, bar, and baz (#716)
It is possible that the term foobar has a [questionable etymology](https://en.wikipedia.org/wiki/Foobar#History_and_etymology), but in addition, these don't mean anything an in our code, as well as our documentation, there is almost always a more meaningful example to use that will better convey intent to other developers, and yourself in the future. We already have a line in our guides to "Name variables, methods, and classes to reveal intent." However, throughout our open source projects we have used this placeholder variables in code and documentation when a more meaningful alternative would have been better. This adds the point that this guideline also applies to documentation, and gives the examples of `foo`, `bar`, and `baz`, to hopefully make it clear what the guideline is saying to not do.
1 parent fe2d6f3 commit 0d4cf5e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

general/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ violations.
4141
- Prefer naming classes after domain concepts rather than patterns they
4242
implement (e.g. `Guest` vs `NullUser`, `CachedRequest` vs `RequestDecorator`).
4343
- Name the enumeration parameter the singular of the collection (`users.each { |user| greet(user) }`).
44-
- Name variables, methods, and classes to reveal intent.
44+
- Name variables, methods, and classes to reveal intent. This includes documentation and examples (e.g. don't use `foo`, `bar`, `baz` in examples).
4545
- Treat acronyms as words in names (`XmlHttpRequest` not `XMLHTTPRequest`), even
4646
if the acronym is the entire name (`class Html` not `class HTML`).
4747

0 commit comments

Comments
 (0)