WordPress / WordPress/plugin-check

Refactoring: Analyzing Abstract_Check_Runner Class for Complexity Reduction

Open
#229 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

[Type] Enhancement
Dominant language
PHP
Stars
362
Forks
126
Avg merge
1d 23h
Merged PRs (30d)
22

Description

Is your enhancement related to a problem? Please describe.

Following up on PR #228, during the code review process, we encountered a warning related to excessive class complexity in the file plugin-check/includes/Checker/Abstract_Check_Runner.php at line 19. The warning message received was:

ExcessiveClassComplexity: The class Abstract_Check_Runner has an overall complexity of 54 which is very high. The configured complexity threshold is 50.

To address this warning, it is recommended that we refactor the code of the Abstract_Check_Runner class to reduce its complexity. Currently, we have temporarily suppressed the warning by adding @SuppressWarnings(PHPMD.ExcessiveClassComplexity) in the class docblock.

This issue aims to investigate and analyze the Abstract_Check_Runner class in order to identify areas where complexity can be reduced.

Please feel free to provide any additional insights or suggestions for the refactoring process.

cc. @swissspidy

Designs

No response

Describe alternatives you've considered

No response

Code of Conduct
  • I agree to follow this project's Code of Conduct

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing plugin-check/includes/Checker/Abstract_Check_Runner.php at line 19 and the complexity warning, then compare the class with the changes discussed in PR #228. Identify which parts contribute to the reported complexity of 54 and document a refactoring approach that reduces it below the configured threshold without relying on the suppression in the class docblock.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
tooling
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.