refactor: DRY quicktree action form wrappers#10
Open
somethingwithproof wants to merge 2 commits intoCacti:mainfrom
Open
refactor: DRY quicktree action form wrappers#10somethingwithproof wants to merge 2 commits intoCacti:mainfrom
somethingwithproof wants to merge 2 commits intoCacti:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Refactors the QuickTree plugin’s action form wrapper scaffolding to reduce duplication by introducing shared begin/end helpers and routing existing add_tree/add_branch flows through them.
Changes:
- Added shared
quicktree_action_form_begin()/quicktree_action_form_end()helpers inui_helpers.php. - Updated
quicktree.phpto include the helper file and use the shared wrappers foradd_treeandadd_branch. - Added a standalone regression test validating wrapper call order and verifying helper usage in
quicktree.php.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| ui_helpers.php | Introduces shared begin/end helpers for QuickTree action form scaffolding. |
| quicktree.php | Replaces duplicated wrapper code in add_tree/add_branch with the shared helpers and includes the helper file. |
| tests/test_form_wrapper.php | Adds regression coverage for wrapper call order and helper adoption in quicktree.php. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
tests/test_form_wrapper.php
Outdated
Comment on lines
+87
to
+95
| strpos($source, "include_once('plugins/quicktree/ui_helpers.php');") !== false | ||
| ); | ||
| assert_true( | ||
| 'quicktree.php uses begin wrapper in add-tree and add-branch', | ||
| substr_count($source, 'quicktree_action_form_begin(') >= 2 | ||
| ); | ||
| assert_true( | ||
| 'quicktree.php uses end wrapper in add-tree and add-branch', | ||
| substr_count($source, 'quicktree_action_form_end();') >= 2 |
Author
There was a problem hiding this comment.
Addressed in 03a99e7: switched source assertions to regex-based checks and added readability guards to reduce quote/whitespace brittleness.
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.
Summary
ui_helpers.phpadd_treeandadd_branchform wrappers through shared begin/end helpersTests
php -l quicktree.phpphp -l ui_helpers.phpphp -l tests/test_form_wrapper.phpphp tests/test_form_wrapper.phpCloses #9