-
Notifications
You must be signed in to change notification settings - Fork 144
Add Composer scripts for code sniffing and autofixing #218
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
Conversation
|
||
<!-- The complete PSR-12 ruleset --> | ||
<rule ref="PSR12"> |
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.
It would also be useful to add the PHPCompatibility
sniffs to make sure that PHP 5.6 features are used.
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.
This probably will be a bit more work to get those to run with a PHIVE-based installation. Please let's do this in a separate PR. (I can do that.)
3bf9094
to
0730277
Compare
.gitattributes
Outdated
/phive.xml | ||
/phpcs.xml export-ignore |
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.
Do we have to have these files in the root dir? I would like to keep the root dir as tidy as possible.
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.
Concerning PHIVE: There is a second default location for the configuration file: .phive/phars.xml
, and we could also move the tools from tools/
to .phive/
as well (like we do in the Emogrifer project).
We can also move the PHP_Codesniffer configuration to file and that reference the configuration ("code standard") file in the Composer commands, e.g., to config/phpcs.xml
. What do you think?
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.
I like it. Maybe phpunit.xml could also be moved to the config folder? And Doxyfile. Which reminds me: we should have a task that updates gh-pages after releases to publish https://sabberworm.github.io/PHP-CSS-Parser/.
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.
We can also move the PHP_Codesniffer configuration to file and that reference the configuration ("code standard") file in the Composer commands, e.g., to
config/phpcs.xml
. What do you think?
A downside to that is that tools/editors will fail to discover the configuration files automatically.
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.
I'll move the PHIVE configuration file (and the PHAR symlinks) in this PR. We can take care of the other configuration files later then (in separate issues/PRs as needed).
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.
I have moved the PHARs and the PHIVE configuration file now and repushed.
0730277
to
652b940
Compare
There now are the following new Composer scripts: - `ci`: run all CI-related Composer scripts - `ci:static` run the static code analysis - `ci:php:sniff` run PHP_CodeSniffer - `fix:php` fix the autofixable PHP code warnings - `fix:php:sniff` fix the autofixable PHP_CodeSniffer warnings For starters, we have a sniff that checks for the PSR-12 standard. (The CI builds do not run this check as the files are not PSR-12 compliant yet at this point.)
652b940
to
2eb96e1
Compare
There now are the following new Composer scripts:
ci
: run all CI-related Composer scriptsci:static
run the static code analysisci:php:sniff
run PHP_CodeSnifferfix:php
fix the autofixable PHP code warningsfix:php:sniff
fix the autofixable PHP_CodeSniffer warningsFor starters, we have a sniff that checks for the PSR-12 standard.
(The CI builds do not run this check as the files are not
PSR-12 compliant yet at this point.)