Re: Eastwood lint tools - some Qs

2014-01-14 Thread Colin Fleming
Ah, I see - that makes sense, thanks. On 14 January 2014 19:49, Andy Fingerhut wrote: > defn is a macro, and thus macro-expanded during Eastwood analysis, I > believe ignoring the :arglists. I think it is really only the :arglists of > functions that matter for Eastwood :wrong-arity warnings >

Re: Eastwood lint tools - some Qs

2014-01-13 Thread Andy Fingerhut
defn is a macro, and thus macro-expanded during Eastwood analysis, I believe ignoring the :arglists. I think it is really only the :arglists of functions that matter for Eastwood :wrong-arity warnings Andy On Mon, Jan 13, 2014 at 10:22 PM, Colin Fleming wrote: > Interesting - but there must b

Re: Eastwood lint tools - some Qs

2014-01-13 Thread Colin Fleming
Interesting - but there must be some sort of magic there since otherwise every call to defn would be flagged, since its :arglists implies it has 6 arguments. And in fact, there's nothing there indicating that the body is in fact the body. On 14 January 2014 18:56, Andy Fingerhut wrote: > Nicola

Re: Eastwood lint tools - some Qs

2014-01-13 Thread Cedric Greevey
IMO, :eastwood-arglist (and a proliferation of other tool-specific metadata) would be exactly the wrong approach; :arglists should be the real defn-form arglists. Instead there should be an optional :pretty-arglists for documentation generators to use in lieu of :arglists if it is present. That wou

Re: Eastwood lint tools - some Qs

2014-01-13 Thread Andy Fingerhut
Nicola can answer more authoritatively, as I haven't checked that part of tools.analyzer recently, but I am pretty sure that the :arglists with things like doc-string? attr-map? are simply treated as if they were normal positional arguments, with no 'guessing' that they are optional due their symbo

Re: Eastwood lint tools - some Qs

2014-01-13 Thread Ben Wolfson
Actual arglists have a set structure and can be parsed automatically: https://github.com/bwo/macroparser/blob/master/src/macroparser/bindings.clj It's true that you couldn't reconstruct something as informative as the :arglists metadata on defn from the actual declaration, of course. On Mon, Jan

Re: Eastwood lint tools - some Qs

2014-01-13 Thread Colin Fleming
This is an interesting discussion, I've been thinking about some of these problems as I move towards adding inspections in Cursive. arglist parsing is a real problem in Clojure. I'd like to be able to flag invocations of functions with bad arities in the editor, but it's very difficult. Even defn i

Re: Eastwood lint tools - some Qs

2014-01-13 Thread Sean Corfield
On Jan 13, 2014, at 3:09 PM, Nicola Mometto wrote: > To be honest I don't like the idea of libraries attaching not-valid > :arglists meta to Vars at all since the doc[1] for `def` says that :arglists > will be "a list of vector(s) of argument forms, as were supplied to > defn" and the clojure Comp

Re: Eastwood lint tools - some Qs

2014-01-13 Thread Nicola Mometto
Sean Corfield writes: > Sounds like Eastwood should ignore :arglists and just use the actual argument > lists for the arity check, with perhaps an additional lint warning for when > what's in :arglists doesn't match possible real signatures of the function? I > can see the latter being useful

Re: Eastwood lint tools - some Qs

2014-01-13 Thread Sean Corfield
On Jan 13, 2014, at 2:05 PM, Andy Fingerhut wrote: > Eastwood's current use of :arglists for :wrong-arity linter checking is > definitely 'at odds' with the way java.jdbc and some other libraries use it > for clearer documentation of fn/macro args. > Google seems to indicate that :arglists is

Re: Eastwood lint tools - some Qs

2014-01-13 Thread Andy Fingerhut
Sean: Eastwood's current use of :arglists for :wrong-arity linter checking is definitely 'at odds' with the way java.jdbc and some other libraries use it for clearer documentation of fn/macro args. I would recommend leaving :arglists as-is for java.jdbc, and wait for the next version of Eastwood

Re: Eastwood lint tools - some Qs

2014-01-13 Thread Sean Corfield
Thanx for the specific example! Yeah, I've used :arglists for "examples" in a couple of places instead of actual argument lists. I'll fix that in 0.3.3 and may do the same with CongoMongo (although it's a far worse culprit in several areas - and we're in the process of migrating to Monger now a

Re: Eastwood lint tools - some Qs

2014-01-13 Thread Nicola Mometto
Sean, it looks like the issue is caused by arglists like this one: https://github.com/clojure/java.jdbc/blob/master/src/main/clojure/clojure/java/jdbc.clj#L782-L783 tools.analyzer.jvm uses :arglists to detect possible invoke calls with a misplaced arity, expecting that to be a valid value, in you

Eastwood lint tools - some Qs

2014-01-13 Thread Sean Corfield (Clojure)
Just started using this and I see the argslist caveat that causes Eastwood to misdiagnose :wrong-arity (the readme specifies java.jdbc 0.3.x but it also gets tripped up by congomongo). Can you (Andy or Jonas or any other Eastwood user) clarify how the arglists cause the problem and what, if anythi