gnl/ghostwheel

:check-coverage reporting false-positive for declared >defn

Closed this issue · 2 comments

declare calls seem to trip up coverage checking. When compiled, the following reports that "a" is not declared with >defn.

(ns example.core
  (:require [ghostwheel.core :as g, :refer [>defn =>]]))

(declare a)

(>defn a [x] [int? => int?]
  (* x 2))

(g/check)
gnl commented

The problem here is that when you forward-declare a var like this it sort of masks its metadata in the var list in the namespace metadata which Ghostwheel uses to differentiate between defns and >defns and it can no longer tell the difference.

I'd rather have a false positive than a false negative here, but you can simply override the warning like you would for a regular plain defn since 0.2.3:

(declare ^{::g/check-coverage false} a)

It's a bit of a hassle but since forward declarations aren't needed that often, it shouldn't be a big deal in practice.

gnl commented

Closing this for now but feel free to reopen it if this doesn't solve your problem.