-
Notifications
You must be signed in to change notification settings - Fork 79
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
Add java rule EC24: Optimize Database SQL Queries (Clause LIMIT) #279
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make more sense to implement the EC24 rule for java rather than create a new one? This rule is not in the ecoCode RULES.md
file, only the one in the JavaScript repository, which isn't very clear, I admit...
…pdate CHANGELOG.md
…pdate RULES.md with new EC24 for java
The rule makes sense but I don't see how it's going to be implemented. There are many ways to write SQL queries, and that's not even considering ORMs. |
Hi @Djoums, if you want you can a look to PRs : |
Actually I don't think you can do it, even for the most basic cases. What if the dev writes this : string test = "select * from table". Are you going to raise a warning ? You don't know if that query will be executed or not, and you don't know if it will be limited or not (maybe there's test += " limit 25" somewhere later). You're going to raise a lot of false positives. The way I see it, a code analyzer cannot enforce this rule. This would be a job for the query engine in the DBMS, because it's the only component that knows exactly what's going to be executed and how. |
update rule-specifications for issue #239