Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
deploy:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
environment: Deployment
steps:
- uses: actions/checkout@v4.1.0
Expand Down
30 changes: 8 additions & 22 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,28 @@ on:

jobs:
kondo:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
timeout-minutes: 10
env:
CLJ_KONDO_VERSION: "2023.09.07"
DOWNLOAD_URL: https://github.com/clj-kondo/clj-kondo/releases/download
steps:
- uses: actions/checkout@v4
- name: Setup Java & Clojure
uses: ./.github/actions/setup-clojure
with:
cache-key: kondo
- name: Install clj-kondo
run: |
curl -OL ${DOWNLOAD_URL}/v${CLJ_KONDO_VERSION}/clj-kondo-${CLJ_KONDO_VERSION}-linux-static-amd64.zip
curl -OL ${DOWNLOAD_URL}/v${CLJ_KONDO_VERSION}/clj-kondo-${CLJ_KONDO_VERSION}-linux-static-amd64.zip.sha256
cat clj-kondo-${CLJ_KONDO_VERSION}-linux-static-amd64.zip.sha256 >> SHA256sum.txt
echo " clj-kondo-${CLJ_KONDO_VERSION}-linux-static-amd64.zip" >> SHA256sum.txt
sha256sum -c SHA256sum.txt
unzip -d /usr/local/bin clj-kondo-${CLJ_KONDO_VERSION}-linux-static-amd64.zip
- run: clj-kondo --version
- name: Copy Kondo config from deps
run: >-
clj-kondo
clojure -M:kondo
--copy-configs
--dependencies
--lint "$(clojure -A:dev -Spath)"
--skip-lint
--parallel
- name: Run clj-kondo
run: >-
clj-kondo
--parallel
--lint src test
clojure -M:kondo:kondo/all

tests:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
Expand All @@ -57,7 +43,7 @@ jobs:
CI: TRUE

whitespace-linter:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Java & Clojure
Expand All @@ -68,7 +54,7 @@ jobs:
name: Run whitespace linter

check:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Java & Clojure
Expand All @@ -79,7 +65,7 @@ jobs:
name: Check namespaces

codecov:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Java & Clojure
Expand All @@ -94,7 +80,7 @@ jobs:
files: ./target/coverage/codecov.json

codespell:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: codespell-project/actions-codespell@master
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@
/tags
/target
\#*\#
*.\~undo-tree\~
23 changes: 22 additions & 1 deletion deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
{:extra-paths ["dev" "test"]

:extra-deps
{eftest/eftest {:mvn/version "0.5.9"}
{clj-kondo/clj-kondo {:mvn/version "2025.01.16"}
eftest/eftest {:mvn/version "0.5.9"}
environ/environ {:mvn/version "1.2.0"}
io.github.camsaul/humane-are {:mvn/version "1.0.2"}
org.clojure/java.classpath {:mvn/version "1.0.0"}
Expand Down Expand Up @@ -49,6 +50,26 @@
:exec-args {:only ["test"]}
:jvm-opts ["-Dinhumane.test.output=true"]}

;; Run Kondo
;;
;; clojure -M:kondo --lint ...
;;
;; Copy configs
;;
;; clojure -M:kondo --copy-configs --dependencies --lint "$(clojure -A:dev -Spath)" --skip-lint --parallel
:kondo
{:replace-deps {clj-kondo/clj-kondo {:mvn/version "2025.01.16"}}
:main-opts ["-m" "clj-kondo.main"]}

;; lint everything with Kondo
;;
;; clojure -M:kondo:kondo/all
:kondo/all
{:main-opts ["-m" "clj-kondo.main"
"--lint"
"src"
"test"]}

;; clj -X:dev:cloverage
:cloverage
{:extra-deps {cloverage/cloverage {:mvn/version "1.2.4"}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{:config-paths ["macros"]

:lint-as
{}
:config-in-call
{methodical.core/defmethod
{:linters
{:redundant-fn-wrapper {:level :off}}}}

:hooks
{:analyze-call
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
'next-method
'__FN__NAME__THAT__YOU__CANNOT__REFER__TO__))
fn-tail))
(vary-meta update :clj-kondo/ignore conj :redundant-fn-wrapper))]))]
(with-meta (meta node)))]))]
#_(println "=>")
#_(clojure.pprint/pprint (hooks/sexpr result))
{:node result})))
Expand Down
9 changes: 5 additions & 4 deletions src/methodical/macros.clj
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,13 @@
[name-symb dispatch-fn {:keys [hierarchy dispatcher combo method-table cache default-value]
:or {combo `(impl/thread-last-method-combination)
method-table `(impl/standard-method-table)
cache (if hierarchy
`(impl/watching-cache (impl/simple-cache) [~hierarchy])
`(impl/simple-cache))
hierarchy '#'clojure.core/global-hierarchy}
prefs :prefers}]
(let [dispatch-fn (or dispatch-fn `identity)
(let [cache (or cache
(if hierarchy
`(impl/watching-cache (impl/simple-cache) [~hierarchy])
`(impl/simple-cache)))
dispatch-fn (or dispatch-fn `identity)
dispatcher (or dispatcher
`(impl/multi-default-dispatcher ~dispatch-fn
:hierarchy ~hierarchy
Expand Down