-
Notifications
You must be signed in to change notification settings - Fork 5.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
metabase.xrays
API namespace
#42491
metabase.xrays
API namespace
#42491
Conversation
|
@@ -846,14 +827,14 @@ | |||
;; the following patterns are considered to be test namespaces: | |||
;; | |||
;; - Any namespace ending in `-test` or `-test.whatever` | |||
;; - Any namespace ending in `test-util` | |||
;; - Any namespace containing in `test-util` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
;; - Any namespace containing in `test-util` | |
;; - Any namespace containing `test-util` |
(defn circular-dependencies | ||
"Build a graph of module => set of modules it refers to that also refer to this module." | ||
([] | ||
(let [module->deps (module-dependencies)] | ||
(letfn [(circular-dependency? [module-x module-y] | ||
(and (contains? (get module->deps module-x) module-y) | ||
(contains? (get module->deps module-y) module-x))) | ||
(circular-deps [module] | ||
(let [module-deps (get module->deps module)] | ||
(not-empty (into (sorted-set) | ||
(filter (fn [dep] | ||
(circular-dependency? module dep))) | ||
module-deps))))] | ||
(into (sorted-map) | ||
(keep (fn [module] | ||
(when-let [circular-deps (circular-deps module)] | ||
[module circular-deps]))) | ||
(keys module->deps))))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't matter too much, but you might as well unify the 1-arity variant with the circular-deps
helper as they have the same contract and basically the same name too. The overloaded version will avoid a bunch of necessary calculations, and the code will be a bit less nested too.
Haven't checked this refactor for dumb mistakes.
(defn circular-dependencies | |
"Build a graph of module => set of modules it refers to that also refer to this module." | |
([] | |
(let [module->deps (module-dependencies)] | |
(letfn [(circular-dependency? [module-x module-y] | |
(and (contains? (get module->deps module-x) module-y) | |
(contains? (get module->deps module-y) module-x))) | |
(circular-deps [module] | |
(let [module-deps (get module->deps module)] | |
(not-empty (into (sorted-set) | |
(filter (fn [dep] | |
(circular-dependency? module dep))) | |
module-deps))))] | |
(into (sorted-map) | |
(keep (fn [module] | |
(when-let [circular-deps (circular-deps module)] | |
[module circular-deps]))) | |
(keys module->deps))))) | |
(defn circular-dependencies | |
"Build a graph of module => set of modules it refers to that also refer to this module." | |
([] | |
(let [module->deps (module-dependencies)] | |
(into (sorted-map) | |
(keep (fn [module] | |
(when-let [circular-deps (circular-dependencies module module->deps)] | |
[module circular-deps]))) | |
(keys module->deps)))) | |
([module] | |
(circular-dependencies module (module-dependencies))) | |
([module module->deps] | |
(letfn [(circular-dependency? [module-x module-y] | |
(and (contains? (get module->deps module-x) module-y) | |
(contains? (get module->deps module-y) module-x)))] | |
(not-empty (into (sorted-set) | |
(filter (fn [dep] | |
(circular-dependency? module dep))) | |
(get module->deps module)))))) |
@@ -9,7 +9,7 @@ | |||
[metabase.util :as u] | |||
[metabase.util.malli.schema :as ms])) | |||
|
|||
(defmacro with-dashboard-cleanup | |||
(defmacro with-dashboard-cleanup! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kudos for marking all these helpers
@@ -1,31 +0,0 @@ | |||
(ns metabase.api.transform |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feels good man 🐸
Thanks for the suggestions @crisptrutski, I'll change this stuff in the next PR in the series which has changes to the deps graph stuff anyway |
@camsaul Did you forget to add a milestone to the issue for this PR? When and where should I add a milestone? |
* Remove unused `metabase.api.transform` * Copy the deps graph improvements from my other PR * New combined X-Rays API namespace * Fix kondo error
metabase.transforms
,metabase.domain-entities
, andmetabase.automagic-dashboards
into a singlemetabase.xrays
module./api/transform
endpoint.dev.deps-graph
helpers.