Skip to content

Conversation

@n7studios
Copy link
Contributor

@n7studios n7studios commented Sep 9, 2025

Summary

Registers a number of commands in the scripts section of Composer, which serve as shorthand commands for testing and other common tasks performed in development, to save repetitively typing longer commands with commonly used flags / arguments.

Command Description
phpcs Runs PHP CodeSniffer on the entire plugin codebase
phpcs-tests Runs PHP CodeSniffer specifically on the tests directory using test-specific standards
phpstan Runs PHPStan static analysis with increased memory limit
test-integration Builds and runs integration tests with fail-fast enabled

Adds alias commands:

Command Description
coding-standards Runs PHP CodeSniffer on the entire plugin codebase
fix-coding-standards Runs PHP CodeSniffer specifically on the tests directory using test-specific standards
coding-standards-on-tests Runs PHPStan static analysis with increased memory limit
fix-coding-standards-on-tests Builds and runs end-to-end tests with fail-fast enabled
static-analysis Builds and runs integration tests with fail-fast enabled

Commands can be run using e.g. composer test-integration or composer static-analysis

Screenshot 2025-06-19 at 20 07 30

Testing

Existing tests pass

Checklist

@n7studios n7studios self-assigned this Sep 9, 2025
@n7studios n7studios added the enhancement New feature or request label Sep 9, 2025
@n7studios n7studios requested review from a team, corydhmiller and noelherrick and removed request for a team September 9, 2025 08:47
@n7studios n7studios marked this pull request as ready for review September 9, 2025 08:47
Copy link

@noelherrick noelherrick left a comment

Choose a reason for hiding this comment

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

You got me wondering if we should alias these with generalized names, like you did with "test-integration":

  • run-coding-standards(-on-tests)
  • run-beautifier(-on-tests)
  • run-static-analysis

Thoughts?

@n7studios
Copy link
Contributor Author

You got me wondering if we should alias these with generalized names, like you did with "test-integration":

  • run-coding-standards(-on-tests)
  • run-beautifier(-on-tests)
  • run-static-analysis

Thoughts?

run- seems unnecessary, given all composer commands are running something (e.g. composer update is built in and updates the packages used for testing).

Command names match the underlying command where possible, to save developers guessing (e.g. composer phpcs runs vendor/bin/phpcs ./ -s -v), unless renaming makes it clearer (e.g. composer test runs both vendor/bin/codecept build @no_additional_args and vendor/bin/codecept run EndToEnd @additional_args --fail-fast).

For a full list of commands used in the Plugins, see the table in this PR. We don't have e.g. composer test here, as there are only integration tests for WordPress Libraries.

If you think there are improvements that can be made, let me know and I'm open to updating each Plugin to reflect this.

@noelherrick
Copy link

I suggested aliases because as someone who's not using these commands daily, I was vaguely aware that we had a linter/coding standards tool, didn't know we had a beautifier, and thought the PHPStan was the main automatic tool we were using. My thought was to add aliases as a way to document the different code tools.

@n7studios
Copy link
Contributor Author

n7studios commented Sep 11, 2025

I suggested aliases because as someone who's not using these commands daily, I was vaguely aware that we had a linter/coding standards tool, didn't know we had a beautifier, and thought the PHPStan was the main automatic tool we were using. My thought was to add aliases as a way to document the different code tools.

These commands are already well documented, including what each one does. At a minimum, anyone not working in these repos daily should review that doc to understand what’s available and how to use it. As someone who does use them daily, I’d find it confusing if the commands suddenly changed.

That said, if you’d find aliases useful, let me know the list and I’ll add them. I don’t think it’s worth a lengthy back and forth beyond that, given the time cost.

Alias commands added. Original commands remain as faster to type and use for my development workflow.

@n7studios n7studios merged commit ef3c162 into main Sep 12, 2025
23 of 43 checks passed
@n7studios n7studios deleted the composer-add-commands branch December 5, 2025 06:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants