-
Notifications
You must be signed in to change notification settings - Fork 70
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
VACMS-15954 Add phpcs baselines #16109
Conversation
@@ -0,0 +1,53 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!-- NOTE: Do not edit this file manually. If regenerating this file, copy this note manually to the new file. --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a note here since the command we need is different from the official guidance at https://github.com/123inkt/php-codesniffer-baseline#create-baseline. Our repo has a custom vendor-dir
so we need to ensure the report-file is generated in the right location.
@@ -8,6 +8,7 @@ | |||
"require-dev": { | |||
"behat/mink": "^1.10", | |||
"behat/mink-browserkit-driver": "^2.1", | |||
"digitalrevolution/php-codesniffer-baseline": "^1.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any procedure to follow when adding new PHP packages?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JunTaoLuo Not at present and not historically.
Side note: Historically we've been bad about adding to require-dev
vs. require
. We install dev dependencies on the AMI that gets used for both staging
and prod
, so it's easy to be sloppy there at present. Something to think about 🙂
- This prevents phpcs from failing due to existing errors - Bulk fix use ordering with phpcbf
507f098
to
0a3c851
Compare
FYI reviewers, changes to most files are from sorting of use statements by phpcbf. The functional changes are in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At a glance LGTM overall. I think AP is a codeowner of va_gov_api
, and those changes in particular are a-ok 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
root@php:/var/lib/tugboat# composer run-script va:test:php_codesniffer
> # Run PHP_CodeSniffer tests.
> ! ./scripts/should-run-directly.sh || phpcs --colors --
> ./scripts/should-run-directly.sh || ddev composer va:test:php_codesniffer --
root@php:/var/lib/tugboat# echo $?
0
Great work! And thank you for clearing up those ordering issues ❤️
* Add PHP Codesniffer Baselines - This prevents phpcs from failing due to existing errors - Bulk fix use ordering with phpcbf - Add php-codesniffer-baseline as dev requirement and regenerate baseline file
Description
Closes #15954. To reduce the number of existing violations, phpcbf (PHP Code Beautifier and Fixer) was used to fix the use statement ordering issues.
Testing done
Tested locally using the php_codesniffer composer script, i.e. running
composer run-script va:test:php_codesniffer
. No more errors are observed.Screenshots
Before:
After:
QA steps
As user with access to this repository
composer run-script va:test:php_codesniffer
locallyDefinition of Done
Documentation has been updated, if applicable.Tests have been added if necessary.If there are field changes, front end output has been thoroughly checked.Select Team for PR review
CMS Team
Public websites
Facilities
User support
Accelerated Publishing