-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Of note: - codecov action renamed arg file->files - setup-clojure action now installs via clj-msi on Windows (woot!) - new version of kondo; it found a couple of redundant nested calls (fixed)! - bump lib tests libs - add jdk23 to ci testing
- Loading branch information
Showing
14 changed files
with
144 additions
and
116 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 |
---|---|---|
@@ -1 +1,5 @@ | ||
{: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 | ||
taoensso.encore/defonce taoensso.encore/defonce}}} |
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,16 +1,51 @@ | ||
(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" | ||
(:refer-clojure :exclude [defonce]) | ||
(: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))})) | ||
src (or 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))})) | ||
|
||
(defn defn-cached | ||
[{:keys [node]}] | ||
(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))))})) | ||
|
||
(defn defonce | ||
[{:keys [node]}] | ||
;; args = [sym doc-string? attr-map? init-expr] | ||
(let [[sym & args] (rest (:children node)) | ||
[doc-string args] (if (and (hooks/string-node? (first args)) (next args)) [(hooks/sexpr (first args)) (next args)] [nil args]) | ||
[attr-map init-expr] (if (and (hooks/map-node? (first args)) (next args)) [(hooks/sexpr (first args)) (fnext args)] [nil (first args)]) | ||
|
||
attr-map (if doc-string (assoc attr-map :doc doc-string) attr-map) | ||
sym+meta (if attr-map (with-meta sym attr-map) sym) | ||
rewritten | ||
(hooks/list-node | ||
[(hooks/token-node 'clojure.core/defonce) | ||
sym+meta | ||
init-expr])] | ||
|
||
{:node rewritten})) |
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
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 |
---|---|---|
|
@@ -39,25 +39,11 @@ runs: | |
java-version: ${{ inputs.jdk }} | ||
if: inputs.jdk != 'skip' | ||
|
||
- name: Install Babashka | ||
uses: DeLaGuardo/setup-clojure@12.5 | ||
- name: Install Babashka & Clojure | ||
uses: DeLaGuardo/setup-clojure@13.0 | ||
with: | ||
bb: 'latest' | ||
|
||
- name: Install Clojure (windows) | ||
# On windows, deps.clj's deps.exe is used in place of clojure to avoid complexities of official clojure install | ||
shell: ${{ inputs.shell }} | ||
run: | | ||
PowerShell -Command "iwr -useb https://raw.githubusercontent.com/borkdude/deps.clj/master/install.ps1 | iex" | ||
Rename-Item $HOME\deps.clj\deps.exe clojure.exe | ||
echo "$HOME\deps.clj" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | ||
if: runner.os == 'Windows' | ||
|
||
- name: Install Clojure (macos, linux) | ||
uses: DeLaGuardo/[email protected] | ||
with: | ||
cli: 'latest' | ||
if: runner.os != 'Windows' | ||
|
||
- name: Tools Versions | ||
shell: ${{ inputs.shell }} | ||
|
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
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
Oops, something went wrong.