-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* maint: bump deps + some other tweaks * Bump to clojure used for REPL to 1.11.3 Jvm nrepl no longer works with clojure 1.9 * Adapt to small change in wikipedia Our docs introduce Etaoin with a trip to wikipedia. Our docs are tested with test-doc-blocks. Wikipedia changed a wee bit. Which made our doc tests fail. Adapt. * ci debug: always upload any saved screenshots as artifact To support debugging. * ci: test-matrix: natural sort by job description Small thing, but sorts jdk8 before jdk11 which makes github actions workflow job listing easier to follow.
- Loading branch information
Showing
7 changed files
with
183 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
{:paths ["src" "resources"] | ||
:deps {org.clojure/clojure {:mvn/version "1.9.0"} ;; min clojure version | ||
babashka/fs {:mvn/version "0.5.20"} | ||
babashka/fs {:mvn/version "0.5.21"} | ||
babashka/process {:mvn/version "0.5.22"} | ||
clj-http/clj-http {:mvn/version "3.12.3"} ;; for jvm use | ||
clj-http/clj-http {:mvn/version "3.13.0"} ;; for jvm use | ||
org.clj-commons/clj-http-lite {:mvn/version "1.0.13"} ;; for babashka use | ||
slingshot/slingshot {:mvn/version "0.12.2"} | ||
cheshire/cheshire {:mvn/version "5.12.0"} | ||
cheshire/cheshire {:mvn/version "5.13.0"} | ||
org.clojure/tools.cli {:mvn/version "1.1.230"} | ||
org.clojure/tools.logging {:mvn/version "1.3.0"} | ||
lambdaisland/uri {:mvn/version "1.19.155"}} | ||
:aliases | ||
{:1.11 {:replace-deps {org.clojure/clojure {:mvn/version "1.11.2"}}} | ||
:1.12 {:replace-deps {org.clojure/clojure {:mvn/version "1.12.0-alpha9"}}} | ||
{:1.11 {:replace-deps {org.clojure/clojure {:mvn/version "1.11.3"}}} | ||
:1.12 {:replace-deps {org.clojure/clojure {:mvn/version "1.12.0-beta1"}}} | ||
:debug {:extra-paths ["env/dev/resources"]} | ||
:test {:extra-paths ["test" "env/test/resources" "build"] | ||
:extra-deps {io.github.cognitect-labs/test-runner {:git/tag "v0.5.1" :git/sha "dfb30dd"} | ||
org.babashka/cli {:mvn/version "0.8.58"} | ||
org.babashka/cli {:mvn/version "0.8.59"} | ||
ch.qos.logback/logback-classic {:mvn/version "1.3.14"} | ||
;; for http-client which uses apache http client 4.x which uses commons logging | ||
org.slf4j/jcl-over-slf4j {:mvn/version "2.0.12"}} | ||
org.slf4j/jcl-over-slf4j {:mvn/version "2.0.13"}} | ||
:exec-fn build-shared/test | ||
:org.babashka/cli {:coerce {:nses [:symbol] | ||
:patterns [:string] | ||
|
@@ -27,15 +27,15 @@ | |
:script {:extra-paths ["script"]} | ||
|
||
;; test-doc-blocks - gen tests | ||
:test-doc-blocks {:replace-deps {org.clojure/clojure {:mvn/version "1.11.2"} | ||
com.github.lread/test-doc-blocks {:mvn/version "1.1.19"}} | ||
:test-doc-blocks {:replace-deps {org.clojure/clojure {:mvn/version "1.11.3"} | ||
com.github.lread/test-doc-blocks {:mvn/version "1.1.20"}} | ||
:replace-paths [] | ||
:ns-default lread.test-doc-blocks | ||
:exec-args {:docs ["doc/01-user-guide.adoc"]}} | ||
|
||
;; test-doc-blocks - run tests | ||
;; usage: test:test-docs | ||
:test-docs {:override-deps {org.clojure/clojure {:mvn/version "1.11.2"}} | ||
:test-docs {:override-deps {org.clojure/clojure {:mvn/version "1.11.3"}} | ||
:extra-paths ["target/test-doc-blocks/test"] | ||
:exec-fn cognitect.test-runner.api/test | ||
:exec-args {:dirs ["target/test-doc-blocks/test"]} | ||
|
@@ -45,7 +45,7 @@ | |
:main-opts ["-m" "babashka.cli.exec"]} | ||
|
||
;; for consistent linting we use a specific version of clj-kondo through the jvm | ||
:clj-kondo {:extra-deps {clj-kondo/clj-kondo {:mvn/version "2024.03.13"}} | ||
:clj-kondo {:extra-deps {clj-kondo/clj-kondo {:mvn/version "2024.05.24"}} | ||
:main-opts ["-m" "clj-kondo.main"]} | ||
|
||
:eastwood {:extra-deps {jonase/eastwood {:mvn/version "1.4.2"}} | ||
|
@@ -55,25 +55,26 @@ | |
:add-linters [:performance] | ||
:exclude-linters [:local-shadows-var]}]} | ||
|
||
: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} | ||
|
||
;; keep deploy deps separate from build deps to avoid download-deps issues | ||
;; caused by, I think, conflicting maven deps | ||
:deploy {:extra-deps {slipset/deps-deploy {:mvn/version "0.2.2"}}} | ||
|
||
:outdated {:extra-deps {com.github.liquidz/antq {:mvn/version "2.8.1185"} | ||
:outdated {:extra-deps {com.github.liquidz/antq {:mvn/version "2.8.1201"} | ||
org.clojure/clojure {:mvn/version "1.11.1"} | ||
org.slf4j/slf4j-simple {:mvn/version "2.0.12"} ;; to rid ourselves of logger warnings | ||
org.slf4j/slf4j-simple {:mvn/version "2.0.13"} ;; to rid ourselves of logger warnings | ||
} | ||
:main-opts ["-m" "antq.core" | ||
"--exclude=ch.qos.logback/[email protected]" ;; requires min jdk 11, we are currently jdk8 compatible | ||
"--exclude=ch.qos.logback/[email protected]" ;; requires min jdk 11, we are currently jdk8 compatible | ||
]} | ||
|
||
:repl/cider | ||
{:extra-deps {nrepl/nrepl {:mvn/version "1.1.1"} | ||
cider/cider-nrepl {:mvn/version "0.47.0"} | ||
{:extra-deps {org.clojure/clojure {:mvn/version "1.11.3"} | ||
nrepl/nrepl {:mvn/version "1.2.0"} | ||
cider/cider-nrepl {:mvn/version "0.49.0"} | ||
refactor-nrepl/refactor-nrepl {:mvn/version "3.10.0"}} | ||
:jvm-opts ["-XX:-OmitStackTraceInFastThrow"] | ||
:main-opts ["-m" "nrepl.cmdline" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
;; Thanks to https://gist.github.com/wilkerlucio/db54dc83a9664124f3febf6356f04509 | ||
(ns helper.natural-sort | ||
(:refer-clojure :exclude [sort sort-by]) | ||
(:require [clojure.string])) | ||
|
||
(defn vector-compare [[value1 & rest1] [value2 & rest2]] | ||
(let [result (compare value1 value2)] | ||
(cond | ||
(not (zero? result)) result | ||
(nil? value1) 0 | ||
:else (recur rest1 rest2)))) | ||
|
||
(defn prepare-string [s] | ||
(let [s (or s "") | ||
parts (vec (clojure.string/split s #"\d+")) | ||
numbers (->> (re-seq #"\d+" s) | ||
(map parse-long) | ||
(vec))] | ||
(vec (interleave (conj parts "") (conj numbers -1))))) | ||
|
||
(defn natural-compare [a b] | ||
(vector-compare (prepare-string a) | ||
(prepare-string b))) | ||
|
||
(defn sort [coll] (clojure.core/sort natural-compare coll)) | ||
|
||
(defn sort-by [keyfn coll] | ||
(clojure.core/sort-by keyfn natural-compare coll)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters