Skip to content
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

Update to Coding Standard command #469

Merged
merged 3 commits into from Jun 2, 2017
Merged

Update to Coding Standard command #469

merged 3 commits into from Jun 2, 2017

Conversation

eeree
Copy link
Contributor

@eeree eeree commented May 24, 2017

Coding Standard command should be executed only for changed PHP files, skipping fixtures folder.

Coding Standard command should be executed only for changed PHP files, skipping fixtures folder.
@ravage84 ravage84 self-assigned this May 24, 2017
@ravage84 ravage84 added this to the 2.6.1 milestone May 24, 2017
CONTRIBUTING.md Outdated
@@ -30,7 +30,7 @@ Make sure your code changes comply with the PSR-2 coding standard by
using [PHP Codesniffer](https://github.com/squizlabs/PHP_CodeSniffer)
from within your PHPMD folder:

vendor/bin/phpcs -p --extensions=php --standard=PSR2 src > phpcs.txt
vendor/bin/phpcs -p --extensions=php --standard=PSR2 --ignore=src/tests/resources $(git ls-files -om --exclude-standard | grep '\.php$') > phpcs.txt
Copy link
Member

Choose a reason for hiding this comment

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

Three thoughts:

  1. grep is not available on Windows, so I prefer to keep the current one. (yes i know vendor/bin/phpcs needs to be adjusted on Windows, anyway)
  2. Just because they aren't changed, doesn't mean those files don't contain a cs violation. The project isn't THAT huge, anyway.
  3. I would prefer, if we could align the commands with those used as Composer scripts as much as possible:

https://github.com/phpmd/phpmd/blob/master/composer.json#L54

So it would become

vendor/binphpcs -p --standard=PSR2 ./src/main/php ./src/test/php > phpcs.txt

Copy link
Member

Choose a reason for hiding this comment

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

Additionally, we can state, that one could use the Composer scripts composer cs-check and composer cs-fix

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @ravage84 ,
Current problem is, that there are some files, that already violates the styling rules. That was my main goal here. Grep is not a big deal (I forgot about Windows users) - git ls-files gives an --ignore flag, that works exactly as | grep -v (but again - Windows users will have to execute that in two commands). I assume, that I can just decline this PR, mostly because of OS incompatibility.

Copy link
Member

Choose a reason for hiding this comment

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

How about you change your PR to add a note for Linux users who are able to use this, containing the optimized cli command?

@eeree
Copy link
Contributor Author

eeree commented Jun 1, 2017

Updated

Copy link
Member

@ravage84 ravage84 left a comment

Choose a reason for hiding this comment

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

After those two small changes, I think we can merge 😸

CONTRIBUTING.md Outdated
@@ -32,6 +32,9 @@ from within your PHPMD folder:

vendor/bin/phpcs -p --extensions=php --standard=PSR2 src > phpcs.txt

Linux | OS X users may extend this command to exclude files, that are not part of a commit:
Copy link
Member

Choose a reason for hiding this comment

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

| -> /

CONTRIBUTING.md Outdated
@@ -32,6 +32,9 @@ from within your PHPMD folder:

vendor/bin/phpcs -p --extensions=php --standard=PSR2 src > phpcs.txt

Linux | OS X users may extend this command to exclude files, that are not part of a commit:

vendor/bin/phpcs -p --extensions=php --standard=PSR2 --ignore=src/tests/resources $(git ls-files -om --exclude-standard | grep '\.php$') > phpcs.txt
Check the ``phpcs.txt`` once it finished.
Copy link
Member

Choose a reason for hiding this comment

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

Add another white line before.

@eeree
Copy link
Contributor Author

eeree commented Jun 2, 2017

Here we go.

@ravage84 ravage84 merged commit 63ff5bf into phpmd:master Jun 2, 2017
@ravage84
Copy link
Member

ravage84 commented Jun 2, 2017

Thanks! 🍺

@eeree eeree deleted the patch-1 branch June 2, 2017 13:53
@ravage84 ravage84 modified the milestones: 2.6.2, 2.7.0 Jul 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

2 participants