Skip to content

Conversation

@costdev
Copy link
Member

@costdev costdev commented Jun 24, 2025

This adds coding standards heavily based on the Human Made Coding Standards, with some modifications to suit our needs.

Ruleset changes

  • Generic.Functions.CallTimePassByReference is excluded as it's deprecated in PHPCS and will be removed in 4.0.0.
  • HM.Debug.ESLint is excluded as scanning CSS/JS files is deprecated in PHPCS and will be removed in 4.0.0.
  • HM.Files.FunctionFileName.WrongFile is excluded for plugin.php as it's the main plugin file.
  • PSR1.Files.SideEffects is excluded for plugin.php and tests/phpunit/bootstrap.php as they intentionally define symbols and execute code.
  • Excluded for test files:
    • WordPress.Files.FileName
    • HM.Files.ClassFileName
    • HM.Functions.NamespacedFunctions.MissingNamespace
    • PSR1.Classes.ClassDeclaration.MissingNamespace

Development scripts

The following scripts have been added:

  • Composer
    • composer run lint - Runs PHPCS against the codebase.
    • composer run format - Runs PHPCBF against the codebase.
  • NPM
    • npm run lint:php - Runs PHPCS against the codebase inside the cli container.
    • npm run format:php - Runs PHPCBF against the codebase inside the cli container.

This PR also includes a coding standards workflow for GitHub Actions.

Codebase changes

This PR includes various fixes to ensure the codebase complies with the coding standards. These are separated into different commits, prefixed with "Fix:", "Ignore:" or "Disable:".


Fixes #128

@costdev costdev requested review from afragen and rmccue June 24, 2025 16:18
Copy link
Contributor

@afragen afragen left a comment

Choose a reason for hiding this comment

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

Now working (for me)

@afragen afragen dismissed their stale review June 26, 2025 15:06

Fixed

@afragen afragen self-requested a review June 26, 2025 16:52
@costdev costdev force-pushed the coding_standards branch from 3f1d6e3 to 94b0eae Compare June 26, 2025 16:57
costdev added 19 commits June 26, 2025 17:58
Signed-off-by: costdev <[email protected]>
Signed-off-by: costdev <[email protected]>
Signed-off-by: costdev <[email protected]>
costdev and others added 15 commits June 26, 2025 17:58
Signed-off-by: costdev <[email protected]>
Co-authored-by: Andy Fragen <[email protected]>
Signed-off-by: Colin Stewart <[email protected]>
@costdev costdev force-pushed the coding_standards branch from 94b0eae to 039a690 Compare June 26, 2025 16:58
@costdev costdev merged commit 0dc693b into main Jun 26, 2025
46 checks passed
@costdev costdev deleted the coding_standards branch June 26, 2025 17:11
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 Coding Standards

3 participants