From bab1458700995403050f0e63503edae335b9c9ab Mon Sep 17 00:00:00 2001 From: Miguel de Benito Delgado Date: Mon, 5 Oct 2026 12:10:14 +0200 Subject: [PATCH] :paperclip: Improve clj-kondo hooks Move the benchmark macro hooks into hooks.benches and add the missing license header to hooks.export. AI-assisted-by: deepseek-flash --- .clj-kondo/config.edn | 9 +++------ .clj-kondo/hooks/benches.clj | 26 ++++++++++++++++++++++++++ .clj-kondo/hooks/export.clj | 20 ++++++-------------- 3 files changed, 35 insertions(+), 20 deletions(-) create mode 100644 .clj-kondo/hooks/benches.clj diff --git a/.clj-kondo/config.edn b/.clj-kondo/config.edn index cfb98161d8..d525aa4ed0 100644 --- a/.clj-kondo/config.edn +++ b/.clj-kondo/config.edn @@ -24,9 +24,8 @@ shadow.lazy/loadable hooks.export/rumext-lazycomponent app.util.i18n/tr hooks.i18n/tr-dynamic app.common.i18n/tr hooks.i18n/tr-dynamic - benches.render-wasm.declarations/defscene hooks.export/benches-defscene - benches.render-wasm.declarations/defcase hooks.export/benches-defcase - }} + benches.render-wasm.declarations/defscene hooks.benches/defscene + benches.render-wasm.declarations/defcase hooks.benches/defcase}} :output {:exclude-files @@ -103,6 +102,4 @@ :unused-binding {:exclude-destructured-as true - :exclude-destructured-keys-in-fn-args false - } - }} + :exclude-destructured-keys-in-fn-args false}}} diff --git a/.clj-kondo/hooks/benches.clj b/.clj-kondo/hooks/benches.clj new file mode 100644 index 0000000000..03c81b3582 --- /dev/null +++ b/.clj-kondo/hooks/benches.clj @@ -0,0 +1,26 @@ +;; This Source Code Form is subject to the terms of the Mozilla Public +;; License, v. 2.0. If a copy of the MPL was not distributed with this +;; file, You can obtain one at http://mozilla.org/MPL/2.0/. +;; +;; Copyright (c) KALEIDOS SUBSIDIARY SL + +(ns hooks.benches + (:require [clj-kondo.hooks-api :as api])) + +(defn defscene + "Analyzes scene options and its compiled builder body." + [{:keys [node]}] + (let [[_ _ opts argv & body] (:children node)] + (if (and argv (api/vector-node? argv)) + {:node (api/list-node [(api/token-node (quote do)) opts + (api/list-node (into [(api/token-node (quote fn)) argv] body))])} + {:node node}))) + +(defn defcase + "Analyzes case options and its compiled operation body." + [{:keys [node]}] + (let [[_ _ opts argv & body] (:children node)] + (if (and (seq body) argv (api/vector-node? argv)) + {:node (api/list-node [(api/token-node (quote do)) opts + (api/list-node (into [(api/token-node (quote fn)) argv] body))])} + {:node node}))) diff --git a/.clj-kondo/hooks/export.clj b/.clj-kondo/hooks/export.clj index 8845a28573..f4c0ebcf0c 100644 --- a/.clj-kondo/hooks/export.clj +++ b/.clj-kondo/hooks/export.clj @@ -1,3 +1,9 @@ +;; This Source Code Form is subject to the terms of the Mozilla Public +;; License, v. 2.0. If a copy of the MPL was not distributed with this +;; file, You can obtain one at http://mozilla.org/MPL/2.0/. +;; +;; Copyright (c) KALEIDOS SUBSIDIARY SL + (ns hooks.export (:require [clj-kondo.hooks-api :as api])) @@ -10,20 +16,6 @@ sname])] {:node result})) -(defn benches-defscene - [{:keys [node]}] - (let [[_ _ opts argv & body] (:children node)] - (if (and argv (api/vector-node? argv)) - {:node (api/list-node (into [(api/token-node (quote fn)) argv] body))} - {:node node}))) - -(defn benches-defcase - [{:keys [node]}] - (let [[_ _ opts argv & body] (:children node)] - (if (and (seq body) argv (api/vector-node? argv)) - {:node (api/list-node (into [(api/token-node (quote fn)) argv] body))} - {:node node}))) - (def registry (atom {}))