Skip to content
Snippets Groups Projects
Commit abc69576 authored by Simon Belak's avatar Simon Belak
Browse files

Add command line entry point to validate heuristics

parent b2442a80
No related branches found
No related tags found
No related merge requests found
......@@ -10,7 +10,8 @@
"test" ["with-profile" "+expectations" "expectations"]
"generate-sample-dataset" ["with-profile" "+generate-sample-dataset" "run"]
"profile" ["with-profile" "+profile" "run" "profile"]
"h2" ["with-profile" "+h2-shell" "run" "-url" "jdbc:h2:./metabase.db" "-user" "" "-password" "" "-driver" "org.h2.Driver"]}
"h2" ["with-profile" "+h2-shell" "run" "-url" "jdbc:h2:./metabase.db" "-user" "" "-password" "" "-driver" "org.h2.Driver"]
"validate-automagic-dashboards" ["with-profile" "+validate-automagic-dashboards" "run"]}
:dependencies [[org.clojure/clojure "1.8.0"]
[org.clojure/core.async "0.3.442"]
[org.clojure/core.match "0.3.0-alpha4"] ; optimized pattern matching library for Clojure
......@@ -177,4 +178,5 @@
:profile {:jvm-opts ["-XX:+CITime" ; print time spent in JIT compiler
"-XX:+PrintGC"]} ; print a message when garbage collection takes place
;; get the H2 shell with 'lein h2'
:h2-shell {:main org.h2.tools.Shell}})
:h2-shell {:main org.h2.tools.Shell}
:validate-automagic-dashboards {:main metabase.automagic-dashboards.rules}})
(ns metabase.automagic-dashboards.rules
(:require [clojure.string :as str]
[metabase.types]
[metabase.util.schema :as su]
[schema
[coerce :as sc]
......@@ -88,9 +89,9 @@
(defn- ->type
[x]
(cond
(keyword? x) x
(str/starts-with? x "ga:") x
:else (keyword "type" x)))
(keyword? x) x
(ga-dimension? x) x
:else (keyword "type" x)))
(def ^:private rules-validator
(sc/coercer!
......@@ -137,3 +138,7 @@
.getName
(re-find #".+(?=\.yaml)"))))
rules-validator)))))
(defn -main [& _]
(doall (load-rules))
(System/exit 0))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment