From fb1decbd1ef4a4b7b6e52a9749e501e6a0e9811e Mon Sep 17 00:00:00 2001 From: Sean Corfield Date: Fri, 20 May 2022 10:46:04 -0700 Subject: [PATCH] fixes #409 by making the check conditional --- CHANGELOG.md | 1 + build.clj | 13 +++++++++---- deps.edn | 5 ++++- src/honey/sql/helpers.cljc | 6 ++++-- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 935ddac..a681bac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Changes * 2.3.next in progress + * Address [#409](https://github.com/seancorfield/honeysql/issues/409) by making docstring check for public helpers conditional. * Address [#401](https://github.com/seancorfield/honeysql/issues/401) by adding `register-dialect!` and `get-dialect`, and also making `add-clause-before`, `strop`, and `upper-case` public so that new dialects are easier to construct. * 2.2.891 -- 2022-04-23 diff --git a/build.clj b/build.clj index 57c16f8..6c65ce6 100644 --- a/build.clj +++ b/build.clj @@ -48,10 +48,15 @@ (defn test "Run basic tests." [opts] (-> opts - (assoc :aliases [:1.11]) + (update :aliases (fnil conj []) :1.11) (bb/run-tests))) -(defn ci "Run the CI pipeline of tests (and build the JAR)." [opts] +(defn ci + "Run the CI pipeline of tests (and build the JAR). + + Default Clojure version is 1.9.0 (:1.9) so :elide + tests for #409 on that version." + [opts] (-> opts (bb/clean) (assoc :lib lib :version (if (:snapshot opts) snapshot version)) @@ -59,13 +64,13 @@ (reduce (fn [opts alias] (run-doc-tests (assoc opts :aliases [alias]))) opts - [:cljs :1.9 :1.10 :1.11 :master])) + [:cljs :elide :1.10 :1.11 :master])) (eastwood) (as-> opts (reduce (fn [opts alias] (bb/run-tests (assoc opts :aliases [alias]))) opts - [:cljs :1.9 :1.10 :1.11 :master])) + [:cljs :elide :1.10 :1.11 :master])) (bb/clean) (assoc :src-pom "template/pom.xml") (bb/jar))) diff --git a/deps.edn b/deps.edn index aa24484..92c7a70 100644 --- a/deps.edn +++ b/deps.edn @@ -10,9 +10,12 @@ ;; versions to test against: :1.9 {:override-deps {org.clojure/clojure {:mvn/version "1.9.0"}}} :1.10 {:override-deps {org.clojure/clojure {:mvn/version "1.10.3"}}} - :1.11 {:override-deps {org.clojure/clojure {:mvn/version "1.11.0"}}} + :1.11 {:override-deps {org.clojure/clojure {:mvn/version "1.11.1"}}} :master {:override-deps {org.clojure/clojure {:mvn/version "1.12.0-master-SNAPSHOT"}}} + :elide ; to test #409 (assertion on helper docstrings) + {:jvm-opts ["-Dclojure.compiler.elide-meta=[:doc]"]} + ;; running tests/checks of various kinds: :test {:extra-paths ["test"] diff --git a/src/honey/sql/helpers.cljc b/src/honey/sql/helpers.cljc index 00dd098..0056fb2 100644 --- a/src/honey/sql/helpers.cljc +++ b/src/honey/sql/helpers.cljc @@ -1025,8 +1025,10 @@ #?(:clj (do - ;; ensure #295 stays true (all public functions have docstring): - (assert (empty? (->> (ns-publics *ns*) (vals) (c/filter (comp not :doc meta))))) + ;; #409 this assert is only valid when :doc metadata is not elided: + (when (-> #'generic-helper-unary meta :doc) + ;; ensure #295 stays true (all public functions have docstring): + (assert (empty? (->> (ns-publics *ns*) (vals) (c/filter (comp not :doc meta)))))) ;; ensure all public functions match clauses: (assert (= (clojure.core/set (conj @@#'honey.sql/base-clause-order :composite :filter :lateral :over :within-group