Skip to content

Commit 3ef0481

Browse files
committed
Fix inconsistent formatting with cljfmt
1 parent a66fe9e commit 3ef0481

File tree

26 files changed

+255
-259
lines changed

26 files changed

+255
-259
lines changed

ring-core/src/ring/middleware/cookies.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123
(for [[key value] cookies]
124124
(if (map? value)
125125
(apply str (write-value key (:value value) encoder)
126-
(write-attr-map (dissoc value :value)))
126+
(write-attr-map (dissoc value :value)))
127127
(write-value key value encoder))))
128128

129129
(defn- set-cookies [response encoder]

ring-core/src/ring/middleware/multipart_params/temp_file.clj

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010

1111
(defmacro ^{:private true} do-every [delay & body]
1212
`(background-thread
13-
#(while true
14-
(Thread/sleep ~(with-meta `(* ~delay 1000) {:tag 'long}))
15-
(try ~@body
16-
(catch Exception ex#)))))
13+
#(while true
14+
(Thread/sleep ~(with-meta `(* ~delay 1000) {:tag 'long}))
15+
(try ~@body
16+
(catch Exception ex#)))))
1717

1818
(defn- expired? [^File file expiry-time]
1919
(< (.lastModified file)
@@ -34,14 +34,14 @@
3434
(defn- start-clean-up [file-set expires-in]
3535
(when expires-in
3636
(do-every expires-in
37-
(remove-old-files file-set expires-in))))
37+
(remove-old-files file-set expires-in))))
3838

3939
(defn- ensure-shutdown-clean-up [file-set]
4040
(.addShutdownHook
41-
(Runtime/getRuntime)
42-
(Thread.
43-
#(doseq [^File file @file-set]
44-
(.delete file)))))
41+
(Runtime/getRuntime)
42+
(Thread.
43+
#(doseq [^File file @file-set]
44+
(.delete file)))))
4545

4646
(defn temp-file-store
4747
"Returns a function that stores multipart file parameters as temporary files.
@@ -60,13 +60,13 @@
6060
{:arglists '([] [options])}
6161
([] (temp-file-store {:expires-in 3600}))
6262
([{:keys [expires-in]}]
63-
(let [file-set (atom #{})
64-
clean-up (delay (start-clean-up file-set expires-in))]
65-
(ensure-shutdown-clean-up file-set)
66-
(fn [item]
67-
(force clean-up)
68-
(let [temp-file (make-temp-file file-set)]
69-
(io/copy (:stream item) temp-file)
70-
(-> (select-keys item [:filename :content-type])
71-
(assoc :tempfile temp-file
72-
:size (.length temp-file))))))))
63+
(let [file-set (atom #{})
64+
clean-up (delay (start-clean-up file-set expires-in))]
65+
(ensure-shutdown-clean-up file-set)
66+
(fn [item]
67+
(force clean-up)
68+
(let [temp-file (make-temp-file file-set)]
69+
(io/copy (:stream item) temp-file)
70+
(-> (select-keys item [:filename :content-type])
71+
(assoc :tempfile temp-file
72+
:size (.length temp-file))))))))

ring-core/src/ring/middleware/nested_params.clj

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,22 +38,22 @@
3838
"Return a list of name-value pairs for a parameter map."
3939
[params]
4040
(mapcat
41-
(fn [[name value]]
42-
(if (and (sequential? value) (not (coll? (first value))))
43-
(for [v value] [name v])
44-
[[name value]]))
45-
params))
41+
(fn [[name value]]
42+
(if (and (sequential? value) (not (coll? (first value))))
43+
(for [v value] [name v])
44+
[[name value]]))
45+
params))
4646

4747
(defn- nest-params
4848
"Takes a flat map of parameters and turns it into a nested map of
4949
parameters, using the function parse to split the parameter names
5050
into keys."
5151
[params parse]
5252
(reduce
53-
(fn [m [k v]]
54-
(assoc-nested m (parse k) v))
55-
{}
56-
(param-pairs params)))
53+
(fn [m [k v]]
54+
(assoc-nested m (parse k) v))
55+
{}
56+
(param-pairs params)))
5757

5858
(defn nested-params-request
5959
"Converts a request with a flat map of parameters to a nested map.

ring-core/src/ring/middleware/session.clj

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
(defn- bare-session-response
4545
[response {session-key :session/key} {:keys [store cookie-name cookie-attrs]}]
4646
(let [new-session-key (if (contains? response :session)
47-
(if-let [session (response :session)]
47+
(if-let [session (response :session)]
4848
(if (:recreate (meta session))
4949
(do
5050
(store/delete-session store session-key)
@@ -103,17 +103,17 @@
103103
:set-cookies? - If true, automatically include cookie middleware. Defaults to
104104
true for backward compatibility."
105105
([handler]
106-
(wrap-session handler {}))
106+
(wrap-session handler {}))
107107
([handler options]
108-
(let [options (session-options options)]
109-
(fn
110-
([request]
111-
(let [request (session-request request options)]
112-
(-> (handler request)
113-
(session-response request options))))
114-
([request respond raise]
115-
(let [request (session-request request options)]
116-
(handler request
117-
(fn [response]
118-
(respond (session-response response request options)))
119-
raise)))))))
108+
(let [options (session-options options)]
109+
(fn
110+
([request]
111+
(let [request (session-request request options)]
112+
(-> (handler request)
113+
(session-response request options))))
114+
([request respond raise]
115+
(let [request (session-request request options)]
116+
(handler request
117+
(fn [response]
118+
(respond (session-response response request options)))
119+
raise)))))))

ring-core/src/ring/middleware/session/cookie.clj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@
4242
iv (random/bytes (.getBlockSize cipher))]
4343
(.init cipher Cipher/ENCRYPT_MODE secret-key (IvParameterSpec. iv))
4444
(->> (.doFinal cipher data)
45-
(concat iv)
46-
(byte-array))))
45+
(concat iv)
46+
(byte-array))))
4747

4848
(defn- decrypt
4949
"Decrypt an array of bytes with a key."
@@ -121,6 +121,6 @@
121121
clojure.core/print-method or clojure.core/print-dup multimethods."
122122
([] (cookie-store {}))
123123
([options]
124-
(let [key (get-secret-key options)]
125-
(assert (valid-secret-key? key) "the secret key must be exactly 16 bytes")
126-
(CookieStore. key options))))
124+
(let [key (get-secret-key options)]
125+
(assert (valid-secret-key? key) "the secret key must be exactly 16 bytes")
126+
(CookieStore. key options))))

ring-core/src/ring/util/io.clj

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
"Utility functions for handling I/O."
33
(:require [clojure.java.io :as io])
44
(:import [java.io PipedInputStream
5-
PipedOutputStream
6-
ByteArrayInputStream
7-
File
8-
Closeable
9-
IOException]))
5+
PipedOutputStream
6+
ByteArrayInputStream
7+
File
8+
Closeable
9+
IOException]))
1010

1111
(defn piped-input-stream
1212
"Create an input stream from a function that takes an output stream as its
@@ -33,9 +33,9 @@
3333
"Returns a ByteArrayInputStream for the given String."
3434
{:added "1.1"}
3535
([^String s]
36-
(ByteArrayInputStream. (.getBytes s)))
36+
(ByteArrayInputStream. (.getBytes s)))
3737
([^String s ^String encoding]
38-
(ByteArrayInputStream. (.getBytes s encoding))))
38+
(ByteArrayInputStream. (.getBytes s encoding))))
3939

4040
(defn close!
4141
"Ensure a stream is closed, swallowing any exceptions."

ring-core/src/ring/util/mime_type.clj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
"Get the mimetype from the filename extension. Takes an optional map of
112112
extensions to mimetypes that overrides values in the default-mime-types map."
113113
([filename]
114-
(ext-mime-type filename {}))
114+
(ext-mime-type filename {}))
115115
([filename mime-types]
116-
(let [mime-types (merge default-mime-types mime-types)]
117-
(mime-types (filename-ext filename)))))
116+
(let [mime-types (merge default-mime-types mime-types)]
117+
(mime-types (filename-ext filename)))))

ring-core/src/ring/util/request.clj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,5 +81,5 @@
8181
[request ^String context]
8282
{:pre [(in-context? request context)]}
8383
(assoc request
84-
:context context
85-
:path-info (subs (:uri request) (.length context))))
84+
:context context
85+
:path-info (subs (:uri request) (.length context))))

ring-core/src/ring/util/response.clj

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@
4040
{:added "1.2"}
4141
([url] (created url nil))
4242
([url body]
43-
{:status 201
44-
:headers {"Location" url}
45-
:body body}))
43+
{:status 201
44+
:headers {"Location" url}
45+
:body body}))
4646

4747
(defn bad-request
4848
"Returns a 400 'bad request' response."
@@ -126,9 +126,9 @@
126126
(if-let [^File file (safely-find-file path opts)]
127127
(cond
128128
(.isDirectory file)
129-
(and (:index-files? opts true) (find-index-file file))
129+
(and (:index-files? opts true) (find-index-file file))
130130
(.exists file)
131-
file)))
131+
file)))
132132

133133
(defn- file-data [^File file]
134134
{:content file
@@ -214,10 +214,10 @@
214214
{:added "1.1"}
215215
[resp charset]
216216
(update-header resp "Content-Type"
217-
(fn [content-type]
218-
(-> (or content-type "text/plain")
219-
(str/replace #";\s*charset=[^;]*" "")
220-
(str "; charset=" charset)))))
217+
(fn [content-type]
218+
(-> (or content-type "text/plain")
219+
(str/replace #";\s*charset=[^;]*" "")
220+
(str "; charset=" charset)))))
221221

222222
(defn get-charset
223223
"Gets the character encoding of a Ring response."

ring-core/test/ring/middleware/test/content_type.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,6 @@
6969
(deftest content-type-response-test
7070
(testing "function exists"
7171
(is (fn? content-type-response)))
72-
72+
7373
(testing "nil response"
7474
(is (nil? (content-type-response nil {})))))

0 commit comments

Comments
 (0)