Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #6 from AlexBaranosky/master

any arg starting with "_" is ignored when looking for unused
  • Loading branch information...
commit 186fa8d0ec3b1c02a3df2cbfc4270979294764b4 2 parents 4e2024e + 99a7e0d
@jonase authored
Showing with 7 additions and 3 deletions.
  1. +7 −3 src/eastwood/linters/unused.clj
10 src/eastwood/linters/unused.clj
@@ -30,7 +30,9 @@
;; Unused fn args
-(def ^:private ignore-args '#{_ &env &form})
+(defn- ignore-arg? [arg]
+ (or (contains? #{'&env '&form} arg)
+ (.startsWith (name arg) "_")))
(defn- params [fn-method]
(let [required (:required-params fn-method)
@@ -55,8 +57,10 @@
(let [fn-exprs (->> (mapcat expr-seq exprs)
(filter (util/op= :fn-expr)))]
(for [expr fn-exprs
- :let [unused (set/difference (set (map :sym (unused-fn-args* expr)))
- ignore-args)]
+ :let [unused (->> (unused-fn-args* expr)
+ (map :sym)
+ (remove ignore-arg?)
+ set)]
:when (not-empty unused)]
{:linter :unused-fn-args
:msg (format "Function args %s are never used" unused)
Please sign in to comment.
Something went wrong with that request. Please try again.