Skip to content

Commit

Permalink
Fix tests, fix lint errors from self-lint
Browse files Browse the repository at this point in the history
  • Loading branch information
tomdl89 committed Nov 10, 2024
1 parent d9691dd commit 8cde117
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/clj_kondo/hooks_api.clj
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
(when *debug*
(when-let [node (some #(when-not (node? %)
%) children)]
(throw (new IllegalArgumentException (str "Not a node: " (str node)))))))
(throw (new IllegalArgumentException (str "Not a node: " node))))))

(defn vector-node [children]
(assert-children-nodes children)
Expand Down
2 changes: 1 addition & 1 deletion src/clj_kondo/impl/analyzer.clj
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@
(defn lint-fn-name! [ctx name-node]
(when-not (simple-symbol? (:value name-node))
(findings/reg-finding! ctx (assoc (meta name-node)
:message (str "Function name must be simple symbol but got: " (str name-node))
:message (str "Function name must be simple symbol but got: " name-node)
:type :syntax
:filename (:filename ctx)))))

Expand Down
2 changes: 1 addition & 1 deletion src/clj_kondo/impl/analyzer/namespace.clj
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@
(node->line (:filename ctx)
child-expr
:refer
(str "require with " (str child-k))))))
(str "require with " child-k)))))
(recur
(nnext children)
(cond (and (not cljs-macros-self-require?) (sequential? opt))
Expand Down
6 changes: 2 additions & 4 deletions src/clj_kondo/impl/analyzer/usages.clj
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,7 @@
(when redundant?
(findings/reg-finding! ctx (assoc (meta expr)
:type :unused-value
:message (str "Unused value: "
(str expr))
:message (str "Unused value: " expr)
:filename (:filename ctx)))))))))
(do
;; this everything but a symbol token, including keywords
Expand Down Expand Up @@ -313,8 +312,7 @@
(when redundant?
(findings/reg-finding! ctx (assoc (meta expr)
:type :unused-value
:message (str "Unused value: "
(str expr))
:message (str "Unused value: " expr)
:filename (:filename ctx))))))))
(when (:k expr)
(analyze-keyword ctx expr opts))))
Expand Down
2 changes: 1 addition & 1 deletion src/clj_kondo/impl/cache.clj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

(defn built-in-cache-resource [lang ns-sym]
(io/resource (str "clj_kondo/impl/cache/built_in/"
(name lang) "/" (str ns-sym ".transit.json"))))
(name lang) "/" ns-sym ".transit.json")))

(defn cache-file ^java.io.File [cache-dir lang ns-sym]
(io/file cache-dir (name lang) (str ns-sym ".transit.json")))
Expand Down
6 changes: 3 additions & 3 deletions src/clj_kondo/impl/linters.clj
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,9 @@
(when called-fn
(or different-file?
(not row-called-fn)
(or (> row-call row-called-fn)
(and (= row-call row-called-fn)
(> (:col call) (:col called-fn)))))))
(> row-call row-called-fn)
(and (= row-call row-called-fn)
(> (:col call) (:col called-fn))))))
_ (when-let [t (:type called-fn)]
(when (and call? (utils/one-of t [:string]))
(findings/reg-finding!
Expand Down
4 changes: 2 additions & 2 deletions src/clj_kondo/impl/namespace.clj
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@
(when (and var-sym
(or (str/starts-with? var-sym ".")
(str/ends-with? var-sym "."))
(and (not= '.. var-sym)
(not (one-of ns-sym [cljs.core clojure.core]))))
(not= '.. var-sym)
(not (one-of ns-sym [cljs.core clojure.core])))
(findings/reg-finding! ctx (node->line
filename (let [thing (if (meta var-sym) var-sym expr)]
thing)
Expand Down
3 changes: 2 additions & 1 deletion test/clj_kondo/redundant_call_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
(doseq [sym `[-> ->> cond-> cond->> some-> some->> partial comp merge]]
(assert-submaps
[{:level :warning :message (format "Single arg use of %s always returns the arg itself" sym)}]
(lint! (format "(%s 1)" sym) config))
(lint! (format "(%s 1)" sym) config)))
(doseq [sym `[-> ->> cond-> cond->> some-> some->> partial]]
(assert-submaps
[{:level :warning :message (format "Single arg use of %s always returns the arg itself" sym)}
{:level :warning :message (format "Single arg use of %s always returns the arg itself" sym)}]
Expand Down

0 comments on commit 8cde117

Please sign in to comment.