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

Consider silencing the UnusedVariable violation #498

Closed
GaryJones opened this issue Jul 13, 2020 · 3 comments · Fixed by #620
Closed

Consider silencing the UnusedVariable violation #498

GaryJones opened this issue Jul 13, 2020 · 3 comments · Fixed by #620

Comments

@GaryJones
Copy link
Contributor

From #449:

We could also take this opportunity is taken to silence the UnusedVariable violation. It's severity is already dropped down to 1 for WordPress-VIP-Go, which is the same as what the bot runs at (though this may change in the future). From a VIP perspective, unused variables are not important.

What problem would the enhancement address for VIP?

It would reduce the number of violation comments. Although it's not ideal to have values being to variables that are then unused (waste of memory), it's not a severe enough impact to typically worry about.

If clients were keen on this, they could run the VariableAnalyis sniff (or static analysis tools or the inspector plugin for PHPStorm), to find these.

Describe the solution you'd like

Discuss and consider silencing the UnusedVariable violation.

What code should be reported as a violation?

...

What code should not be reported as a violation?

...

@GaryJones
Copy link
Contributor Author

One example where this is useful, would be when subsequent usages of a variable have a different name:

$foo_example = 'bar';
...
if ( $fo_example ) {...

@GaryJones
Copy link
Contributor Author

No discussion, so punting.

@GaryJones GaryJones modified the milestones: 2.2.0, 2.3.0 Sep 3, 2020
@rebeccahum
Copy link
Contributor

I'd like to see VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable silenced as well, and the other ones brought down in severity.

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