FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Allow standard to be selected in composer.json by NickDickinsonWilde · Pull Request #1 · php-composter/php-composter-phpcs-wpcs · GitHub

Allow standard to be selected in composer.json - #1

Open
NickDickinsonWilde wants to merge 1 commit into
php-composter:masterfrom
NickDickinsonWilde:configurable-standards
Open

Allow standard to be selected in composer.json#1
NickDickinsonWilde wants to merge 1 commit into
php-composter:masterfrom
NickDickinsonWilde:configurable-standards

Conversation

Copy link
Copy Markdown

No description provided.

schlessera left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Hey @NickWilde1990, thanks for the PR!

I did a review and have a few nitpicks. But I agree with the approach and would like to merge this once we can take care of the few change requests.

Comment thread .gitignore
@@ -1 +1,2 @@
/vendor/
/.idea/

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This ignore should go into your global gitignore list, as it is not a direct artifact of the project, but rather a detail of your personal environment.

Comment thread README.md
WPCS provides 5 different coding standards (`WordPress-VIP`, `WordPress`,
`WordPress-Extra`, `WordPress-Docs` and `WordPress-Core`). By default this uses
`WordPress-Extra`. If you want to use another one of the standards, you can
specify it in your project's composer.json's `extra` key:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Reorder for readability

Suggested change
specify it in your project's composer.json's `extra` key:
specify it in the `extra` key of your project's `composer.json` file:

Comment thread src/Sniffer.php

echo 'Running PHP CodeSniffer in ' . $this->root . PHP_EOL;
$sniffer = new PHP_CodeSniffer_CLI();
@$config = $this->getExtraKey('php-composter-phpcs-wpcs', [

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Please avoid the "shut-up" operator (@ ). The getExtraKey() already verifies that the key does indeed exist and falls back to the value you provide if not. Any other error should either be dealt with separately, or bubble up because it might be pointing to a bigger issue.

Suggested change
@$config = $this->getExtraKey('php-composter-phpcs-wpcs', [
$config = $this->getExtraKey('php-composter-phpcs-wpcs', [

Comment thread src/Sniffer.php

ob_start();
$numErrors = $sniffer->process(array('standard' => 'WordPress-Extra', 'files' => $files));
$numErrors = $sniffer->process([

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Did you think about merging the $files into the $config array here? This way, one could even pass other PHPCS/WPCS settings through the configuration in composer.json. Not sure there's much that makes sense, though...

schlessera requested a review from javorszky January 23, 2019 11:19
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL