Skip to content

QL: Query for detecting unused parameter in override methods #9827

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

Merged
merged 3 commits into from
Nov 11, 2022

Conversation

erik-krogh
Copy link
Contributor

@erik-krogh erik-krogh commented Jul 14, 2022

All current results are benign because the type of the unmentioned parameter is small.
But it is very hard to statically determine that the type is small. (E.g. one is an abstract class, where all (transitive) overrides are small).

The fix to remove the alert for the benign results is just to insert exists(param) instead of any().

I did try to remove the pred.hasAnnotation("override") restriction, but that just gave me more noise.

@erik-krogh erik-krogh force-pushed the overrideAny branch 3 times, most recently from 684ddb8 to 43907d0 Compare August 16, 2022 06:56
@erik-krogh erik-krogh changed the title QL: (WIP) Query for detecting unused parameter. QL: Query for detecting unused parameter in override methods Aug 16, 2022
@erik-krogh erik-krogh marked this pull request as ready for review August 16, 2022 07:03
@erik-krogh erik-krogh requested a review from a team as a code owner August 16, 2022 07:03
kaeluka
kaeluka previously approved these changes Nov 8, 2022
Copy link

@kaeluka kaeluka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if the very-high precision makes sense, since the query (in practice) tends to find benign cases. Alternatively, perhaps have the message explain the problem a bit better.

Other than that, I'd only improve the error message a bit to make the fix a bit easier.

The warnings found look good to me (JS and others).

Giving an approve as most of this is quite opinionated and I want the decision to be your's 👍

Copy link

@kaeluka kaeluka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@erik-krogh erik-krogh merged commit 2291f18 into github:main Nov 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants