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 WordPressCS to version 3.0 #323

Merged
merged 3 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^v0.7",
"wp-coding-standards/wpcs": "^2.3",
"wp-coding-standards/wpcs": "^3.0",
"exussum12/coverage-checker": "^1.0",
"phpunit/phpunit": "^9.5",
"yoast/phpunit-polyfills": "^1.0"
Expand Down
196 changes: 179 additions & 17 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion includes/class-wc-google-analytics-js.php
Original file line number Diff line number Diff line change
Expand Up @@ -539,5 +539,4 @@ protected static function load_analytics_code_in_header( $code ) {
wp_add_inline_script( 'google-analytics', $code );
wp_enqueue_script( 'google-analytics' );
}

}
3 changes: 0 additions & 3 deletions includes/class-wc-google-analytics-task.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,4 @@ public function get_action_url() {
public function is_complete() {
return WC_Google_Analytics_Integration::get_integration()->is_setup_complete();
}

}


1 change: 0 additions & 1 deletion includes/class-wc-google-analytics.php
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,6 @@ public function add_wc_setup_task() {
TaskLists::get_list( 'extended' )
)
);

}

/**
Expand Down
3 changes: 1 addition & 2 deletions includes/class-wc-google-gtag-js.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public static function format_event_data( array $data ): string {
// Recursively walk through $data array and escape all values that will be used in JS.
array_walk_recursive(
$data,
function( &$value, $key ) {
function ( &$value, $key ) {
$value = esc_js( $value );
}
);
Expand Down Expand Up @@ -508,5 +508,4 @@ public function event_tracking_code( $parameters, $selector ) {
'
);
}

}
8 changes: 4 additions & 4 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
<exclude name="Squiz.Commenting.LongConditionClosingComment"/>

<!-- No thanks -->
<exclude name="WordPress.PHP.DisallowShortTernary"/>
<exclude name="Universal.Operators.DisallowShortTernary"/>
<exclude name="WordPress.PHP.YodaConditions.NotYoda"/>

<!-- These overrides are useful for code hinting -->
<exclude name="Generic.CodeAnalysis.UselessOverridingMethod.Found"/>

<!-- We like short array syntax -->
<exclude name="Generic.Arrays.DisallowShortArraySyntax"/>
<exclude name="Universal.Arrays.DisallowShortArraySyntax"/>

<!-- Multiple throws tags are fine -->
<exclude name="Squiz.Commenting.FunctionCommentThrowTag.WrongNumber"/>
Expand Down Expand Up @@ -62,8 +62,8 @@
</rule>

<!-- This rule flags space indents in HTML tags, which are generally OK. -->
<rule ref="WordPress.WhiteSpace.PrecisionAlignment">
<exclude name="WordPress.WhiteSpace.PrecisionAlignment.Found"/>
<rule ref="Universal.WhiteSpace.PrecisionAlignment">
<exclude name="Universal.WhiteSpace.PrecisionAlignment.Found"/>
</rule>

<!-- We allow the use of / in hooks -->
Expand Down
1 change: 0 additions & 1 deletion tests/EventsDataTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,4 @@ public function get_event_data() {
$args = $this->get_filter()->get_args();
return $args[0][0];
}

}
1 change: 0 additions & 1 deletion tests/class-unittestsbootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,5 +149,4 @@ public function includes() {
require_once $wc_tests_dir . '/framework/helpers/class-wc-helper-shipping.php';
require_once $wc_tests_dir . '/framework/helpers/class-wc-helper-customer.php';
}

}
1 change: 0 additions & 1 deletion tests/unit-tests/AddTransactionEnhanced.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,4 @@ public function test_purchase_event() {
// Confirm data structure matches what's expected.
$this->assertEquals( $expected_data, $this->get_event_data(), 'Event data does not match expected data structure for purchase (add_transaction_enhanced()) event' );
}

}
1 change: 0 additions & 1 deletion tests/unit-tests/CheckoutProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,4 @@ public function test_begin_checkout_event() {
// Confirm data structure matches what's expected.
$this->assertEquals( $expected_data, $this->get_event_data(), 'Event data does not match expected data structure for begin_checkout (checkout_process()) event' );
}

}
1 change: 0 additions & 1 deletion tests/unit-tests/ListingClick.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,4 @@ public function test_select_content_and_add_to_cart_event() {
// Confirm data structure matches what's expected.
$this->assertEquals( $expected_data, $this->get_event_data(), 'Event data does not match expected data structure for select_content and add_to_cart (listing_click()) events' );
}

}
1 change: 0 additions & 1 deletion tests/unit-tests/ListingImpression.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,4 @@ public function test_view_item_list_event() {
// Confirm data structure matches what's expected.
$this->assertEquals( $expected_data, $this->get_event_data(), 'Event data does not match expected data structure for view_item_list (listing_impression()) event' );
}

}
1 change: 0 additions & 1 deletion tests/unit-tests/WCGoogleGtagJS.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,5 +115,4 @@ public function test_integration_script_is_enqueued_for_variation() {
// Assert the handle is enqueued.
$this->assertEquals( true, wp_script_is( $gtag->script_handle . '-ga-integration', 'enqueued' ), 'the script is enqueued' );
}

}
Loading