Skip to content

Commit 856c312

Browse files
committed
maint: update clj-kondo (woot!) and lint script
The lint script now follows clj-kondo docs on bringing in config imports.
1 parent 805e288 commit 856c312

File tree

5 files changed

+25
-12
lines changed

5 files changed

+25
-12
lines changed

bb.edn

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
:leave (let [{:keys [name]} (current-task)] (status/line :detail "\nTASK %s done." name))
1515
;; commands
1616
apply-import-vars {:task apply-import-vars/-main :doc "(check|gen-code) - export APIs statically from templates"}
17-
lint {:task lint/-main :doc "[--rebuild-cache] lint source code using clj-kondo, eastwood, whitespace-linter"}
18-
-lint-kondo {:task lint-kondo/-main :doc "[--rebuild-cache]"}
17+
lint {:task lint/-main :doc "[--rebuild] lint source code using clj-kondo, eastwood, whitespace-linter"}
18+
-lint-kondo {:task lint-kondo/-main :doc "[--rebuild]"}
1919
-lint-eastwood {:task lint-eastwood/-main}
2020
-lint-whitespace {:task lint-whitespace/-main}
2121
test-clj {:task test-clj/-main :doc "[--clojure-version (1.8|1.9|1.10|1.11)]"}

deps.edn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
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.04.25"}}
24+
:clj-kondo {:extra-deps {clj-kondo/clj-kondo {:mvn/version "2022.05.27"}}
2525
:override-deps {org.clojure/clojure {:mvn/version "1.11.1"}}
2626
:main-opts ["-m" "clj-kondo.main"]}
2727

doc/02-developer-guide.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ bb lint
296296
and you can too. The lint script will build the clj-kondo cache when it is missing or stale.
297297
If you want to force a rebuild of the cache run:
298298
----
299-
bb lint --rebuild-cache
299+
bb lint --rebuild
300300
----
301301

302302
https://github.com/borkdude/clj-kondo/blob/master/doc/editor-integration.md[Integrate clj-kondo into your editor] to catch mistakes as they happen.

script/helper/shell.clj

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,12 @@
1919
[nil cmd args])
2020
opts (merge opts default-opts)]
2121
(apply tasks/shell opts cmd args)))
22+
23+
(defn clojure
24+
"Wrap tasks/clojure for my loud error reporting treatment"
25+
[& args]
26+
(let [[opts args] (if (map? (first args))
27+
[(first args) (rest args)]
28+
[nil args])
29+
opts (merge opts default-opts)]
30+
(apply tasks/clojure opts args)))

script/lint_kondo.clj

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,18 @@
1818
(fs/delete-tree clj-kondo-cache)))
1919

2020
(defn- build-cache []
21-
(status/line :detail "Building cache")
2221
(when (cache-exists?)
2322
(delete-cache))
24-
(let [clj-cp (-> (shell/command {:out :string}
25-
"clojure -A:test:lint-cache -Spath")
26-
:out string/trim)
23+
(let [clj-cp (-> (shell/clojure {:out :string}
24+
"-Spath -M:test")
25+
with-out-str
26+
string/trim)
2727
bb-cp (bbcp/get-classpath)]
28-
(shell/command "clojure -M:clj-kondo --dependencies --copy-configs --lint" clj-cp bb-cp)))
28+
29+
(status/line :detail "- copying configs")
30+
(shell/command "clojure -M:clj-kondo --skip-lint --copy-configs --lint" clj-cp bb-cp)
31+
(status/line :detail "- creating cache")
32+
(shell/command "clojure -M:clj-kondo --dependencies --parallel --lint" clj-cp bb-cp)))
2933

3034
(defn- check-cache [{:keys [rebuild-cache]}]
3135
(status/line :head "clj-kondo: cache check")
@@ -58,12 +62,12 @@
5862
(def args-usage "Valid args: [options]
5963
6064
Options:
61-
--rebuild-cache Force rebuild of clj-kondo lint cache.
62-
--help Show this help.")
65+
--rebuild Force rebuild of clj-kondo lint cache.
66+
--help Show this help.")
6367

6468
(defn -main [& args]
6569
(when-let [opts (main/doc-arg-opt args-usage args)]
66-
(lint {:rebuild-cache (get opts "--rebuild-cache")})))
70+
(lint {:rebuild-cache (get opts "--rebuild")})))
6771

6872
(main/when-invoked-as-script
6973
(apply -main *command-line-args*))

0 commit comments

Comments
 (0)