clj-commons / clj-commons/formatter
Removing extra whitespace?
- Dominant language
- No language data
- Stars
- 35
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
There are a few places where Clojure programs can accumulate trailing whitespace. In the listings below `|` denotes the end of the line.
**At the ends of lines after source code**
```clj
(def v nil) |
```
**Between lines of source code within a form**
```clj
(defn best-allowed-language [accepts-header available]
(let [accepts (->> (string/split accepts-header #"[\s\r\n]*,[\s\r\n]*")
(map split-qval)
(into {}))
|
score (fn [langtag]
(or
;; "A language-range matches a language-tag if it exactly equals the tag"
...
```
**At the end of a source code file**
```clj
(def v nil)
|
```
Different programmers and editors have different behaviour for how they treat extra whitespace. This can lead to churn in source control diffs when different programmers work on the same file. I think it would be beneficial for this spec to define a policy for handling extra whitespace. I'm personally in favour of removing all three kinds of whitespace, but would like to open this up for discussion.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.