Add reusable code complexity workflow #8#10
Open
olatechpro wants to merge 6 commits into
Open
Conversation
… actionable output
…e class/package context when file paths are unavailable.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The workflow should identify overly complex functions/classes that might need refactoring using PHPMetrics to surface cognitive complexity issues to fix #8
Edit:
@andergmartins I initally used
PHPMetricsbut later switched toPHPMD, due toPHPMetricsnot showing affected file lines and code.@andergmartins @stevejburge I tested this on cart here https://github.com/publishpress/publishpress-cart/pull/197 which ofcourse I expect to have alot of violations as can be seen in the workflow failing results https://github.com/publishpress/publishpress-cart/actions/runs/26032382011/job/76521454324?pr=197, that contain thousands of violation.
It's very similar to WordPress VIP scan but only for coding standard. So, this is ideally not usable unless the whole plugin is refactor. Most of our plugins will probably failed this workflow too but maybe it worth keeping for future use hoping our plugins will one day meet the right standard, if not old but new future plugins by having this test on them from the beginning?