Skip to content
This repository was archived by the owner on Sep 5, 2025. It is now read-only.

Comments

Use composer to install PHPCS and friends on Travis#1291

Closed
grappler wants to merge 2 commits intoAutomattic:masterfrom
grappler:feature/phpcs-composer
Closed

Use composer to install PHPCS and friends on Travis#1291
grappler wants to merge 2 commits intoAutomattic:masterfrom
grappler:feature/phpcs-composer

Conversation

@grappler
Copy link
Contributor

Changes proposed in this Pull Request:

Use composer instead of git to install WPCS and PHPCompatibility. This was recommend in a previous PR #1183 (comment)

Changing the flow to a0d2892

Only use the development version of PHPCompatibility. With this change we would use the stable version of PHPCS. Due to an update to the PHPCS master the checks are failing. I would like to the necessary changes to happen along side the PHPCS and WPCS updates instead of having to do them with other changes.

Related issue(s):

#1267

PHPCS is loaded automatically as a dependency
@grappler grappler force-pushed the feature/phpcs-composer branch from 70b8402 to af73a47 Compare May 17, 2018 09:21
.travis.yml Outdated
# Install PHP Compatibility sniffs.
- if [[ "$SNIFF" == "1" ]]; then git clone -b master --depth 1 https://github.com/wimg/PHPCompatibility.git $PHPCOMPAT_DIR; fi
# Install WordPress Coding Standards & PHP Compatibility sniffs.
- if [[ "$SNIFF" == "1" ]]; then composer global require wp-coding-standards/wpcs:~0.14.1 wimg/php-compatibility:dev-master --prefer-stable --no-interaction --no-suggest; fi
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add dealerdirect/phpcodesniffer-composer-installer:^0.4.3. This is a Composer plugin which will sort out the installed paths automatically and is suggested for that reason by both the standards.

.travis.yml Outdated
# Set install path for PHPCS sniffs.
# @link https://github.com/squizlabs/PHP_CodeSniffer/blob/4237c2fc98cc838730b76ee9cee316f99286a2a7/CodeSniffer.php#L1941
- if [[ "$SNIFF" == "1" ]]; then $PHPCS_DIR/bin/phpcs --config-set installed_paths $WPCS_DIR,$PHPCOMPAT_DIR; fi
- if [[ "$SNIFF" == "1" ]]; then phpcs --config-set installed_paths $HOME/.composer/vendor/wp-coding-standards/wpcs,$HOME/.composer/vendor/wimg/php-compatibility; fi
Copy link
Contributor

Choose a reason for hiding this comment

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

If the above mentioned Composer plugin is added, this line can be removed completely.

@jrfnl
Copy link
Contributor

jrfnl commented May 17, 2018

Interesting approach doing this without a composer.json, though I do think it would be better to have a composer.json file, if only to document which versions of the various libraries are being used in a more obvious way than hidden away in a Travis script.

Regarding the build failure: this has to do with a change in PHPCS - see squizlabs/PHP_CodeSniffer#1539. Please note that the version which would currently be used, 3.2.3, is buggy regarding the new PHPCS annotations.

Replaces the need to set the sniffs path manually
@grappler grappler changed the title Feature/phpcs composer Use composer to install PHPCS and friends on Travis Jun 3, 2018
@jrfnl
Copy link
Contributor

jrfnl commented Aug 9, 2018

FYI: If/when PR #1311 is merged, this PR will need to be updated (or visa-versa, if this PR is merged, PR #1311 will need to be updated).

@Ismail-elkorchi
Copy link
Contributor

Closing as composer was added in #1386.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants