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
Warn about threading macro with empty forms
argument
#1166
Comments
There might be more functions that just return the argument when called with 1 argument so possibly we could generalize this a bit. We already have:
The difference between the first and the latter is that the first always returned So maybe |
English is not my native language... |
Or just |
A function always returning the same output as its input is called an identity, this is exactly what I think Maybe |
I suggest to ask in slack :-) |
I thought it will sound in practice like |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically marked as expired because it has not had recent activity. To prevent it from being closed, please leave a message. Additionally, consider giving the original message a thumbs up if this issue is important to you, so it will appear higher in this list. Thank you for your contributions! |
Already implemented: $ clj-kondo --lint - <<< '(-> 1)'
<stdin>:1:1: warning: Single arg use of clojure.core/-> always returns the arg itself
linting took 10ms, errors: 0, warnings: 1 |
Is your feature request related to a problem? Please describe.
Sometimes during refactoring my threading macro invocations reduce to the form like
(-> 'x)
.In this case the macro has no effect and can be removed.
Describe the solution you'd like
I would like to get linting warning when threading macro is useless and can be removed.
This is about all macros
->
,->>
,cond->
,cond->>
,some->
,some->>
,as->
anddoto
whenforms
argument is empty.The text was updated successfully, but these errors were encountered: