This repository has been archived by the owner on Jan 13, 2022. It is now read-only.
forked from watir/watir-classic
-
Notifications
You must be signed in to change notification settings - Fork 9
/
coding_conventions.txt
49 lines (40 loc) · 2.24 KB
/
coding_conventions.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
In general, Pickaxe is our style manual. Make your code look like theirs.
The following is mostly elaboration; exceptions are marked as house style.
* We use two spaces for each indentation level.
* Calls to "return" are allowed (but not required) on the last line of a method.
(house style)
* Don't use braces to span more than one line. Use do/end intead.
* Don't use do/end on one line; use braces instead.
* We prefer single-quoted strings when string interpolation is not being used
(or for other purposes, such as quoting single quotes). (house style)
* Instance variables holding ole objects should have 'ole' in the name. (house style)
* In general, Watir names (methods, classes) should follow what HTML or
JavaScript uses. These have precedence over the OLE API names. (house style)
* Parameter names should be descriptive and accurate. Always. Same is true for
local variables, but more slack is allowed.
* Single-letter names for local variables are allowed when they have limited scope
(and aren't parameters).
* No extra whitespace!!! No more than one consecutive blank line.
* Never more than one consecutive space (except indentation).
* Argument lists are set like English (one, two, three) -- (except parens are
flush with method name, unlike english).
* Method calls with no arguments don't require parens() and it's strongly
prefered to omit them.
* Method calls with args that don't actually need parens (for syntax) don't
require them either (for style).
* However: use extra spaces with vertical bars. Thus:
(1..5).each {| n | puts n}
* Also, always uses spaces with operators. Thus:
a = b + c if d == e
* Exception:
def foo(bar=true)
* And of course:
def bird_bath= foo
Capitalization rules -- Straight from Ruby Style:
method names -- lowercase, use underscore between words. always!
instance variables -- same as method names (except with a @). always!
Class names are constants so they must start with Capital (syntax error otherwise).
Use StuddlyCaps for multiple words.
Studdly_Caps_With_Underscores are never, ever, ever correct. (But you get points for effort.)
camelCaseWithLowerCaseStart is never, ever, ever correct. Not for anything.
File names -- use underscores (sorry Brian), all lower case