-
Notifications
You must be signed in to change notification settings - Fork 274
Code style validation/fix via php-cs-fixer #757
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
base: support/3.2
Are you sure you want to change the base?
Conversation
|
Great initiative! 🙌 Two things we should discuss as a team:
Extras to check afterwards (did you already take a look?):
|
|
A nice to have would also be to have this as an action on GitHub pull requests, so contributors (internal and external) would immediately see if te changes are conform the defined coding standards. |
0a03706 to
3040963
Compare
|
I've take a look at the rules described by Symfony. From my POV what you set is already a great start to propose to the team. |
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.
The formatting changes on the files in /webservices (why only there?) seem to have changed indentation from tabs to spaces. Please revert.
| to respect iTop code standards and re-format (no path provided means whole iTop code base): | ||
|
|
||
| ``` | ||
| tests/php-code-style/vendor/bin/php-cs-fixer fix --config tests/php-code-style/.php-cs-fixer.dist.php [PATH] |
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.
Maybe just move the .php-cs-fixer.dist.php to the root directory and add this in the main README?
When also moving composer, the command would then just become vendor/bin/php-cs-fixer fix [PATH], which is much easier/friendly to use.
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 agree with you. CLI would be shorter and that's what I started with.
but we prefer to keep such stuff apart. ie phpstan/phpunit/php-cs-fixer are gathered in tests folder to package iTop community easily without them. zip is heavy enough. packaging tools are simpler to maintain.
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.
Should not impact .zip size when putting in require-dev section of composer?
If that's the case, then why not using tests/composer.json instead?
we will apply code style to whole code base. for now I did it partially to share future effects with the team/community. |
|
The effect is now apparently to change tabs into spaces? That doesn't seem right? |
side effect fixed. |
Nice tool to automatically parse code and find out code style issues.
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/master
In a future we could even reformat whole code base. and then be notified by CI when code style is not respected....