Skip to content

Commit 0c845ea

Browse files
authored
maintenance (#415)
* maint: test: bump test.check * maint: test libs: bump cljfmt And adjust test cmd to match its current CI. * maint: test libs: bump clojure-lsp * maint: test: bump shadow-cljs * maint: ci: bump checkout action * maint: update clj-kondo lib imports
1 parent 08d3c70 commit 0c845ea

File tree

12 files changed

+57
-18
lines changed

12 files changed

+57
-18
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
(ns babashka.fs
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))))
7+
8+
(defn with-temp-dir
9+
[{:keys [node]}]
10+
(let [args (rest (:children node))
11+
binding-like-vector (first args)
12+
body (rest args)]
13+
(when-not (zero? (count args)) ;; let clj-kondo report on arity
14+
(if-not (api/vector-node? binding-like-vector)
15+
(api/reg-finding! (assoc (meta binding-like-vector)
16+
:message "babashka.fs/with-temp-dir requires a vector for first arg"
17+
:type :babashka-fs/with-temp-dir-first-arg-not-vector))
18+
(let [[binding-sym options & rest-in-vec] (:children binding-like-vector)]
19+
(when (not (symbol-node? binding-sym))
20+
(api/reg-finding! (assoc (meta (or binding-sym binding-like-vector))
21+
:message "babashka.fs/with-temp-dir vector arg requires binding-name symbol as first value"
22+
:type :babashka-fs/with-temp-dir-vector-arg-needs-binding-symbol)))
23+
(doseq [extra-vector-arg rest-in-vec]
24+
(api/reg-finding! (assoc (meta extra-vector-arg)
25+
:message "babashka.fs/with-temp-dir vector arg accepts at most 2 values"
26+
:type :babashka-fs/with-temp-dir-vector-arg-extra-value)))
27+
28+
(when binding-sym
29+
{:node (api/list-node
30+
;; satisfy linter by creating binding for for binding-sym
31+
(list*
32+
(api/token-node 'let)
33+
;; it doesn't really matter what we bind to, so long as it is bound
34+
(api/vector-node [binding-sym (api/token-node nil)])
35+
options ;; avoid unused binding when options is a binding
36+
body))}))))))
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
{:lint-as {babashka.fs/with-temp-dir clojure.core/let}}
1+
{:linters {:babashka-fs/with-temp-dir-first-arg-not-vector {:level :error}
2+
:babashka-fs/with-temp-dir-vector-arg-needs-binding-symbol {:level :error}
3+
:babashka-fs/with-temp-dir-vector-arg-extra-value {:level :error}}
4+
:hooks {:analyze-call {babashka.fs/with-temp-dir babashka.fs/with-temp-dir}}}

.github/workflows/code-coverage.yml

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

1212
steps:
1313
- name: Checkout
14-
uses: actions/checkout@v5
14+
uses: actions/checkout@v6
1515

1616
- name: Setup
1717
uses: ./.github/workflows/shared-setup

.github/workflows/libs-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919

2020
steps:
2121
- name: Checkout
22-
uses: actions/checkout@v5
22+
uses: actions/checkout@v6
2323

2424
- name: Setup
2525
uses: ./.github/workflows/shared-setup
@@ -41,7 +41,7 @@ jobs:
4141

4242
steps:
4343
- name: Checkout
44-
uses: actions/checkout@v5
44+
uses: actions/checkout@v6
4545
with:
4646
fetch-depth: 0
4747

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
if: matrix.os == 'windows'
3333

3434
- name: Checkout
35-
uses: actions/checkout@v5
35+
uses: actions/checkout@v6
3636

3737
- name: Setup
3838
uses: ./.github/workflows/shared-setup

.github/workflows/publish.yml

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

2020
steps:
2121
- name: Checkout
22-
uses: actions/checkout@v5
22+
uses: actions/checkout@v6
2323

2424
- name: Setup
2525
uses: ./.github/workflows/shared-setup

.github/workflows/unit-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919

2020
steps:
2121
- name: Checkout
22-
uses: actions/checkout@v5
22+
uses: actions/checkout@v6
2323

2424
- name: Setup
2525
uses: ./.github/workflows/shared-setup
@@ -48,7 +48,7 @@ jobs:
4848
if: matrix.os == 'windows'
4949

5050
- name: Checkout
51-
uses: actions/checkout@v5
51+
uses: actions/checkout@v6
5252

5353
- name: Setup
5454
uses: ./.github/workflows/shared-setup

deps.edn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
;; Test support
7979
;;
8080

81-
:test-common {:extra-deps {org.clojure/test.check {:mvn/version "1.1.1"}}
81+
:test-common {:extra-deps {org.clojure/test.check {:mvn/version "1.1.2"}}
8282
:extra-paths ["test"]}
8383

8484
:test-isolated {:extra-paths ["test-isolated"]}

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
"karma-cljs-test": "0.1.0",
77
"karma-junit-reporter": "2.0.1",
88
"karma-spec-reporter": "0.0.36",
9-
"shadow-cljs": "3.2.1"
9+
"shadow-cljs": "3.3.1"
1010
}
1111
}

0 commit comments

Comments
 (0)