Skip to content

Commit c7cf308

Browse files
authored
maintenance (#85)
* ci: bump github actions * test, dev: bump clojure to 1.12.2 * lint: bump kondo, update lib imports * dev: bump clojure tools build * dev: bump babashka fs * test: update 404 sanity test Hitting the real world in tests can stop working when the real world changes. Hit httpbin.org instead. Can adjust if httpbin.org turns out to be not reliable.
1 parent 27c8275 commit c7cf308

File tree

7 files changed

+99
-16
lines changed

7 files changed

+99
-16
lines changed
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{:hooks
22
{:analyze-call
3-
{taoensso.encore/defalias taoensso.encore/defalias
4-
taoensso.encore/defn-cached taoensso.encore/defn-cached
5-
taoensso.encore/defonce taoensso.encore/defonce}}}
3+
{taoensso.encore/defalias taoensso.encore-hooks/defalias
4+
taoensso.encore/defaliases taoensso.encore-hooks/defaliases
5+
taoensso.encore/defn-cached taoensso.encore-hooks/defn-cached
6+
taoensso.encore/defonce taoensso.encore-hooks/defonce}}}
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
(ns taoensso.encore-hooks
2+
"I don't personally use clj-kondo, so these hooks are
3+
kindly authored and maintained by contributors.
4+
PRs very welcome! - Peter Taoussanis"
5+
(:refer-clojure :exclude [defonce])
6+
(:require
7+
[clj-kondo.hooks-api :as hooks]))
8+
9+
(defn defalias
10+
[{:keys [node]}]
11+
(let [[alias src-raw _attrs body] (rest (:children node))
12+
src (or src-raw alias)
13+
sym (if src-raw (hooks/sexpr alias) (symbol (name (hooks/sexpr src))))]
14+
{:node
15+
(with-meta
16+
(hooks/list-node
17+
[(hooks/token-node 'def)
18+
(hooks/token-node sym)
19+
(if body
20+
(hooks/list-node
21+
;; use :body in the def to avoid unused import/private var warnings
22+
[(hooks/token-node 'or) body src])
23+
src)])
24+
(meta src))}))
25+
26+
(defn defaliases
27+
[{:keys [node]}]
28+
(let [alias-nodes (rest (:children node))]
29+
{:node
30+
(hooks/list-node
31+
(into
32+
[(hooks/token-node 'do)]
33+
(map
34+
(fn alias->defalias [alias-node]
35+
(cond
36+
(hooks/token-node? alias-node)
37+
(hooks/list-node
38+
[(hooks/token-node 'taoensso.encore/defalias)
39+
alias-node])
40+
41+
(hooks/map-node? alias-node)
42+
(let [{:keys [src alias attrs body]} (hooks/sexpr alias-node)
43+
;; workaround as can't seem to (get) using a token-node
44+
;; and there's no update-keys (yet) in sci apparently
45+
[& {:as node-as-map}] (:children alias-node)
46+
{:keys [attrs body]} (zipmap (map hooks/sexpr (keys node-as-map))
47+
(vals node-as-map))]
48+
(hooks/list-node
49+
[(hooks/token-node 'taoensso.encore/defalias)
50+
(or alias src) (hooks/token-node src) attrs body])))))
51+
alias-nodes))}))
52+
53+
(defn defn-cached
54+
[{:keys [node]}]
55+
(let [[sym _opts binding-vec & body] (rest (:children node))]
56+
{:node
57+
(hooks/list-node
58+
(list
59+
(hooks/token-node 'def)
60+
sym
61+
(hooks/list-node
62+
(list*
63+
(hooks/token-node 'fn)
64+
binding-vec
65+
body))))}))
66+
67+
(defn defonce
68+
[{:keys [node]}]
69+
;; args = [sym doc-string? attr-map? init-expr]
70+
(let [[sym & args] (rest (:children node))
71+
[doc-string args] (if (and (hooks/string-node? (first args)) (next args)) [(hooks/sexpr (first args)) (next args)] [nil args])
72+
[attr-map init-expr] (if (and (hooks/map-node? (first args)) (next args)) [(hooks/sexpr (first args)) (fnext args)] [nil (first args)])
73+
74+
attr-map (if doc-string (assoc attr-map :doc doc-string) attr-map)
75+
sym+meta (if attr-map (with-meta sym attr-map) sym)
76+
rewritten
77+
(hooks/list-node
78+
[(hooks/token-node 'clojure.core/defonce)
79+
sym+meta
80+
init-expr])]
81+
82+
{:node rewritten}))

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515

1616
steps:
1717
- name: Checkout
18-
uses: actions/checkout@v4
18+
uses: actions/checkout@v5
1919

2020
- name: Setup
2121
uses: ./.github/workflows/shared-setup

.github/workflows/shared-setup/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ runs:
2424
restore-keys: cljdeps-
2525

2626
- name: Setup Java
27-
uses: actions/setup-java@v4
27+
uses: actions/setup-java@v5
2828
with:
2929
distribution: 'temurin'
3030
java-version: ${{ inputs.jdk }}

.github/workflows/tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313

1414
steps:
1515
- name: Checkout
16-
uses: actions/checkout@v4
16+
uses: actions/checkout@v5
1717

1818
- name: Setup
1919
uses: ./.github/workflows/shared-setup
@@ -36,7 +36,7 @@ jobs:
3636

3737
steps:
3838
- name: Checkout
39-
uses: actions/checkout@v4
39+
uses: actions/checkout@v5
4040

4141
- name: Setup
4242
uses: ./.github/workflows/shared-setup
@@ -58,7 +58,7 @@ jobs:
5858

5959
steps:
6060
- name: Checkout
61-
uses: actions/checkout@v4
61+
uses: actions/checkout@v5
6262

6363
- name: Setup
6464
uses: ./.github/workflows/shared-setup

deps.edn

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@
99
:1.9 {:override-deps {org.clojure/clojure {:mvn/version "1.9.0"}}}
1010
:1.10 {:override-deps {org.clojure/clojure {:mvn/version "1.10.3"}}}
1111
:1.11 {:override-deps {org.clojure/clojure {:mvn/version "1.11.4"}}}
12-
:1.12 {:override-deps {org.clojure/clojure {:mvn/version "1.12.1"}}}
12+
:1.12 {:override-deps {org.clojure/clojure {:mvn/version "1.12.2"}}}
1313
:build
1414
{:extra-paths ["build"]
15-
:deps {io.github.clojure/tools.build {:mvn/version "0.10.9"}
15+
:deps {io.github.clojure/tools.build {:mvn/version "0.10.10"}
1616
slipset/deps-deploy {:mvn/version "0.2.2"}}
1717
:ns-default build}
1818
:http-server ;; used for to support integration tests
1919
{:extra-paths ["test" "test-resources"]
20-
:override-deps {org.clojure/clojure {:mvn/version "1.12.1"}}
21-
:extra-deps {babashka/fs {:mvn/version "0.5.25"}
20+
:override-deps {org.clojure/clojure {:mvn/version "1.12.2"}}
21+
:extra-deps {babashka/fs {:mvn/version "0.5.26"}
2222
ring/ring-jetty-adapter {:mvn/version "1.10.0"} ;; stick with version that works on jdk8
2323
ch.qos.logback/logback-classic {:mvn/version "1.3.15"
2424
:exclusions [org.slf4j/slf4j-api]}
@@ -32,11 +32,11 @@
3232
{:git/tag "v0.5.1" :git/sha "dfb30dd"}}
3333
:main-opts ["-m" "cognitect.test-runner"]}
3434
;; for consistent linting we use a specific version of clj-kondo through the jvm
35-
:clj-kondo {:extra-deps {clj-kondo/clj-kondo {:mvn/version "2025.06.05"}}
36-
:override-deps {org.clojure/clojure {:mvn/version "1.12.1"}}
35+
:clj-kondo {:extra-deps {clj-kondo/clj-kondo {:mvn/version "2025.07.28"}}
36+
:override-deps {org.clojure/clojure {:mvn/version "1.12.2"}}
3737
:main-opts ["-m" "clj-kondo.main"]}
3838
:outdated {:extra-deps {com.github.liquidz/antq {:mvn/version "2.11.1276"}
39-
org.clojure/clojure {:mvn/version "1.12.1"}
39+
org.clojure/clojure {:mvn/version "1.12.2"}
4040
org.slf4j/slf4j-simple {:mvn/version "2.0.17"} ;; to rid ourselves of logger warnings
4141
}
4242
:main-opts ["-m" "antq.core"

test/clj_http/lite/client_sanity_test.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
:throw-exceptions false})))))
2727

2828
(deftest exception-test
29-
(try (client/get "https://site.com/broken")
29+
(try (client/get "https://httpbin.org/status/404")
3030
(is false "should not reach here")
3131
(catch Exception e
3232
(is (:headers (ex-data e))))))

0 commit comments

Comments
 (0)