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

Feature: Site Health #57

Merged
merged 5 commits into from
Dec 7, 2023
Merged

Feature: Site Health #57

merged 5 commits into from
Dec 7, 2023

Conversation

srtfisher
Copy link
Member

@srtfisher srtfisher commented Dec 6, 2023

Screenshot 2023-12-06 at 4 47 30 PM

Adds a Site Health screen panel with information about the enabled/disabled features of the plugin.

Resolves #53.

Summary by CodeRabbit

  • New Features

    • Enhanced the Site Health screen with additional diagnostic information for the Alleyvate plugin.
  • Refactor

    • Improved the feature loading process with new functions for better maintainability.
  • Tests

    • Added new tests to ensure the Site Health feature operates correctly.
  • Documentation

    • Updated documentation to reflect changes in the feature loading process.

@srtfisher srtfisher requested a review from a team as a code owner December 6, 2023 21:47
Copy link

coderabbitai bot commented Dec 6, 2023

Walkthrough

The codebase has been updated to include a new Site_Health class that adds a section to the WordPress Site Health tool, displaying the status of Alleyvate features. This update also refactors the feature loading process, splitting the load function into available_features and load, and introducing should_load_feature to determine if a feature should be loaded. Additionally, a test class Test_Site_Health has been added to ensure the site health feature behaves as expected.

Changes

File Path Change Summary
src/.../features/class-site-health.php Added Site_Health class implementing Feature interface with boot and add_debug_information methods.
src/.../load.php Split load function into available_features and load, added should_load_feature function.
tests/.../features/test-site-health.php Added Test_Site_Health class extending Test_Case with setUp and test_site_health_feature methods.
tests/bootstrap.php Included "wp-alleyvate.php" file to introduce new functionality.

Assessment against linked issues

Objective Addressed Explanation
Add a new section to Site Health > Info called Alleyvate (#53)
Populate the section with read-only information about each feature, whether it is active or inactive (#53)

Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • If you reply to a review comment from CodeRabbit, the bot will automatically respond.
  • To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment
  • Note: Review comments are made on code diffs or files, not on the PR overview.
  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Note: For conversation with the bot, please use the review comments on code diffs or files.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 2

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 4665bec and 1b78fd4.
Files selected for processing (4)
  • src/alley/wp/alleyvate/features/class-site-health.php (1 hunks)
  • src/alley/wp/alleyvate/load.php (1 hunks)
  • tests/alley/wp/alleyvate/features/test-site-health.php (1 hunks)
  • tests/bootstrap.php (1 hunks)
Additional comments: 5
src/alley/wp/alleyvate/features/class-site-health.php (1)
  • 37-58: The implementation of the add_debug_information method correctly extends the Site Health debug information following WordPress best practices.
src/alley/wp/alleyvate/load.php (3)
  • 20-31: The available_features function is well-implemented, returning an associative array of feature instances. This structure allows for easy addition or removal of features in the future.

  • 40-61: The should_load_feature function correctly uses WordPress filters to allow for conditional loading of features. This provides flexibility and control over the feature loading process.

  • 67-77: The refactored load function properly checks for the existence of the Feature interface and iterates over the available features, booting them if they pass the should_load_feature check. This is a clean and efficient implementation of the feature loading process.

tests/bootstrap.php (1)
  • 17-17: The addition of the require_once statement for "wp-alleyvate.php" is consistent with the PR objectives to prepare the test environment for the new site health feature.

src/alley/wp/alleyvate/features/class-site-health.php Outdated Show resolved Hide resolved
tests/alley/wp/alleyvate/features/test-site-health.php Outdated Show resolved Hide resolved
Copy link
Contributor

@mogmarsh mogmarsh left a comment

Choose a reason for hiding this comment

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

👍 I like this!

@srtfisher srtfisher enabled auto-merge (squash) December 7, 2023 14:51
@srtfisher srtfisher merged commit 1d6d55a into main Dec 7, 2023
7 checks passed
@srtfisher srtfisher deleted the feature/53-site-health branch December 7, 2023 14:52
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 48af3b5 and b715316.
Files selected for processing (2)
  • src/alley/wp/alleyvate/features/class-site-health.php (1 hunks)
  • tests/alley/wp/alleyvate/features/test-site-health.php (1 hunks)
Additional comments: 4
src/alley/wp/alleyvate/features/class-site-health.php (3)
  • 23-59: The implementation of the Site_Health class with its methods boot and add_debug_information aligns with the PR objectives and the provided summaries. The boot method correctly attaches the add_debug_information method to the 'debug_information' hook, and the add_debug_information method properly constructs the diagnostic information for the Site Health screen.

  • 42-56: The use of array_map with an arrow function to generate the list of features and their statuses is efficient and concise. It ensures that the wp-alleyvate section of the Site Health screen will contain a list of all features with their enabled/disabled status.

  • 37-40: The defensive programming approach in add_debug_information to ensure $info is an array before proceeding with modifications is a good practice for robustness and avoiding potential errors.

tests/alley/wp/alleyvate/features/test-site-health.php (1)
  • 23-60: The test implementation for the Site Health feature appears to be correct and uses modern PHP features such as typed properties. Ensure that the use of the non-prefixed hook name 'debug_information' is intentional and adheres to the WordPress coding standards.

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.

Add Current Alleyvate Settings to Site Health
2 participants