Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interpret :arglists using "regex" notation #399

Open
vemv opened this issue Jun 22, 2021 · 3 comments
Open

Interpret :arglists using "regex" notation #399

vemv opened this issue Jun 22, 2021 · 3 comments

Comments

@vemv
Copy link
Collaborator

vemv commented Jun 22, 2021

: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

(disable-warning
{:linter :wrong-arity
:function-symbol 'clojure.core/eduction
:arglists-for-linting '([& xform])
:reason "eduction takes a sequence of transducer with a collection as the last item"})


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

@seancorfield
Copy link

seancorfield commented Jun 22, 2021

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
Copy link
Collaborator Author

vemv commented Jun 22, 2021

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
Copy link
Collaborator Author

vemv commented Aug 20, 2021

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants