forked from clj-kondo/clj-kondo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix clj-kondo#2288: fix static method analysis and suppressing :java-…
…static-field-call locally (clj-kondo#2290)
- Loading branch information
Showing
11 changed files
with
170 additions
and
10 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,26 @@ | ||
(ns borkdude.deflet | ||
(:require [clj-kondo.hooks-api :as hooks-api])) | ||
|
||
(defn deflet* [children] | ||
(let [f (first children) | ||
r (next children)] | ||
(if (and (hooks-api/list-node? f) | ||
(#{'def 'defp} (hooks-api/sexpr (first (:children f))))) | ||
(let [def-children (:children f)] | ||
(with-meta (hooks-api/list-node | ||
[(hooks-api/coerce 'clojure.core/let) | ||
(hooks-api/vector-node [(second def-children) | ||
(nth def-children 2)]) | ||
(deflet* r)]) | ||
(meta f))) | ||
(if-not r (or f (hooks-api/coerce nil)) | ||
(with-meta | ||
(hooks-api/list-node (list (hooks-api/coerce 'do) | ||
f | ||
(deflet* r))) | ||
(meta f)))))) | ||
|
||
(defn deflet [{:keys [node]}] | ||
(let [children (:children node) | ||
new-node (deflet* children)] | ||
{:node new-node})) |
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,3 @@ | ||
{:lint-as {borkdude.deflet/defp clojure.core/def} | ||
:hooks {:analyze-call {borkdude.deflet/deflet borkdude.deflet/deflet | ||
borkdude.deflet/defletp borkdude.deflet/deflet}}} |
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
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
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