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
Report mismatch between specified and given arguments in datalog queries #900
Comments
@tatut Linting datalog is handled by https://github.com/lambdaforge/datalog-parser. So if you could also post this over there, or link to this issue from other there, the maintainers of that library can maybe pick it up. |
It looks like the datalog-parser doesn't actually check the |
The maintainers also wrote the integration in clj-kondo of that library, so still good to bring it up there I think. Or ping them here. @whilo |
Maybe the call to datalog/parse could receive some options, e.g. the number of inputs or the remaining argument nodes, so it can be accounted for during the parsing and validation. |
@tatut That is a very reasonable suggestion and a nice example of integration of static analysis on the boundaries between different languages. The only thing necessary for this is to match the sources parsed |
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! |
Is your feature request related to a problem? Please describe.
For example a datomic query can mistakenly omit the
:in
definitionsfrom a query, causing the query to return too many results.
The missing
:in $ ?user
defaults to:in $
which doesn't match the givenargument counts (2,
db
anduser
).Describe the solution you'd like
clj-kondo could report something like "query expects 1 argument, but 2 are given" when we can see that the argument counts have a mismatch.
Describe alternatives you've considered
Alternative is to create a wrapper macro to catch this at compile time.
The text was updated successfully, but these errors were encountered: