Find namespaces for nbb-compatible CI step

This commit is contained in:
Gabriel Horner
2022-04-26 17:15:26 -04:00
parent 8b9c64af6e
commit d6082156c5
6 changed files with 36 additions and 4 deletions

View File

@@ -0,0 +1,24 @@
(ns logseq.tasks.nbb
(:require [pod.borkdude.clj-kondo :as clj-kondo]))
(defn- fetch-meta-namespaces
"Return namespaces with metadata"
[paths]
(let [paths (or (seq paths) ["src"])
{{:keys [namespace-definitions]} :analysis}
(clj-kondo/run!
{:lint paths
:config {:output {:analysis {:namespace-definitions {:meta true}}}}})
matches (keep (fn [m]
(when (:meta m)
{:ns (:name m)
:meta (:meta m)}))
namespace-definitions)]
matches))
(defn load-compatible-namespaces
[]
(let [namespaces (filter #(get-in % [:meta :nbb-compatible])
(fetch-meta-namespaces ["src/main"]))]
(assert (seq namespaces)
"There must be some nbb-compatible namespaces")))