mirror of https://github.com/logseq/logseq
enhance(dev): extend fast kondo lint to run across all kondo dirs
parent
9779c59874
commit
e16c880280
|
@ -22,18 +22,25 @@
|
||||||
(shell cmd)))
|
(shell cmd)))
|
||||||
|
|
||||||
(defn kondo-git-changes
|
(defn kondo-git-changes
|
||||||
"Run clj-kondo only for files that git diff detects as changed and unstaged"
|
"Run clj-kondo across dirs and only for files that git diff detects as unstaged changes"
|
||||||
[]
|
[]
|
||||||
(let [files (->> (shell {:out :string} "git diff --name-only")
|
(let [kondo-dirs ["src" "deps/common" "deps/db" "deps/graph-parser" "deps/outliner" "deps/publishing"]
|
||||||
:out
|
dir-regex (re-pattern (str "^(" (string/join "|" kondo-dirs) ")"))
|
||||||
string/split-lines
|
dir-to-files (->> (shell {:out :string} "git diff --name-only")
|
||||||
(filter #(string/starts-with? % "src")))]
|
:out
|
||||||
(if (seq files)
|
string/split-lines
|
||||||
(let [cmd (str "clj-kondo --lint " (string/join " " files))
|
(group-by #(first (re-find dir-regex %)))
|
||||||
_ (println cmd)
|
;; remove files that aren't in a kondo dir
|
||||||
res (apply shell {:continue :true} "clj-kondo --lint" files)]
|
((fn [x] (dissoc x nil))))]
|
||||||
(System/exit (:exit res)))
|
(if (seq dir-to-files)
|
||||||
(println "No files have changed to lint."))))
|
(doseq [[dir* files*] dir-to-files]
|
||||||
|
(let [dir (if (= dir* "src") "." dir*)
|
||||||
|
files (mapv #(string/replace-first % (str dir "/") "") files*)
|
||||||
|
cmd (str "cd " dir " && clj-kondo --lint " (string/join " " files))
|
||||||
|
_ (println cmd)
|
||||||
|
res (apply shell {:dir dir :continue :true} "clj-kondo --lint" files)]
|
||||||
|
(when (pos? (:exit res)) (System/exit (:exit res)))))
|
||||||
|
(println "No files have changed to lint."))))
|
||||||
|
|
||||||
(defn- validate-frontend-not-in-worker
|
(defn- validate-frontend-not-in-worker
|
||||||
[]
|
[]
|
||||||
|
|
Loading…
Reference in New Issue