Add minimal CI/QA checks#11
Open
jrfnl wants to merge 15 commits into
Open
Conversation
schlessera
requested changes
Feb 11, 2025
| --> | ||
|
|
||
| <!-- Use the WordPress Coding Standards as a basis, but with tweaks. --> | ||
| <rule ref="WordPress-Extra"> |
Contributor
There was a problem hiding this comment.
We discussed keeping the code style consistent across repositories last time, but now that I'm seeing the relative size of the code style rules VS the actual code, I'm wondering whether we shouldn't ignore consistency with the main library here, because:
- this code is minimal and has very little to do with the actual library
- we don't expect the same contributors to jump in here as well
- just sticking with something like PSR-12 would get rid of a lot of the custom style rules AND remove the WPCS dependency
Contributor
Author
There was a problem hiding this comment.
Happy to change the PR to PSR12 + some extra rules instead. Will need to wait for our next session though as I won't have time to do this now.
Contributor
Author
There was a problem hiding this comment.
Updated now anyway:
- PR has been rebased after Composer: remove
autoloaddirective #12 was merged. - I've created a new PHPCS ruleset based on PSR-12 with a few tweaks (6d5b962693712a14f265b912eebeebb5bee9d1d2)
The most important tweak is probably enforcing tab indentation instead of space indentation. I did so to keep the code churn lower as otherwise every single line in the code base would have needed to be touched. - I've redone the fixes to comply with the new ruleset (+ some extra).
- I've updated the PR description to match the new commits.
Note: the change which moved the parse_params_rfc() function to a separate file is no longer needed now, so has been removed.
49fbd6c to
3084f5e
Compare
Command used: ```bash composer-normalize --indent-size=1 --indent-style=tab --profile --no-plugins --no-scripts ```
This commit: * Adds a new `dev` dependency on PHP Parallel Lint for linting PHP files. * Adds a Composer script documenting how this should be run. * Adds a GitHub Actions workflow to run PHP linting against all supported PHP versions. * Ensures that no `composer.lock` file will be created by default. * Ensures that a potentially pre-existing `composer.lock` file and the `vendor` directory do not get committed to the repo.
As there is now a GH Actions workflow, it should be kept up to date.
This commit: * Adds new `dev` dependencies on PHPCompatibility and PHP_CodeSniffer. * Adds a PHPCS configuration file to use PSR-12 with some tweaks (tab-indent instead of spaces + a few extra rules). * Adds Composer scripts documenting how this should be run. * Adds a GitHub Actions job to run PHPCS on all commits. * Ensures that local overrides of the PHPCS config do not get committed to the repo.
3084f5e to
17146ac
Compare
Contributor
Author
|
Force pushed without changes as I want to see a build against the current PHP 8.5 ;-) |
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.
.gitignore: use top-level file instead of per-directory
Composer: normalize the file
Command used:
Composer: update maintainers list
CI: lint the PHP files against all supported versions
This commit:
devdependency on PHP Parallel Lint for linting PHP files.composer.lockfile will be created by default.composer.lockfile and thevendordirectory do not get committed to the repo.Add dependabot configuration
As there is now a GH Actions workflow, it should be kept up to date.
CI: run QA on GHA workflows
[UPDATED] CI: run PHPCS over the code
This commit:
devdependencies on PHPCompatibility and PHP_CodeSniffer.[UPDATED] CS: consistent whitespace use
CS/QA: use short arrays
CS/QA: always use braces for control structures
CS/QA: multi-statement alignment for readabilityCS/QA; use pre-(in|de)crement rather than postCS/QA: move function to its own file🆕 Response: rename method to CamelCase
[UPDATED] CS/QA: miscellaneous other fixes
PHP-cross version: ensure same output independently of PHP version
CS/QA: use static closures (not enforced)
CS/QA: strict comparisons (not enforced)
PHPCS: add select ignore annotations