From 8638a4a002f0a0f75d3b6522a9f63f78fafe4919 Mon Sep 17 00:00:00 2001 From: Hugo Duncan Date: Tue, 3 Jun 2014 11:52:29 -0400 Subject: [PATCH] Add a whitelist for info keys on var metadata When generating a map for info on a var, whitelist the keys that may appear. Address cider #588 --- src/cider/nrepl/middleware/info.clj | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/cider/nrepl/middleware/info.clj b/src/cider/nrepl/middleware/info.clj index 6bfff7436..86e757413 100644 --- a/src/cider/nrepl/middleware/info.clj +++ b/src/cider/nrepl/middleware/info.clj @@ -17,9 +17,17 @@ :line (:line prot-meta)}) info)) +(def var-meta-whitelist + [:ns :name :doc :file :arglists :macro :protocol :line :column :static :added :resource]) + +(defn- map-seq [x] + (if (seq x) + x + nil)) + (defn var-meta [v] - (-> v meta maybe-protocol)) + (-> v meta maybe-protocol (select-keys var-meta-whitelist) map-seq)) (defn ns-meta [ns]