Correct indentation level of code blocks
Also, remove hard tabs from code blocks.
This commit is contained in:
parent
d684ea1eed
commit
19b55384f8
@ -56,7 +56,7 @@ Layout & Indentation
|
|||||||
+ Indentation shall be 2 spaces (no hard tabs), except when matching
|
+ Indentation shall be 2 spaces (no hard tabs), except when matching
|
||||||
the indentation of the previous line.
|
the indentation of the previous line.
|
||||||
|
|
||||||
.. code-block:: clj
|
.. code-block:: clj
|
||||||
|
|
||||||
;; Good (and preferred)
|
;; Good (and preferred)
|
||||||
(defn fib [n]
|
(defn fib [n]
|
||||||
@ -84,7 +84,7 @@ Layout & Indentation
|
|||||||
+ Parentheses must *never* be left alone, sad and lonesome on their own
|
+ Parentheses must *never* be left alone, sad and lonesome on their own
|
||||||
line.
|
line.
|
||||||
|
|
||||||
.. code-block:: clj
|
.. code-block:: clj
|
||||||
|
|
||||||
;; Good (and preferred)
|
;; Good (and preferred)
|
||||||
(defn fib [n]
|
(defn fib [n]
|
||||||
@ -103,7 +103,7 @@ Layout & Indentation
|
|||||||
|
|
||||||
+ Vertically align ``let`` blocks.
|
+ Vertically align ``let`` blocks.
|
||||||
|
|
||||||
.. code-block:: clj
|
.. code-block:: clj
|
||||||
|
|
||||||
(let [[foo (bar)]
|
(let [[foo (bar)]
|
||||||
[qux (baz)]]
|
[qux (baz)]]
|
||||||
@ -132,7 +132,7 @@ Coding Style
|
|||||||
+ As a convention, try not to use ``def`` for anything other than global
|
+ As a convention, try not to use ``def`` for anything other than global
|
||||||
variables; use ``setv`` inside functions, loops, etc.
|
variables; use ``setv`` inside functions, loops, etc.
|
||||||
|
|
||||||
.. code-block:: clj
|
.. code-block:: clj
|
||||||
|
|
||||||
;; Good (and preferred)
|
;; Good (and preferred)
|
||||||
(def *limit* 400000)
|
(def *limit* 400000)
|
||||||
@ -154,7 +154,7 @@ Coding Style
|
|||||||
is just because the compiler isn't overly strict. In reality, the
|
is just because the compiler isn't overly strict. In reality, the
|
||||||
correct syntax in places such as this is the latter.
|
correct syntax in places such as this is the latter.
|
||||||
|
|
||||||
.. code-block:: clj
|
.. code-block:: clj
|
||||||
|
|
||||||
;; Bad (and evil)
|
;; Bad (and evil)
|
||||||
(defn foo (x) (print x))
|
(defn foo (x) (print x))
|
||||||
@ -170,7 +170,7 @@ Coding Style
|
|||||||
use them when clarity and readability improves; do not construct
|
use them when clarity and readability improves; do not construct
|
||||||
convoluted, hard to understand expressions.
|
convoluted, hard to understand expressions.
|
||||||
|
|
||||||
.. code-block:: clj
|
.. code-block:: clj
|
||||||
|
|
||||||
;; Preferred
|
;; Preferred
|
||||||
(def *names*
|
(def *names*
|
||||||
@ -190,7 +190,7 @@ Coding Style
|
|||||||
+ Clojure-style dot notation is preferred over the direct call of
|
+ Clojure-style dot notation is preferred over the direct call of
|
||||||
the object's method, though both will continue to be supported.
|
the object's method, though both will continue to be supported.
|
||||||
|
|
||||||
.. code-block:: clj
|
.. code-block:: clj
|
||||||
|
|
||||||
;; Good
|
;; Good
|
||||||
(with [fd (open "/etc/passwd")]
|
(with [fd (open "/etc/passwd")]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user