I don't know exactly how this would look, but I've noticed that lots of defns will have destructured arguments without naming the arguments, which can lead to difficulty understanding what the argument is supposed to be. For example:
(defn update-document
[{:keys [foo bar baz]}
[one-id two-id]
{:keys [attr1 attr2 attr3] format-str :format}]
(...))
Now, you know from reading the first and last arguments that they should be maps, and they need to have specific entries, and you know the middle argument needs to be a vector of at least two items, but without names, it can be difficult to track how a given piece of data flows through code paths.
My idea is something like style/avoid-destructured-parameters or style/prefer-named-arguments or something.
The diagnostic message could be "give the argument a name using :as" or "don't destructure in arguments, only in let binds".
Disabled by default, this one is real spicy and not quite idiomatic.
I don't know exactly how this would look, but I've noticed that lots of defns will have destructured arguments without naming the arguments, which can lead to difficulty understanding what the argument is supposed to be. For example:
Now, you know from reading the first and last arguments that they should be maps, and they need to have specific entries, and you know the middle argument needs to be a vector of at least two items, but without names, it can be difficult to track how a given piece of data flows through code paths.
My idea is something like
style/avoid-destructured-parametersorstyle/prefer-named-argumentsor something.The diagnostic message could be "give the argument a name using
:as" or "don't destructure in arguments, only inletbinds".Disabled by default, this one is real spicy and not quite idiomatic.