Skip to content

Commit 4e73fbf

Browse files
authored
internal, test and ci deps: bump (#184)
Of note: - libs tests: zprint 1.2.4 needed a tweak to point to lein-zprint 1.2.4.1 instead of borked lein-zprint 1.2.4 release - temporarily hold back on bumping shadow-cljs, it now has a min jdk11 requirement. I'll rework unit test ci build matrix in a separate PR to support more flexibility in adapting to these types of changes.
1 parent 7557739 commit 4e73fbf

File tree

11 files changed

+210
-25
lines changed

11 files changed

+210
-25
lines changed

.clj-kondo/etaoin/etaoin/config.edn

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{:linters
2+
{:etaoin/with-x-action {:level :error}
3+
:etaoin/binding-sym {:level :error}
4+
:etaoin/opts-map-type {:level :error}
5+
:etaoin/opts-map-pos {:level :error}
6+
:etaoin/empty-opts {:level :warning}}
7+
:hooks
8+
{:analyze-call
9+
{etaoin.api/with-chrome etaoin.api/with-browser
10+
etaoin.api/with-chrome-headless etaoin.api/with-browser
11+
etaoin.api/with-firefox etaoin.api/with-browser
12+
etaoin.api/with-firefox-headless etaoin.api/with-browser
13+
etaoin.api/with-edge etaoin.api/with-browser
14+
etaoin.api/with-edge-headless etaoin.api/with-browser
15+
etaoin.api/with-phantom etaoin.api/with-browser
16+
etaoin.api/with-safari etaoin.api/with-browser
17+
18+
etaoin.api/with-driver etaoin.api/with-driver
19+
etaoin.api/with-key-down etaoin.api/with-key-down
20+
etaoin.api/with-pointer-btn-down etaoin.api/with-pointer-btn-down
21+
22+
;; api2 moves to a more conventional let-ish vector syntax
23+
etaoin.api2/with-chrome etaoin.api2/with-browser
24+
etaoin.api2/with-chrome-headless etaoin.api2/with-browser
25+
etaoin.api2/with-edge etaoin.api2/with-browser
26+
etaoin.api2/with-edge-headless etaoin.api2/with-browser
27+
etaoin.api2/with-firefox etaoin.api2/with-browser
28+
etaoin.api2/with-firefox-headless etaoin.api2/with-browser
29+
etaoin.api2/with-phantom etaoin.api2/with-browser
30+
etaoin.api2/with-safari etaoin.api2/with-browser}}
31+
:lint-as
32+
{etaoin.api/with-pointer-left-btn-down clojure.core/->}}
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
(ns etaoin.api
2+
(:require [clj-kondo.hooks-api :as api]
3+
[etaoin.hooks-util :as h]))
4+
5+
(defn- nil-node? [n]
6+
(and (api/token-node? n) (nil? (api/sexpr n))))
7+
8+
(defn- with-bound-arg [node arg-offset]
9+
(let [macro-args (rest (:children node))
10+
leading-args (take arg-offset macro-args)
11+
interesting-args (drop arg-offset macro-args)
12+
[opts binding-sym & body] (if (h/symbol-node? (second interesting-args))
13+
interesting-args
14+
(cons nil interesting-args))]
15+
;; if the user has specified nil or {} for options we can suggest that is not necessary
16+
(when (and opts
17+
(or (and (api/map-node? opts) (not (seq (:children opts))))
18+
(nil-node? opts)))
19+
(api/reg-finding! (assoc (meta opts)
20+
:message "Empty or nil driver options can be omitted"
21+
:type :etaoin/empty-opts)))
22+
23+
(cond
24+
(not (h/symbol-node? binding-sym))
25+
;; it makes more sense here to report on the incoming node position instead of what we expect to be the binding-sym
26+
(api/reg-finding! (assoc (meta node)
27+
:message "Expected binding symbol for driver"
28+
:type :etaoin/binding-sym))
29+
30+
;; we don't want to explicitly expect a map because the map might come from
31+
;; an evalution, but we can do some checks
32+
(and opts ;; we'll assume a list-node is a function call (eval)
33+
(not (nil-node? opts)) ;; nil is actually old-v1 syntax acceptable
34+
(not (api/list-node? opts)) ;; some fn call
35+
(not (h/symbol-node? opts)) ;; from a binding maybe
36+
;; there are other eval node types... @(something) for example... maybe we'll add them in if folks ask
37+
(not (api/map-node? opts)))
38+
;; we can report directly on the opts node, because at this point we know we expect
39+
;; this arg position to be an opts map
40+
(api/reg-finding! (assoc (meta opts)
41+
:message "When specified, opts should be a map"
42+
:type :etaoin/opts-map-type))
43+
44+
;; one last nicety, if the first form in body is a map, the user has accidentally swapped
45+
;; binding and opt args
46+
(api/map-node? (first body))
47+
(api/reg-finding! (assoc (meta (first body))
48+
:message "When specified, opts must appear before binding symbol"
49+
:type :etaoin/opts-map-pos))
50+
51+
:else
52+
{:node (api/list-node
53+
(list*
54+
(api/token-node 'let)
55+
;; simulate the effect, macro is creating a new thing (driver for example)
56+
;; via binding it. I don't think the bound value matters for the linting process
57+
(api/vector-node [binding-sym (api/map-node [])])
58+
;; reference the other args so that they are not linted as unused
59+
(api/vector-node leading-args)
60+
opts ;; might be a binding, so ref it too
61+
body))})))
62+
63+
(defn- with-x-down
64+
"This is somewhat of a maybe an odd duck.
65+
I think it is assumed to be used within a threading macro.
66+
And itself employs a threadfirst macro.
67+
So each body form need to have an action (dummy or not) threaded into it."
68+
[node]
69+
(let [macro-args (rest (:children node))
70+
[input x & body] macro-args
71+
dummy-action (api/map-node [])]
72+
{:node (api/list-node
73+
(apply list*
74+
(api/token-node 'do)
75+
;; reference x and input just in case they contain something lint-relevant
76+
x input
77+
;; dump the body, threading a dummy action in as first arg
78+
(map (fn [body-form]
79+
(cond
80+
;; not certain this is absolutely what we want, but maybe close enough
81+
(h/symbol-node? body-form) (api/list-node (list* body-form dummy-action))
82+
(api/list-node? body-form) (let [children (:children body-form)]
83+
(assoc body-form :children (apply list*
84+
(first children)
85+
dummy-action
86+
(rest children))))
87+
:else
88+
(api/reg-finding! (assoc (meta body-form)
89+
:message "expected to be threaded through an action"
90+
:type :etaoin/with-x-action))))
91+
body)))}))
92+
93+
(defn with-browser
94+
"Covers etaoin.api/with-chrome and all its variants
95+
[opt? bind & body]"
96+
[{:keys [node]}]
97+
(with-bound-arg node 0))
98+
99+
(defn with-driver
100+
"Very similar to with-browser but bound arg is 1 deeper
101+
[type opt? bind & body]"
102+
[{:keys [node]}]
103+
(with-bound-arg node 1))
104+
105+
(defn with-key-down
106+
"[input key & body]"
107+
[{:keys [node]}]
108+
(with-x-down node))
109+
110+
(defn with-pointer-btn-down
111+
"[input button & body]"
112+
[{:keys [node]}]
113+
(with-x-down node))
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
(ns etaoin.api2
2+
(:require [clj-kondo.hooks-api :as api]
3+
[etaoin.hooks-util :as h]))
4+
5+
(defn with-browser
6+
"Newer variants for api2
7+
[[bind & [options]] & body]"
8+
[{:keys [node]}]
9+
(let [macro-args (rest (:children node))
10+
binding-like-vector (first macro-args)]
11+
(if-not (api/vector-node? binding-like-vector)
12+
;; could use clj-kondo findings, but I think this is good for now
13+
(throw (ex-info "Expected vector for first arg" {}))
14+
(let [binding-sym (-> binding-like-vector :children first)]
15+
(if-not (h/symbol-node? binding-sym)
16+
(throw (ex-info "Expected binding symbol for first arg in vector" {}))
17+
(let [other-args (rest binding-like-vector)
18+
body (rest macro-args)]
19+
{:node (api/list-node
20+
(list*
21+
(api/token-node 'let)
22+
;; simulate the effect, macro is creating a new thing (driver for example)
23+
;; via binding it. I don't think the bound value matters for the linting process
24+
(api/vector-node [binding-sym (api/map-node [])])
25+
;; reference the other args so that they are not linted as unused
26+
(api/vector-node other-args)
27+
body))}))))))
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
(ns etaoin.hooks-util
2+
(:require [clj-kondo.hooks-api :as api]))
3+
4+
(defn symbol-node? [node]
5+
(and (api/token-node? node)
6+
(symbol? (api/sexpr node))))

.github/workflows/code-coverage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
java-version: '11'
2626

2727
- name: Install Clojure tools
28-
uses: DeLaGuardo/setup-clojure@7.0
28+
uses: DeLaGuardo/setup-clojure@9.5
2929
with:
3030
cli: 'latest'
3131
bb: 'latest'

.github/workflows/libs-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
restore-keys: ${{ runner.os }}-clj-libs-deps-
2424

2525
- name: Install Clojure tools
26-
uses: DeLaGuardo/setup-clojure@7.0
26+
uses: DeLaGuardo/setup-clojure@9.5
2727
with:
2828
cli: 'latest'
2929
bb: 'latest'
@@ -69,7 +69,7 @@ jobs:
6969
sudo apt-get install -y planck
7070
7171
- name: Install Clojure tools
72-
uses: DeLaGuardo/setup-clojure@7.0
72+
uses: DeLaGuardo/setup-clojure@9.5
7373
with:
7474
cli: 'latest'
7575
bb: 'latest'

.github/workflows/native-image-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
# Install Babashka
4646
#
4747
- name: Install Babashka
48-
uses: DeLaGuardo/setup-clojure@7.0
48+
uses: DeLaGuardo/setup-clojure@9.5
4949
with:
5050
bb: 'latest'
5151

@@ -61,7 +61,7 @@ jobs:
6161
if: matrix.os == 'windows'
6262

6363
- name: Install Clojure (macos, linux)
64-
uses: DeLaGuardo/setup-clojure@7.0
64+
uses: DeLaGuardo/setup-clojure@9.5
6565
with:
6666
cli: 'latest'
6767
if: matrix.os != 'windows'

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
java-version: '11'
3737

3838
- name: Install Clojure tools
39-
uses: DeLaGuardo/setup-clojure@7.0
39+
uses: DeLaGuardo/setup-clojure@9.5
4040
with:
4141
cli: 'latest'
4242
bb: 'latest'

.github/workflows/unit-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ jobs:
7171
# Install Babashka
7272
#
7373
- name: Install Babashka
74-
uses: DeLaGuardo/setup-clojure@7.0
74+
uses: DeLaGuardo/setup-clojure@9.5
7575
with:
7676
bb: 'latest'
7777

@@ -87,7 +87,7 @@ jobs:
8787
if: matrix.os == 'windows'
8888

8989
- name: Install Clojure (macos, linux)
90-
uses: DeLaGuardo/setup-clojure@7.0
90+
uses: DeLaGuardo/setup-clojure@9.5
9191
with:
9292
cli: 'latest'
9393
if: matrix.os != 'windows'

deps.edn

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121
;;
2222
:lint-cache {:replace-paths ["src"]} ;; when building classpath we want to exclude resources
2323
;; so we do not pick up our own clj-kondo config exports
24-
:clj-kondo {:extra-deps {clj-kondo/clj-kondo {:mvn/version "2022.06.22"}}
24+
:clj-kondo {:extra-deps {clj-kondo/clj-kondo {:mvn/version "2022.09.08"}}
2525
:override-deps {org.clojure/clojure {:mvn/version "1.11.1"}}
2626
:main-opts ["-m" "clj-kondo.main"]}
2727

28-
:eastwood {:extra-deps {jonase/eastwood {:mvn/version "1.2.4"}}
28+
:eastwood {:extra-deps {jonase/eastwood {:mvn/version "1.2.5"}}
2929
:main-opts ["-m" "eastwood.lint" {:source-paths ["src"]
3030
:test-paths ["test"]
3131
:add-linters [:performance]
@@ -58,8 +58,8 @@
5858
:extra-paths ["target/test-doc-blocks/test"]}
5959

6060
;; kaocha for testing clojure versions>= v1.9
61-
:kaocha {:extra-deps {lambdaisland/kaocha {:mvn/version "1.68.1059"}
62-
lambdaisland/kaocha-junit-xml {:mvn/version "0.0.76"}
61+
:kaocha {:extra-deps {lambdaisland/kaocha {:mvn/version "1.69.1069"}
62+
lambdaisland/kaocha-junit-xml {:mvn/version "1.16.98"}
6363
lambdaisland/kaocha-cloverage {:mvn/version "1.0.75"}}
6464
:main-opts ["-m" "kaocha.runner"]}
6565

@@ -91,7 +91,7 @@
9191
cli-matic/cli-matic {:mvn/version "0.5.4"}}}
9292

9393
:apply-import-vars {:override-deps {org.clojure/clojure {:mvn/version "1.11.1"}}
94-
:extra-deps {metosin/malli {:mvn/version "0.8.8"}
94+
:extra-deps {metosin/malli {:mvn/version "0.8.9"}
9595
io.aviso/pretty {:mvn/version "1.1.1"}}
9696
:ns-default lread.apply-import-vars}
9797

@@ -115,7 +115,7 @@
115115
:gen-reflection {:main-opts ["-m" "sci-test.generate-reflection-file"]}
116116

117117
;;
118-
;; Document rewrite-clj* differences
118+
;; Document rewrite-clj* differences (needs love!)
119119
;;
120120
:diff-apis {:extra-paths ["script/resources"]
121121
:extra-deps {lread/diff-apis {:git/url "https://github.com/lread/diff-apis"
@@ -127,15 +127,15 @@
127127
;
128128
:build {:deps {io.github.clojure/tools.build {:git/tag "v0.8.3" :git/sha "0d20256"}
129129
slipset/deps-deploy {:mvn/version "0.2.0"}
130-
com.camsaul/whitespace-linter {:mvn/version "2022.01.27.04.43"}}
130+
com.camsaul/whitespace-linter {:mvn/version "2022.07.21.02.09"}}
131131
:extra-paths ["src" "build"]
132132
:ns-default build}
133133

134134
;;
135135
;; Maintenance support
136136
;;
137-
:outdated {:extra-deps {com.github.liquidz/antq {:mvn/version "1.7.804"}
138-
org.slf4j/slf4j-simple {:mvn/version "1.7.36"} ;; to rid ourselves of logger warnings
137+
:outdated {:extra-deps {com.github.liquidz/antq {:mvn/version "2.0.895"}
138+
org.slf4j/slf4j-simple {:mvn/version "2.0.0"} ;; to rid ourselves of logger warnings
139139
}
140140
:override-deps {org.clojure/clojure {:mvn/version "1.11.1"}}
141141
:main-opts ["-m" "antq.core"

0 commit comments

Comments
 (0)