Hello, I am a bit confused, please help Is it possible to disable some linters for one function only? I tried this: https://github.com/jonase/eastwood/blob/master/doc/README-clojure-annotations.md, but it doesnt seem to work…
Hi @kirill.salykin it's a bit tricky, and not always possible. Could you please tell me which linters you'd want to disable (and for which functions?)
basically I want to avoid wrong-arity
check of amazonica functions
`
(get-value [_ key]
;; eastwood: {:suppress-warnings [:wrong-arity]}
(-> (s3/get-object {:access-key aws-access-key-id
:secret-key aws-secret-access-key-id
:endpoint region}
:bucket-name bucket :key key)
:input-stream
slurp))
and same for put-object
is there a way I can exclude all amazonica.*
things?
https://github.com/jonase/eastwood#wrong-arity should explain how to do it.
Problem is that it seems to be done pr symbol and not pr package.
Which means you need to write a disable-warning
for each fn you want ignored.
k, thanks
I’ve added the file ./resources/eastwood/config.clj
:
(disable-warning
{:linter :wrong-arity
:function-symbol 'amazonica.aws.s3/get-object})
(disable-warning
{:linter :wrong-arity
:function-symbol 'amazonica.aws.s3/put-object})
but it doesnt seem to work… what I am doing wrong?
also, seems :exclude-namespaces
also do not work
Regarding your custom disable-warning configurations, did you specify the name of the file that contains those disable-warning expressions in the Eastwood options map with a key :config-files
?
There are several config files like that included with Eastwood, which are read by default, but any that you write will not be read by default -- you must tell Eastwood which ones to read.
Regarding that doc/README-clojure-annotations.md file you found, that is a kind of design/brainstorming document of something that I think would be nice to implement, but it has not been implemented.
I guess it might be nice to say that in the first sentence or two of that file, to avoid misleading folks.
warning added.
yes
`
{:extra-deps {jonase/eastwood {:mvn/version "RELEASE"}}
:main-opts ["-m" "eastwood.lint" "{:source-paths,[\"src\"],:exclude-linters,[:wrong-arity],:config-files,#{\"eastwood.clj\"}}"]}
core/IStore
(get-value [_ key]
(-> (s3/get-object {:access-key aws-access-key-id
:secret-key aws-secret-access-key-id
:endpoint region}
:bucket-name bucket :key key)
:input-stream
slurp))
so, basically get-value
is protocol implementation
wrong-arity
linter complaints about s3/get-object
arity
thus, which function I should exclude?
can I exclude all amazonica functions?
Shall it be added to default configs? (similar to what now done to clojure
and other 3rd parties?It would be good to test it in your application before adding it to the default Eastwood configs, I think, to ensure that it works as you hope.
Looking at the examples of configuring the wrong-arity linter that exist in the Eastwood source code, all of them have a key :arglists-for-linting
, like for this example: https://github.com/jonase/eastwood/blob/master/resource/eastwood/config/clojure.clj#L66-L70
Can you try adding a key like that to your config, with a list of vectors, one for each acceptable arity of s3/get-object
that you think is correct?
will do
Using the one above like ([& args])
should I think disable warnings for that function entirely, because it will allow any number of args
but you can make it do some checking, if you would find that helpful.
worked, thanks a lot!
arglists-for-linting
- thats what I was missing
Yeah, the examples of those configurations could stand a comment or so mentioning that. Looking at it for the first time in a few years, that wasn't obvious to me, either, and I wrote it 🙂
In this case, the use of disable-warning
is definitely misleading. it is more like configure-linter
indeed