-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbb.edn
37 lines (34 loc) · 1.81 KB
/
bb.edn
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
{:paths ["script"]
:deps {lread/status-line {:git/url "https://github.com/lread/status-line.git"
:sha "cf44c15f30ea3867227fa61ceb823e5e942c707f"}}
:tasks {;; setup
:requires ([babashka.fs :as fs]
[clojure.string :as string]
[lread.status-line :as status])
:enter (let [name (:name (current-task))] (status/line :head "TASK %s" name))
:leave (let [name (:name (current-task))] (status/line :detail "\nTASK %s done." name))
;; commands
lint
{:doc "lint source code using clj-kondo"
:task (do
(when (not (fs/exists? ".clj-kondo/.cache"))
(status/line :head "Building clj-kondo cache")
(let [cp (-> (shell {:out :string} "clojure -Spath -M:test")
:out)]
(shell "clojure -M:clj-kondo --dependencies --copy-configs --lint" cp)))
(status/line :head "Linting")
(let [{:keys [exit]}
(shell {:continue true}
"clojure -M:clj-kondo --lint src test bb.edn deps.edn")]
(cond
(= 2 exit) (status/die exit "clj-kondo found one or more lint errors")
(= 3 exit) (status/die exit "clj-kondo found one or more lint warnings")
(> exit 0) (status/die exit "clj-kondo returned unexpected exit code"))))}
test
{:doc "cljdoc-analyzer unit tests"
:task (shell "clojure -M:test" "--reporter" "documentation")}
outdated
{:doc "report on outdated dependencies"
:task (do
(status/line :head "Checking Clojure deps")
(shell {:continue true} "clojure -M:outdated"))}}}