Skip to content

Implement CS checking based on the WP_CLI_CS ruleset#55

Merged
schlessera merged 2 commits into
masterfrom
feature/use-phpcs
Jul 4, 2020
Merged

Implement CS checking based on the WP_CLI_CS ruleset#55
schlessera merged 2 commits into
masterfrom
feature/use-phpcs

Conversation

@thrijith
Copy link
Copy Markdown
Member

Add a PHPCS ruleset using the new WP_CLI_CS standard.

Fixes #54

Related wp-cli/wp-cli#5201

Update .distignore and .gitignore with phpcs/phpunit config files
Update wp-cli-tests to 2.1
@thrijith thrijith requested a review from a team as a code owner April 26, 2019 03:36
@schlessera schlessera added this to the 2.0.0 milestone Jul 4, 2020
@schlessera schlessera merged commit a396128 into master Jul 4, 2020
@schlessera schlessera deleted the feature/use-phpcs branch July 4, 2020 11:59
Comment thread src/Find_Command.php
if ( ! $this->skip_ignored_paths ) {
// Assume base path doesn't need comparison
$compared_path = preg_replace( '#^' . preg_quote( $this->base_path ) . '#', '', $path );
$compared_path = preg_replace( '#^' . preg_quote( $this->base_path, '/' ) . '#', '', $path );
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Uh.. oh... this is wrong... the delimiter should be passed as the second parameter and in this case, the delimiter is #.

Copy link
Copy Markdown
Member Author

@thrijith thrijith Jul 5, 2020

Choose a reason for hiding this comment

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

@schlessera, should I send a PR with # as the delimiter for preg_quote? I don't recall why I added /, not sure which is correct here.

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.

@jrfnl Ah, good catch, thanks for that!

@thrijith Yes, please.

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.

@thrijith Did you maybe intend to concatenate to add trailing slash here... ?

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.

Either way, preg_quote() should have a # as the second argument in this case.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Adopt and enforce new WP_CLI_CS standard

3 participants