Skip to content

Commit 7a54827

Browse files
committed
Merge pull request bbatsov#78 from uvtc/master
minor punctuation changes to intro
2 parents aa1949b + e432e82 commit 7a54827

File tree

1 file changed

+40
-16
lines changed

1 file changed

+40
-16
lines changed

README.md

Lines changed: 40 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,23 @@ This Clojure style guide recommends best practices so that real-world Clojure
77
programmers can write code that can be maintained by other real-world Clojure
88
programmers. A style guide that reflects real-world usage gets used, and a
99
style guide that holds to an ideal that has been rejected by the people it is
10-
supposed to help risks not getting used at all – no matter how good it is.
10+
supposed to help risks not getting used at all — no matter how good it is.
1111

1212
The guide is separated into several sections of related rules. I've
13-
tried to add the rationale behind the rules (if it's omitted I've
14-
assumed that is pretty obvious).
13+
tried to add the rationale behind the rules (if it's omitted, I've
14+
assumed that it's pretty obvious).
1515

16-
I didn't come up with all the rules out of nowhere - they are mostly
16+
I didn't come up with all the rules out of nowhere; they are mostly
1717
based on my extensive career as a professional software engineer,
1818
feedback and suggestions from members of the Clojure community, and
1919
various highly regarded Clojure programming resources, such as
2020
["Clojure Programming"](http://www.clojurebook.com/)
2121
and ["The Joy of Clojure"](http://joyofclojure.com/).
2222

23-
The guide is still a work in progress - some sections are missing,
23+
The guide is still a work in progress; some sections are missing,
2424
others are incomplete, some rules are lacking examples, some rules
2525
don't have examples that illustrate them clearly enough. In due time
26-
these issues will be addressed - just keep them in mind for now.
26+
these issues will be addressed — just keep them in mind for now.
2727

2828
You can generate a PDF or an HTML copy of this guide using
2929
[Transmuter](https://github.com/TechnoGate/transmuter).
@@ -62,7 +62,7 @@ You can generate a PDF or an HTML copy of this guide using
6262
(something-else))
6363
```
6464

65-
* Align vertically function arguments.
65+
* Vertically align function arguments.
6666

6767
```Clojure
6868
;; good
@@ -74,7 +74,7 @@ You can generate a PDF or an HTML copy of this guide using
7474
(range 1 10))
7575
```
7676

77-
* Align `let` bindings and map keywords.
77+
* Vertically align `let` bindings and map keywords.
7878

7979
```Clojure
8080
;; good
@@ -245,8 +245,11 @@ macro definition. An exception can be made to indicate grouping of
245245
pairwise constructs as found in e.g. `let` and `cond`.
246246

247247
* Where feasible, avoid making lines longer than 80 characters.
248+
248249
* Avoid trailing whitespace.
250+
249251
* Use one file per namespace.
252+
250253
* Start every namespace with a comprehensive `ns` form, comprised of
251254
`import`s, `require`s, `refer`s and `use`s.
252255

@@ -285,7 +288,7 @@ pairwise constructs as found in e.g. `let` and `cond`.
285288
(ns example)
286289
```
287290

288-
* Avoid the use of overly long namespaces(i.e. with more than 5 segments).
291+
* Avoid the use of overly long namespaces (i.e., more than 5 segments).
289292

290293
* Avoid functions longer than 10 LOC (lines of code). Ideally, most
291294
functions will be shorter than 5 LOC.
@@ -297,7 +300,9 @@ pairwise constructs as found in e.g. `let` and `cond`.
297300
* Avoid the use of namespace-manipulating functions like `require` and
298301
`refer`. They are entirely unnecessary outside of a REPL
299302
environment.
303+
300304
* Use `declare` to enable forward references.
305+
301306
* Prefer higher-order functions like `map` to `loop/recur`.
302307

303308
* Prefer function pre and post conditions to checks inside a function's body.
@@ -445,8 +450,8 @@ pairwise constructs as found in e.g. `let` and `cond`.
445450
(not (= foo bar))
446451
```
447452

448-
* When doing comparisons keep in mind that Clojure's functions `<`,
449-
`>`, etc accept variable number of arguments.
453+
* When doing comparisons, keep in mind that Clojure's functions `<`,
454+
`>`, etc. accept a variable number of arguments.
450455

451456
```Clojure
452457
;; good
@@ -776,7 +781,9 @@ hints for the pairwise grouping with comments or empty lines.
776781
* When naming namespaces favor the following two schemas:
777782
* `project.module`
778783
* `organization.project.module`
784+
779785
* Use `lisp-case` in composite namespace segments(e.g. `bruce.project-euler`)
786+
780787
* Use `lisp-case` for function and variable names.
781788

782789
```Clojure
@@ -792,9 +799,10 @@ hints for the pairwise grouping with comments or empty lines.
792799

793800
* Use `CamelCase` for protocols, records, structs, and types. (Keep
794801
acronyms like HTTP, RFC, XML uppercase.)
802+
795803
* The names of predicate methods (methods that return a boolean value)
796-
should end in a question mark.
797-
(i.e. `even?`).
804+
should end in a question mark
805+
(e.g., `even?`).
798806

799807
```Clojure
800808
;; good
@@ -806,7 +814,8 @@ hints for the pairwise grouping with comments or empty lines.
806814
```
807815

808816
* The names of functions/macros that are not safe in STM transactions
809-
should end with an exclamation mark. (i.e. `reset!`)
817+
should end with an exclamation mark (e.g. `reset!`).
818+
810819
* Use `->` instead of `to` in the names of conversion functions.
811820

812821
```Clojure
@@ -998,21 +1007,26 @@ as small as possible.
9981007

9991008
## Exceptions
10001009

1001-
* Reuse existing exception types. Idiomatic Clojure code, when it does
1002-
throw an exception, throws an exception of a standard type
1010+
* Reuse existing exception types. Idiomatic Clojure code &mdash; when it does
1011+
throw an exception &mdash; throws an exception of a standard type
10031012
(e.g. `java.lang.IllegalArgumentException`,
10041013
`java.lang.UnsupportedOperationException`,
10051014
`java.lang.IllegalStateException`, `java.io.IOException`).
1015+
10061016
* Favor `with-open` over `finally`.
10071017

10081018
## Macros
10091019

10101020
* Don't write a macro if a function will do.
1021+
10111022
* Create an example of a macro usage first and the macro afterwards.
1023+
10121024
* Break complicated macros into smaller functions whenever possible.
1025+
10131026
* A macro should usually just provide syntactic sugar and the core of
10141027
the macro should be a plain function. Doing so will improve
10151028
composability.
1029+
10161030
* Prefer syntax-quoted forms over building lists manually.
10171031

10181032
## Comments
@@ -1055,6 +1069,7 @@ and the text that follows it.
10551069
* Comments longer than a word begin with a capital letter and use
10561070
punctuation. Separate sentences with
10571071
[one space](http://en.wikipedia.org/wiki/Sentence_spacing).
1072+
10581073
* Avoid superfluous comments.
10591074

10601075
```Clojure
@@ -1064,6 +1079,7 @@ and the text that follows it.
10641079

10651080
* Keep existing comments up-to-date. An outdated comment is worse than no comment
10661081
at all.
1082+
10671083
* Prefer the use of the `#_` reader macro over a regular comment when
10681084
you need to comment out a particular form.
10691085

@@ -1087,10 +1103,13 @@ you need to comment out a particular form.
10871103
10881104
* Annotations should usually be written on the line immediately above
10891105
the relevant code.
1106+
10901107
* The annotation keyword is followed by a colon and a space, then a note
10911108
describing the problem.
1109+
10921110
* If multiple lines are required to describe the problem, subsequent
10931111
lines should be indented as much as the first one.
1112+
10941113
* Tag the annotation with your initials and a date so its relevance can
10951114
be easily verified.
10961115
@@ -1114,14 +1133,19 @@ you need to comment out a particular form.
11141133
11151134
* Use `TODO` to note missing features or functionality that should be
11161135
added at a later date.
1136+
11171137
* Use `FIXME` to note broken code that needs to be fixed.
1138+
11181139
* Use `OPTIMIZE` to note slow or inefficient code that may cause
11191140
performance problems.
1141+
11201142
* Use `HACK` to note "code smells" where questionable coding practices
11211143
were used and should be refactored away.
1144+
11221145
* Use `REVIEW` to note anything that should be looked at to confirm it
11231146
is working as intended. For example: `REVIEW: Are we sure this is how the
11241147
client does X currently?`
1148+
11251149
* Use other custom annotation keywords if it feels appropriate, but be
11261150
sure to document them in your project's `README` or similar.
11271151

0 commit comments

Comments
 (0)