[go: nahoru, domu]

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

Retire phpcs-diff #446

Merged
merged 6 commits into from
Jul 1, 2024
Merged
Prev Previous commit
Next Next commit
Skip ignorable phpcs checks in the tests/class-unittestsbootstrap.php
  • Loading branch information
eason9487 committed Jun 28, 2024
commit 11df3a960570cc493c37330d4d9b0a0f802b74b4
4 changes: 4 additions & 0 deletions tests/class-unittestsbootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ public function init() {
* Show errors.
*/
public function set_show_errors() {
// phpcs:ignore WordPress.PHP.IniSet.display_errors_Disallowed
ini_set( 'display_errors', 'on' );
// phpcs:ignore WordPress.PHP.DevelopmentFunctions.prevent_path_disclosure_error_reporting, WordPress.PHP.DiscouragedPHPFunctions.runtime_configuration_error_reporting
error_reporting( E_ALL );
}

Expand All @@ -68,8 +70,10 @@ public function set_path_props() {
* Set server props
*/
public function set_server_props() {
// phpcs:disable WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you think we can sanitize the input here instead of ignoring the line?

Copy link
Member Author

Choose a reason for hiding this comment

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

Since this file is used for PHPUnit testing, I thought it would be okay to skip the checks.

I revisited its logic once and found that after the rewrite it didn't have to skip checking. Adjusted in db107f7.

$_SERVER['REMOTE_ADDR'] = isset( $_SERVER['REMOTE_ADDR'] ) ? $_SERVER['REMOTE_ADDR'] : '';
$_SERVER['SERVER_NAME'] = isset( $_SERVER['SERVER_NAME'] ) ? $_SERVER['SERVER_NAME'] : 'ga_integration_test';
// phpcs:enable WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
}

/**
Expand Down