protorepl

seancorfield 2017-08-24T00:00:47.000017Z

@rgdelato Since you're the maintainer of that package, I hope you don't mind questions about it here?

rgdelato 2017-08-24T00:01:03.000230Z

sure, I'll answer as best as I can

seancorfield 2017-08-24T00:02:40.000188Z

I have the following code:

(api/with-validated-params [::api-spec/reset-new-stats nil]
    (act/visit (:user-id-int params) (:pagename params))
    (resp/response {})))
and it flags params as being undeclared -- I've told Joker that api.support/with-validated-params is a macro but that hasn't helped (the macro introduces that symbol).

rgdelato 2017-08-24T00:03:44.000072Z

Hmm. I don't know. Can you be a bit more specific? Where is your .joker file located and what exactly does it contain?

seancorfield 2017-08-24T00:04:44.000122Z

{:known-macros [api.support/with-validated-params
                api/with-validated-params]}
Just in case it didn't understand the ns alias of api.support to api, and it's in a parent folder a few levels up from that source file.

rgdelato 2017-08-24T00:06:25.000258Z

That looks okay. Give me a sec, I'll try and reproduce the issue

seancorfield 2017-08-24T00:08:25.000247Z

Looks like a limitation on how :known-macros works. If I have (api/with-validated-params foo ...) it won't flag that, but it doesn't understand a macro may introduce new names it seems.

rgdelato 2017-08-24T00:10:06.000025Z

yeah, I'm seeing the same behavior as well

seancorfield 2017-08-24T00:10:12.000131Z

I'll go open an issue on Joker.

rgdelato 2017-08-24T00:10:27.000037Z

thanks, sorry about that

seancorfield 2017-08-24T00:14:38.000190Z

https://github.com/candid82/joker/issues/20

seancorfield 2017-08-24T00:16:56.000139Z

I could change the macro to require the symbol name in the vector that is the first argument -- updating the code to

(api/with-validated-params [params ::api-spec/reset-new-stats nil]
    (act/visit (:user-id-int params) (:pagename params))
    (resp/response {})))
makes the error go away (interestingly, Joker thinks the symbol is a top-level one, and all references to params pass the linter at that point!)

seancorfield 2017-08-24T00:17:30.000070Z

Which means Joker doesn't understand binding-style macros, I suspect...

seancorfield 2017-08-24T00:17:57.000025Z

It's still extremely useful -- it found a bunch of unused namespace requires in the very first file I popped open!

seancorfield 2017-08-24T00:20:53.000102Z

It also spotted an if-let that should have been just an if (the introduced local symbol was not used).

sparkofreason 2017-08-24T03:43:17.000197Z

I had to create a .joker file for this to work on Windows, but it is now working. Pretty cool.

sparkofreason 2017-08-24T03:59:16.000082Z

Does joker understand namespace aliases? I'm getting an error on a keyword using an aliased namespace. Actually, I don't think the namespace even exists, it's clojure.spec.test.check.

sparkofreason 2017-08-24T17:20:33.000433Z

@rgdelato For CLJC files, it appears that linter-joker only runs joker with the --lintclj option, since it doesn't catch errors in #?(:cljs ...) blocks. I am able to see CLJS errors if I run with --lintcljs from the command line.

rgdelato 2017-08-24T17:28:09.000104Z

yeah, Joker doesn't have a --cljc option, and so it defaults to clj

sparkofreason 2017-08-24T21:00:59.000337Z

@rgdelato I tried to hack joker to have a`--cljc` that just ran lint twice, but it seems pretty deeply wired to run exactly once. Seems like it should be possible to run the command line joker twice from linter-joker. I'd be willing to take a shot at that and make a PR if successful. If you have any pointers, please let me know.