jonase / eastwood

Clojure lint tool
1.08k stars 66 forks source link

Interpret :arglists using "regex" notation #399

Open vemv opened 3 years ago

vemv commented 3 years ago

:arglists can use a regex notation:, ?, *, + e.g. https://github.com/clojure/clojure/blob/b1b88dd25373a86e41310a525a21b497799dbbf2/src/clj/clojure/core.clj#L7724-L7726

Eastwood could make a best-effort at expanding these to & syntax (internally, non-mutatively) so that defns using such notation don't trigger :bad-arglists faults.

Worst-case scenario, any fault coming from an :arglist using regex notation could be automatically omitted.

Finally, if implementing this we could remove https://github.com/jonase/eastwood/blob/2e58aba73c9e39fa98ab46a2ead50d9ec31961e7/resource/eastwood/config/clojure.clj#L113-L117


(note that ? can more often than not will signal a boolean/predicate)

seancorfield commented 3 years ago

Or, you know, Eastwood could use the actual declared argument list for arity checking, like clj-kondo does which would obviate the need for all that custom config that Eastwood has had to add over the years to deal with code that uses "human-readable" :arglists metadata (dating back to at least 2014).

vemv commented 3 years ago

I think we have the same thing in mind: my issue describes interpreting :arglists metadata smartly. disable-warning would be generally no longer needed for this specific linter.

vemv commented 3 years ago

Eastwood 0.9.7 silences all honeysql false positives for :wrong-arity

I'd still like to interpret the regexes more smartly in a future!