jonase/eastwood

clojure.core.async/alt!! false positive with Eastwood 0.9.9 - "suspicious-expression: or called with 1 args"

karolinepauls opened this issue · 2 comments

Triggering code:

(ns abc.core
  (:require [clojure.core.async :as async]))

(defn false-positive-alt!! []
  (async/alt!! (async/chan) ([_] nil)
               (async/chan) ([_] nil)))

(No similar problem with alts!!).

Output:

$ lein with-profile -user eastwood
Tried to load org.clojure/data.codec version 0.1.1 but 0.1.0 was already loaded.
Tried to load nrepl version 0.4.0 but 0.8.3 was already loaded.
== Eastwood 0.9.9 Clojure 1.10.1 JVM 11.0.11 ==
Directories scanned for source files: src test
== Linting abc.core ==
src/abc/core.clj:10:3: suspicious-expression: or called with 1 args. (or x) always returns x. Perhaps there are misplaced parentheses?
src/abc/core.clj:10:3: suspicious-expression: or called with 1 args. (or x) always returns x. Perhaps there are misplaced parentheses?
== Linting abc.core-test ==
== Linting done in 3156 ms ==
== Warnings: 2. Exceptions thrown: 0
Error encountered performing task 'eastwood' with profile(s): 'base,system,provided,dev'
Subprocess failed (exit code: 1)

Suppressing confguration:

(disable-warning
 {:linter :suspicious-expression
  :for-macro 'clojure.core/or
  :if-inside-macroexpansion-of #{'clojure.core.async/alt!!}
  :within-depth 6
  :reason "clojure.core.async/alt!! triggers suspicious or"})

Invoking eastwood with configuration:

$ lein with-profile -user eastwood '{:config-files ["eastwood.clj"]}'

Can I just make a pull request adding the configuration to the default exclusions, assuming the config is OK? Is there anything particularly tricky about testing?

vemv commented

Hi, thanks for the repro and silencing!

I'll create a commit with it and anything else that might be worth bundling. Will make sure to credit you.

Cheers - V

vemv commented

1.0.0 is out!