diff options
| author | eltrac <hi@eltr.ac> | 2026-10-13 21:27:29 +0800 |
|---|---|---|
| committer | eltrac <hi@eltr.ac> | 2026-10-13 21:27:29 +0800 |
| commit | 3989bf6fbbb242ad5bd6a1d1f91f70a6a222f8e2 (patch) | |
| tree | 435dfee792ec80de7b4cfc233efd53fab579529e /scripts | |
| parent | 29344c41cc11c2d5d34bdfdbcfb8d093fad1002a (diff) | |
style: cljfmt everything
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/ci/coverage_badge.clj | 36 | ||||
| -rw-r--r-- | scripts/recalculate-hashes.clj | 22 |
2 files changed, 29 insertions, 29 deletions
diff --git a/scripts/ci/coverage_badge.clj b/scripts/ci/coverage_badge.clj index a8a0948..4cb5947 100644 --- a/scripts/ci/coverage_badge.clj +++ b/scripts/ci/coverage_badge.clj @@ -7,25 +7,25 @@ (def cloverage-output "target/coverage/index.html")
(def coverage (let [rows (-> cloverage-output
- slurp
- h/parse
- h/as-hickory
- :content first ;; get <html>
- :content (nth 3) ;; get <body>
- :content second ;; get <table>
- :content last ;; get <tbody>
- :content)
- total-row (->> rows
- (map :content)
- (filter sequential?)
- (filter #(= "Totals:" (get-in % [0 :content 0])))
- first
- (filter map?))]
+ slurp
+ h/parse
+ h/as-hickory
+ :content first ;; get <html>
+ :content (nth 3) ;; get <body>
+ :content second ;; get <table>
+ :content last ;; get <tbody>
+ :content)
+ total-row (->> rows
+ (map :content)
+ (filter sequential?)
+ (filter #(= "Totals:" (get-in % [0 :content 0])))
+ first
+ (filter map?))]
(-> total-row
- (nth 2)
- :content
- first
- (string/replace " " ""))))
+ (nth 2)
+ :content
+ first
+ (string/replace " " ""))))
;; "25" will make "%25" which decoded to "%", removing it will result in a Bad Request
(def badge-url (str "https://img.shields.io/badge/coverage-" coverage "25-green"))
(def badge-html
diff --git a/scripts/recalculate-hashes.clj b/scripts/recalculate-hashes.clj index b42a0d1..67c0251 100644 --- a/scripts/recalculate-hashes.clj +++ b/scripts/recalculate-hashes.clj @@ -24,11 +24,11 @@ (->> (line-seq r) (map edn/read-string) f))) -(defn- java-digest [^String s algo] - (let [algorithm (MessageDigest/getInstance algo) - raw-bytes (.digest algorithm (.getBytes s "UTF-8"))] +(defn- java-digest [^String s algo] + (let [algorithm (MessageDigest/getInstance algo) + raw-bytes (.digest algorithm (.getBytes s "UTF-8"))] (apply str (map #(format "%02x" %) raw-bytes)))) -(defn digest +(defn digest ([s] (digest s :sha-256 32)) ([s algo] @@ -45,16 +45,16 @@ ;; end (let [[datafile] *command-line-args*] - (with-webmentions datafile + (with-webmentions datafile (fn [wms] (println "starting reading, total count:" (count wms)) (->> wms (map (fn [wm] - (let [webmention (:webmention wm) - source (:source webmention) - target (:target webmention) - new-id (digest (str source target))] - (println new-id) - (assoc wm :webmention (assoc webmention :id new-id))))) + (let [webmention (:webmention wm) + source (:source webmention) + target (:target webmention) + new-id (digest (str source target))] + (println new-id) + (assoc wm :webmention (assoc webmention :id new-id))))) (unload-data datafile)) (println "complete!")))) |
