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

chore: handle unused variables (phpcs) #2902

Merged

Conversation

justlevine
Copy link
Collaborator

What does this implement/fix? Explain your changes.

This PR adds the SlevomatCodingStandard.Variables.UnusedVariable sniff to our PHPCS ruleset and remediates any unused variables in our codebase.

The individual smells that required @jasonbahl 's expertise in #2830 were committed individually to expose those changes, especially 69854f6 which reads like a bugfix.

Based off of #2901 (and requires that to be merged first).

Does this close any currently open issues?

Cherrypicked from #2830

Any relevant logs, error output, GraphiQL screenshots, etc?

Any other comments?

Where has this been tested?

Operating System:

WordPress Version:

@@ -110,28 +110,28 @@ protected function init() {
return ! empty( $this->data->public ) ? (bool) $this->data->public : true;
},
'hierarchical' => function () {
return ( true === $this->data->hierarchical ) ? true : false;
return true === $this->data->hierarchical;
Copy link

Choose a reason for hiding this comment

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

Avoid too many return statements within this method.

},
'showUi' => function () {
return ( true === $this->data->show_ui ) ? true : false;
return true === $this->data->show_ui;
Copy link

Choose a reason for hiding this comment

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

Avoid too many return statements within this method.

},
'showInMenu' => function () {
return ( true === $this->data->show_in_menu ) ? true : false;
return true === $this->data->show_in_menu;
Copy link

Choose a reason for hiding this comment

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

Avoid too many return statements within this method.

},
'showInNavMenus' => function () {
return ( true === $this->data->show_in_nav_menus ) ? true : false;
return true === $this->data->show_in_nav_menus;
Copy link

Choose a reason for hiding this comment

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

Avoid too many return statements within this method.

},
'showCloud' => function () {
return ( true === $this->data->show_tagcloud ) ? true : false;
return true === $this->data->show_tagcloud;
Copy link

Choose a reason for hiding this comment

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

Avoid too many return statements within this method.

@codeclimate
Copy link

codeclimate bot commented Aug 14, 2023

Code Climate has analyzed commit 3bf8f33 and detected 23 issues on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 23

View more on Code Climate.

@coveralls
Copy link

Coverage Status

coverage: 84.948% (+0.008%) from 84.94% when pulling 3bf8f33 on justlevine:chore/handle-unused-variables into 1a8933c on wp-graphql:develop.

jasonbahl
jasonbahl previously approved these changes Aug 15, 2023
@justlevine justlevine dismissed jasonbahl’s stale review August 15, 2023 14:23

The merge-base changed after approval.

@jasonbahl jasonbahl merged commit 67b5a6d into wp-graphql:develop Aug 15, 2023
24 of 25 checks passed
@justlevine justlevine deleted the chore/handle-unused-variables branch August 15, 2023 14:28
@jasonbahl jasonbahl mentioned this pull request Aug 23, 2023
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

Successfully merging this pull request may close these issues.

None yet

3 participants