-
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.
* dev: add Eastwood linting For some other Etaoin wip, I wanted to address some reflection warnings for new code and noticed we did not have any existing checks for reflection. I find Eastwood helps out with this nicely. In addition to reflection warnings, I also addressed some other issues Eastwood reported: - A booboo in a test assertion for `etaoin.unit.unit-test/test-chrome-profile`. Fixed! - URL constructors are deprecated, starting with JDK 20. I switched to using lambdaisland/uri. - it noticed `is` assert messages that were not obviously strings. I ^String type hinted the message generating fn. - it thought string `"always"` for a constant truthy looked suspicious. I switched to the more conventional `:always`. - several tests had empty assertions like `(is true "text found")` or `(is 1)`. Perhaps some linter once warned about a test without assertions? We don't have such a thing today, so I turfed these meaningless assertions. The unwritten assertion for these tests is that they do not throw an exception. * add/ignore lint stuff - add some kondo lib config brought in by kondo - git ignore .eastwood dir
- Loading branch information
Showing
22 changed files
with
80 additions
and
43 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 @@ | ||
{:hooks {:analyze-call {taoensso.encore/defalias taoensso.encore/defalias}}} |
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,16 @@ | ||
(ns taoensso.encore | ||
(:require | ||
[clj-kondo.hooks-api :as hooks])) | ||
|
||
(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))})) |
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 |
---|---|---|
|
@@ -17,6 +17,7 @@ TAGS | |
*.iml | ||
build.xml | ||
/.idea | ||
/.eastwood | ||
|
||
# ignore cache under .clj-kondo and .lsp | ||
.cache | ||
|
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
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
(ns ^:no-doc etaoin.impl.util | ||
(:require [lambdaisland.uri :as uri]) | ||
(:import | ||
[java.io File IOException] | ||
[java.net InetSocketAddress ServerSocket Socket])) | ||
|
@@ -77,14 +78,10 @@ | |
"Return `url` with any http credentials stripped, https://user:[email protected] -> https://hello.com. | ||
Use when logging urls to avoid spilling secrets." | ||
^String [^String url] | ||
(let [u (java.net.URL. url)] | ||
(.toExternalForm | ||
(java.net.URL. | ||
(.getProtocol u) | ||
(.getHost u) | ||
(.getPort u) | ||
(.getFile u) | ||
(.getRef u))))) | ||
(-> url | ||
uri/parse | ||
(dissoc :user :password) | ||
uri/uri-str)) | ||
|
||
(defn assoc-some | ||
"Associates a key with a value in a map, if and only if the value is | ||
|
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