Skip to content
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

new rule for unused parameter of implemented method #934

Open
clement-brodu opened this issue Jan 19, 2022 · 2 comments
Open

new rule for unused parameter of implemented method #934

clement-brodu opened this issue Jan 19, 2022 · 2 comments

Comments

@clement-brodu
Copy link
Contributor

Hello,

Here is my case:

INTERFACE IGetLabel:

    METHOD PUBLIC CHARACTER GetLabel( INPUT pCode AS CHARACTER ).

END INTERFACE.
CLASS MyObject IMPLEMENTS IGetLabel:

    METHOD PUBLIC CHARACTER GetLabel( INPUT pCode AS CHARACTER ):     
       RETURN "Hello".
    END METHOD.

END CLASS.

In MyObject, the pCode parameter is not used in the method (it's a bug in my code).

Usually, "Unused parameter should be removed" rule show me this error and I can fix or ignore it.
But because this method come from my interface, this rule doesn't show any error (that's legit).

May be we should have a new rule for unused parameters of inherited/implemented method ?

Thanks,

@gquerret
Copy link
Contributor

This case is specifically excluded from the existing rule, as there's nothing you can do if you don't have any usage for this variable.
It could technically be possible to have a separate rule for that, but to my mind, it will report way too many false positives.

@clement-brodu
Copy link
Contributor Author

For me, a separate rule is the best choice.
The name could be "Unused parameter for implemented method"

False positive could be ignored with {&_proparse_ prolint-nowarn(varusage)}.
But for me, if the parameter is not used, it's probably an error.

And if people are not interested with this, they could disable the rule.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants