From 6a53720feda1586f6a2916ab9ae94ca564cb7caf Mon Sep 17 00:00:00 2001 From: Rafael Delboni Date: Wed, 3 Jul 2024 18:08:32 -0300 Subject: [PATCH 1/2] bump: clojure deps --- .../nubank/state-flow/nubank/state_flow.clj | 23 +++++++++++ .clj-kondo/taoensso/encore/config.edn | 5 ++- .../taoensso/encore/taoensso/encore.clj | 41 ++++++++++++++----- .github/workflows/flyio-deploy.yml | 4 +- .github/workflows/tests.yml | 4 +- deps.edn | 26 ++++++------ 6 files changed, 75 insertions(+), 28 deletions(-) diff --git a/.clj-kondo/nubank/state-flow/nubank/state_flow.clj b/.clj-kondo/nubank/state-flow/nubank/state_flow.clj index 692dd9c..02332d2 100644 --- a/.clj-kondo/nubank/state-flow/nubank/state_flow.clj +++ b/.clj-kondo/nubank/state-flow/nubank/state_flow.clj @@ -1,4 +1,5 @@ (ns nubank.state-flow + (:refer-clojure :exclude [with-redefs]) (:require [clj-kondo.hooks-api :as hooks])) (defn- normalize-mlet-binds @@ -33,3 +34,25 @@ (do-let body)])] {:node (with-meta new-node (meta node)) :defined-by 'state-flow.cljtest/defflow})) + +#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]} +(defn with-redefs + "This transformation hook converts + + (state-flow.labs.state/with-redefs [bindings & flows]) + + into + + (clojure.core/with-redefs bindings + (state-flow.core/flow \"state-flow.labs.state/with-redefs\" flows))" + [{:keys [node]}] + (let [[bindings & flows] (rest (:children node)) + new-node (hooks/list-node + [(hooks/token-node 'clojure.core/with-redefs) + bindings + (hooks/list-node + (concat [(hooks/token-node 'state-flow.api/flow) + (hooks/string-node "state-flow.labs.state/with-redefs")] + flows))])] + {:node (with-meta new-node (meta node)) + :defined-by 'state-flow.labs.state/with-redefs})) diff --git a/.clj-kondo/taoensso/encore/config.edn b/.clj-kondo/taoensso/encore/config.edn index 7b0ff3c..766fd95 100644 --- a/.clj-kondo/taoensso/encore/config.edn +++ b/.clj-kondo/taoensso/encore/config.edn @@ -1 +1,4 @@ -{:hooks {:analyze-call {taoensso.encore/defalias taoensso.encore/defalias}}} +{:hooks + {:analyze-call + {taoensso.encore/defalias taoensso.encore/defalias + taoensso.encore/defn-cached taoensso.encore/defn-cached}}} diff --git a/.clj-kondo/taoensso/encore/taoensso/encore.clj b/.clj-kondo/taoensso/encore/taoensso/encore.clj index 7f6d30a..4d2d96f 100644 --- a/.clj-kondo/taoensso/encore/taoensso/encore.clj +++ b/.clj-kondo/taoensso/encore/taoensso/encore.clj @@ -1,16 +1,37 @@ (ns taoensso.encore + "I don't personally use clj-kondo, so these hooks are + kindly authored and maintained by contributors. + PRs very welcome! - Peter Taoussanis" (:require [clj-kondo.hooks-api :as hooks])) -(defn defalias [{:keys [node]}] +(defn defalias + [{:keys [node]}] (let [[sym-raw src-raw] (rest (:children node)) src (if src-raw src-raw sym-raw) - sym (if src-raw - sym-raw - (symbol (name (hooks/sexpr src))))] - {:node (with-meta - (hooks/list-node - [(hooks/token-node 'def) - (hooks/token-node (hooks/sexpr sym)) - (hooks/token-node (hooks/sexpr src))]) - (meta src))})) + sym + (if src-raw + sym-raw + (symbol (name (hooks/sexpr src))))] + + {:node + (with-meta + (hooks/list-node + [(hooks/token-node 'def) + (hooks/token-node (hooks/sexpr sym)) + (hooks/token-node (hooks/sexpr src))]) + (meta src))})) + +(defn defn-cached + [{:keys [node] :as x}] + (let [[sym _opts binding-vec & body] (rest (:children node))] + {:node + (hooks/list-node + (list + (hooks/token-node 'def) + sym + (hooks/list-node + (list* + (hooks/token-node 'fn) + binding-vec + body))))})) diff --git a/.github/workflows/flyio-deploy.yml b/.github/workflows/flyio-deploy.yml index ce7db33..907a080 100644 --- a/.github/workflows/flyio-deploy.yml +++ b/.github/workflows/flyio-deploy.yml @@ -36,7 +36,7 @@ jobs: - name: Install clojure cli uses: DeLaGuardo/setup-clojure@master with: - cli: 1.11.2.1446 + cli: 1.11.3.1463 - name: Cache Maven packages uses: actions/cache@v4 @@ -64,7 +64,7 @@ jobs: - name: Install clojure cli uses: DeLaGuardo/setup-clojure@master with: - cli: 1.11.2.1446 + cli: 1.11.3.1463 - name: Cache Maven packages uses: actions/cache@v4 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5792c40..e2900b7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -33,7 +33,7 @@ jobs: - name: Install clojure cli uses: DeLaGuardo/setup-clojure@master with: - cli: 1.11.2.1446 + cli: 1.11.3.1463 - name: Cache Maven packages uses: actions/cache@v4 @@ -60,7 +60,7 @@ jobs: - name: Install clojure cli uses: DeLaGuardo/setup-clojure@master with: - cli: 1.11.2.1446 + cli: 1.11.3.1463 - name: Setup clojure-lsp uses: clojure-lsp/setup-clojure-lsp@v1.0.2 diff --git a/deps.edn b/deps.edn index 3a7c0df..968c222 100644 --- a/deps.edn +++ b/deps.edn @@ -1,35 +1,35 @@ {:paths ["src" "resources"] - :deps {org.clojure/clojure {:mvn/version "1.11.2"} - com.github.parenthesin/components {:mvn/version "0.2.5" + :deps {org.clojure/clojure {:mvn/version "1.11.3"} + com.github.parenthesin/components {:mvn/version "0.3.0" :exclusions [prismatic/schema]} - com.github.seancorfield/honeysql {:mvn/version "2.6.1126"} - metosin/malli {:mvn/version "0.15.0"} - metosin/reitit-swagger {:mvn/version "0.6.0"} + com.github.seancorfield/honeysql {:mvn/version "2.6.1147"} + metosin/reitit-swagger {:mvn/version "0.7.1"} org.postgresql/postgresql {:mvn/version "42.7.3"} - com.taoensso/encore {:mvn/version "3.97.0"} - datalevin/datalevin {:mvn/version "0.9.3"} - buddy/buddy-sign {:mvn/version "3.5.351"}} + com.taoensso/encore {:mvn/version "3.113.0"} + datalevin/datalevin {:mvn/version "0.9.8"} + buddy/buddy-sign {:mvn/version "3.5.351"} + metosin/malli {:mvn/version "0.16.0"}} :aliases {:dev {:extra-paths ["test" "dev" "test/resources"] :extra-deps {org.clojars.bigsy/pg-embedded-clj {:mvn/version "1.0.1"} - lambdaisland/kaocha {:mvn/version "1.88.1376"} + lambdaisland/kaocha {:mvn/version "1.91.1392"} lambdaisland/kaocha-cloverage {:mvn/version "1.1.89"} nubank/matcher-combinators {:mvn/version "3.9.1"} - nubank/state-flow {:mvn/version "5.15.0"}} + nubank/state-flow {:mvn/version "5.17.0"}} ; needed for datalevin on jvm > 11 :jvm-opts ["--add-opens=java.base/java.nio=ALL-UNNAMED" "--add-opens=java.base/sun.nio.ch=ALL-UNNAMED"]} :test {:main-opts ["-m" "kaocha.runner"] :jvm-opts ["-Xms3g" "-Xmx3g"]} - :clojure-lsp {:replace-deps {com.github.clojure-lsp/clojure-lsp-standalone {:mvn/version "2024.03.13-13.11.00"}} + :clojure-lsp {:replace-deps {com.github.clojure-lsp/clojure-lsp-standalone {:mvn/version "2024.04.22-11.50.26"}} :main-opts ["-m" "clojure-lsp.main"]} - :nrepl {:extra-deps {cider/cider-nrepl {:mvn/version "0.47.1"}} + :nrepl {:extra-deps {cider/cider-nrepl {:mvn/version "0.49.1"}} :main-opts ["-m" "nrepl.cmdline" "--middleware" "[cider.nrepl/cider-middleware]"]} :migratus {:main-opts ["-m" "parenthesin.helpers.migrations"]} - :build {:deps {io.github.clojure/tools.build {:mvn/version "0.10.0"}} + :build {:deps {io.github.clojure/tools.build {:mvn/version "0.10.4"}} :ns-default build :exec-args {:uber-file "target/service.jar"}}}} From 420526fb8b2966020c50e5671a3a617b9c951fc5 Mon Sep 17 00:00:00 2001 From: Rafael Delboni Date: Wed, 3 Jul 2024 21:28:35 -0300 Subject: [PATCH 2/2] chore: adds kondo files --- .../io.pedestal/pedestal.log/config.edn | 18 ++++++ .../hooks/io/pedestal/log.clj_kondo | 26 ++++++++ .clj-kondo/potemkin/potemkin/config.edn | 62 +++++++++++++++++++ .../potemkin/potemkin/potemkin/namespaces.clj | 56 +++++++++++++++++ 4 files changed, 162 insertions(+) create mode 100644 .clj-kondo/io.pedestal/pedestal.log/config.edn create mode 100644 .clj-kondo/io.pedestal/pedestal.log/hooks/io/pedestal/log.clj_kondo create mode 100644 .clj-kondo/potemkin/potemkin/config.edn create mode 100644 .clj-kondo/potemkin/potemkin/potemkin/namespaces.clj diff --git a/.clj-kondo/io.pedestal/pedestal.log/config.edn b/.clj-kondo/io.pedestal/pedestal.log/config.edn new file mode 100644 index 0000000..bb8b71c --- /dev/null +++ b/.clj-kondo/io.pedestal/pedestal.log/config.edn @@ -0,0 +1,18 @@ +; Copyright 2024 Nubank NA + +; The use and distribution terms for this software are covered by the +; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0) +; which can be found in the file epl-v10.html at the root of this distribution. +; +; By using this software in any fashion, you are agreeing to be bound by +; the terms of this license. +; +; You must not remove this notice, or any other, from this software. + +{:hooks + {:analyze-call + {io.pedestal.log/trace hooks.io.pedestal.log/log-expr + io.pedestal.log/debug hooks.io.pedestal.log/log-expr + io.pedestal.log/info hooks.io.pedestal.log/log-expr + io.pedestal.log/warn hooks.io.pedestal.log/log-expr + io.pedestal.log/error hooks.io.pedestal.log/log-expr}}} diff --git a/.clj-kondo/io.pedestal/pedestal.log/hooks/io/pedestal/log.clj_kondo b/.clj-kondo/io.pedestal/pedestal.log/hooks/io/pedestal/log.clj_kondo new file mode 100644 index 0000000..8744765 --- /dev/null +++ b/.clj-kondo/io.pedestal/pedestal.log/hooks/io/pedestal/log.clj_kondo @@ -0,0 +1,26 @@ +; Copyright 2024 Nubank NA + +; The use and distribution terms for this software are covered by the +; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0) +; which can be found in the file epl-v10.html at the root of this distribution. +; +; By using this software in any fashion, you are agreeing to be bound by +; the terms of this license. +; +; You must not remove this notice, or any other, from this software. + +(ns hooks.io.pedestal.log + (:require [clj-kondo.hooks-api :as api])) + +(defn log-expr + "Expands (log-expr :a :A :b :B ... ) + to (hash-map :a :A :b :B ... ) per clj-kondo examples." + [{:keys [:node]}] + (let [[k v & _kvs] (rest (:children node))] + (when-not (and k v) + (throw (ex-info "No kv pair provided" {}))) + (let [new-node (api/list-node + (list* + (api/token-node 'hash-map) + (rest (:children node))))] + {:node (vary-meta new-node assoc :clj-kondo/ignore [:unused-value])}))) diff --git a/.clj-kondo/potemkin/potemkin/config.edn b/.clj-kondo/potemkin/potemkin/config.edn new file mode 100644 index 0000000..3f59f3e --- /dev/null +++ b/.clj-kondo/potemkin/potemkin/config.edn @@ -0,0 +1,62 @@ +{:lint-as {potemkin.collections/compile-if clojure.core/if + potemkin.collections/reify-map-type clojure.core/reify + potemkin.collections/def-map-type clj-kondo.lint-as/def-catch-all + potemkin.collections/def-derived-map clj-kondo.lint-as/def-catch-all + + potemkin.types/reify+ clojure.core/reify + potemkin.types/defprotocol+ clojure.core/defprotocol + potemkin.types/deftype+ clojure.core/deftype + potemkin.types/defrecord+ clojure.core/defrecord + potemkin.types/definterface+ clojure.core/defprotocol + potemkin.types/extend-protocol+ clojure.core/extend-protocol + potemkin.types/def-abstract-type clj-kondo.lint-as/def-catch-all + + potemkin.utils/doit clojure.core/doseq + potemkin.utils/doary clojure.core/doseq + potemkin.utils/condp-case clojure.core/condp + potemkin.utils/fast-bound-fn clojure.core/bound-fn + + potemkin.walk/prewalk clojure.walk/prewalk + potemkin.walk/postwalk clojure.walk/postwalk + potemkin.walk/walk clojure.walk/walk + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;;;; top-level from import-vars + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + ;; Have hooks + ;;potemkin/import-fn potemkin.namespaces/import-fn + ;;potemkin/import-macro potemkin.namespaces/import-macro + ;;potemkin/import-def potemkin.namespaces/import-def + + ;; Internal, not transitive + ;;potemkin/unify-gensyms potemkin.macros/unify-gensyms + ;;potemkin/normalize-gensyms potemkin.macros/normalize-gensyms + ;;potemkin/equivalent? potemkin.macros/equivalent? + + potemkin/condp-case clojure.core/condp + potemkin/doit potemkin.utils/doit + potemkin/doary potemkin.utils/doary + + potemkin/def-abstract-type clj-kondo.lint-as/def-catch-all + potemkin/reify+ clojure.core/reify + potemkin/defprotocol+ clojure.core/defprotocol + potemkin/deftype+ clojure.core/deftype + potemkin/defrecord+ clojure.core/defrecord + potemkin/definterface+ clojure.core/defprotocol + potemkin/extend-protocol+ clojure.core/extend-protocol + + potemkin/reify-map-type clojure.core/reify + potemkin/def-derived-map clj-kondo.lint-as/def-catch-all + potemkin/def-map-type clj-kondo.lint-as/def-catch-all} + + ;; leave import-vars alone, kondo special-cases it + :hooks {:macroexpand {#_#_potemkin.namespaces/import-vars potemkin.namespaces/import-vars + potemkin.namespaces/import-fn potemkin.namespaces/import-fn + potemkin.namespaces/import-macro potemkin.namespaces/import-macro + potemkin.namespaces/import-def potemkin.namespaces/import-def + + #_#_potemkin/import-vars potemkin.namespaces/import-vars + potemkin/import-fn potemkin.namespaces/import-fn + potemkin/import-macro potemkin.namespaces/import-macro + potemkin/import-def potemkin.namespaces/import-def}}} diff --git a/.clj-kondo/potemkin/potemkin/potemkin/namespaces.clj b/.clj-kondo/potemkin/potemkin/potemkin/namespaces.clj new file mode 100644 index 0000000..a247af5 --- /dev/null +++ b/.clj-kondo/potemkin/potemkin/potemkin/namespaces.clj @@ -0,0 +1,56 @@ +(ns potemkin.namespaces + (:require [clj-kondo.hooks-api :as api])) + +(defn import-macro* + ([sym] + `(def ~(-> sym name symbol) ~sym)) + ([sym name] + `(def ~name ~sym))) + +(defmacro import-fn + ([sym] + (import-macro* sym)) + ([sym name] + (import-macro* sym name))) + +(defmacro import-macro + ([sym] + (import-macro* sym)) + ([sym name] + (import-macro* sym name))) + +(defmacro import-def + ([sym] + (import-macro* sym)) + ([sym name] + (import-macro* sym name))) + +#_ +(defmacro import-vars + "Imports a list of vars from other namespaces." + [& syms] + (let [unravel (fn unravel [x] + (if (sequential? x) + (->> x + rest + (mapcat unravel) + (map + #(symbol + (str (first x) + (when-let [n (namespace %)] + (str "." n))) + (name %)))) + [x])) + syms (mapcat unravel syms) + result `(do + ~@(map + (fn [sym] + (let [vr (resolve sym) + m (meta vr)] + (cond + (nil? vr) `(throw (ex-info (format "`%s` does not exist" '~sym) {})) + (:macro m) `(def ~(-> sym name symbol) ~sym) + (:arglists m) `(def ~(-> sym name symbol) ~sym) + :else `(def ~(-> sym name symbol) ~sym)))) + syms))] + result))