Skip to content

Commit

Permalink
(PE-39250) Remove project APIs and configuration
Browse files Browse the repository at this point in the history
Removes access to file_metadata and compile options which allowed
fetching data and compiling for bolt projects. This commit does not
remove all project based code, it is restricted to covering enough
ground to remove access to any functionality, but there may still be
some internal code left over.
  • Loading branch information
mcdonaldseanp committed Oct 11, 2024
1 parent 035bd05 commit 6bb7e31
Show file tree
Hide file tree
Showing 10 changed files with 62 additions and 682 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
(ns clj-kondo.slingshot.try-plus
(:require [clj-kondo.hooks-api :as api]))

(defn expand-catch [catch-node]
(let [[catch catchee & exprs] (:children catch-node)
catchee-sexpr (api/sexpr catchee)]
(cond (vector? catchee-sexpr)
(let [[selector & exprs] exprs]
(api/list-node
[catch (api/token-node 'Exception) (api/token-node '_e#)
(api/list-node
(list* (api/token-node 'let)
(api/vector-node [selector (api/token-node nil)])
exprs))]))
:else catch-node)))

(defn try+ [{:keys [node]}]
(let [children (rest (:children node))
[body catches]
(loop [body children
body-exprs []
catches []]
(if (seq body)
(let [f (first body)
f-sexpr (api/sexpr f)]
(if (and (seq? f-sexpr) (= 'catch (first f-sexpr)))
(recur (rest body)
body-exprs
(conj catches (expand-catch f)))
(recur (rest body)
(conj body-exprs f)
catches)))
[body-exprs catches]))
new-node (api/list-node
[(api/token-node 'let)
(api/vector-node
[(api/token-node '&throw-context) (api/token-node nil)])
(api/token-node '&throw-context) ;; use throw-context to avoid warning
(with-meta (api/list-node (list* (api/token-node 'try)
(concat body catches)))
(meta node))])]
;; (prn (api/sexpr new-node))
{:node new-node}))

2 changes: 2 additions & 0 deletions .clj-kondo/imports/clj-kondo/slingshot/config.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{:hooks
{:analyze-call {slingshot.slingshot/try+ clj-kondo.slingshot.try-plus/try+}}}
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@
(constantly nil)
false
nil
nil
nil
(get-in config [:puppetserver :certname])))
master-route-handler (comidi/routes->handler master-routes)
master-mount (master-core/get-master-mount
Expand Down
Loading

0 comments on commit 6bb7e31

Please sign in to comment.