Skip to content

Code style#23

Merged
lloc merged 9 commits intomasterfrom
code-style
Oct 12, 2025
Merged

Code style#23
lloc merged 9 commits intomasterfrom
code-style

Conversation

@lloc
Copy link
Owner

@lloc lloc commented Oct 12, 2025

This adds automatic code-styling to the repository.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @lloc, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces automated code styling to the repository, aiming to improve code consistency and maintainability. It integrates PHP_CodeSniffer with WordPress coding standards and sets up a pre-commit Git hook to automatically format PHP files, ensuring that all future contributions adhere to the established style guidelines.

Highlights

  • Automated Code Styling: Implemented automatic code styling using PHP_CodeSniffer and phpcbf to enforce consistent code standards across the project.
  • WordPress Coding Standards: Configured PHP_CodeSniffer to use the WordPress coding standards, with specific exclusions for certain docblock and file naming rules.
  • Pre-commit Hook: Introduced a Git pre-commit hook that automatically formats staged PHP files using phpcbf before they are committed, ensuring all new code adheres to the defined style.
  • Dependency Updates: Added wp-coding-standards/wpcs and dealerdirect/phpcodesniffer-composer-installer to composer.json to support the new styling tools.
  • Code Refactoring: Applied initial code style fixes to MslsMenu.php, including updating array syntax, adding strict comparison to in_array, and minor docblock adjustments.
  • Configuration Management: Renamed phpstan.neon to .phpstan.neon.dist and updated .distignore and .gitignore to properly manage new configuration and cache files.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces automatic code styling using PHP_CodeSniffer, which is a great step for maintaining code quality. The changes apply WordPress coding standards across the codebase. My review focuses on the implementation of the new tooling. I've found a significant issue in the pre-commit hook that prevents it from using the project's custom ruleset, along with a few minor improvements for the hook script and configuration files.

.phpcs.xml.dist Outdated
</rule>
<rule ref="WordPress-Extra"/>
<rule ref="WordPress-Docs"/>
</ruleset> No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This file is missing a newline character at the end. It's a POSIX standard and general best practice to end text files with a newline.

lloc and others added 5 commits October 12, 2025 14:39
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@lloc lloc merged commit c4f157d into master Oct 12, 2025
3 of 4 checks passed
@lloc lloc deleted the code-style branch October 12, 2025 12:46
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.

1 participant