Skip to content
Permalink
Browse files
Change type of a few PHPCS rules to warning until fixed (#1245)
  • Loading branch information
ocean90 committed Jun 16, 2021
1 parent e9120a5 commit abde809f40a6ff2bcb10601d48c2bf697cb7ef7c
@@ -574,6 +574,7 @@ function gp_wp_profile_options_update( $user_id ) {

$is_user_gp_admin = GP::$permission->user_can( $user_id, 'admin' );

// phpcs:ignore WordPress.Security.NonceVerification.Missing
if ( array_key_exists( 'gp_administrator', $_POST ) && ! $is_user_gp_admin ) {
GP::$administrator_permission->create(
array(
@@ -584,6 +585,7 @@ function gp_wp_profile_options_update( $user_id ) {
);
}

// phpcs:ignore WordPress.Security.NonceVerification.Missing
if ( ! array_key_exists( 'gp_administrator', $_POST ) && $is_user_gp_admin ) {
$current_perm = GP::$administrator_permission->find_one(
array(
@@ -1,4 +1,4 @@
<?php
<?php // phpcs:ignore WordPress.Files.FileName.NotHyphenatedLowercase
/**
* Routes: GP_Route_Main class
*
@@ -32,6 +32,7 @@ public function settings_get() {
* @param int $user_id Optional. A user id, if not provided the id of the currently logged in user will be used.
*/
public function settings_post( $user_id = null ) {
// phpcs:ignore WordPress.Security.NonceVerification.Missing -- Verified by invalid_nonce_and_redirect()
if ( isset( $_POST['submit'] ) ) {
// Sometimes we get null, sometimes we get 0, depending on where it comes from.
// Let's make sure we have a consistent value to test against and that it's an integer.
@@ -45,6 +46,7 @@ public function settings_post( $user_id = null ) {
return;
}

// phpcs:ignore WordPress.Security.NonceVerification.Missing -- Verified by invalid_nonce_and_redirect()
$per_page = (int) $_POST['per_page'];
update_user_option( $user_id, 'gp_per_page', $per_page );

@@ -53,6 +55,7 @@ public function settings_post( $user_id = null ) {
'how' => 'desc',
);

// phpcs:ignore WordPress.Security.NonceVerification.Missing -- Verified by invalid_nonce_and_redirect()
$user_sort = wp_parse_args( $_POST['default_sort'], $default_sort );
update_user_option( $user_id, 'gp_default_sort', $user_sort );

@@ -204,12 +204,14 @@ public function by_locale( $locale_slug ) {
public function existing_locales() {
global $wpdb;

// phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
return $wpdb->get_col( "SELECT DISTINCT(locale) FROM $this->table" );
}

public function existing_slugs() {
global $wpdb;

// phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
return $wpdb->get_col( "SELECT DISTINCT(slug) FROM $this->table" );
}

@@ -24,7 +24,7 @@
<tbody>
<?php
$class = '';

// phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
foreach ( $locales as $locale ) :
$class = ( 'odd' === $class ) ? 'even' : 'odd';
?>
@@ -14,10 +14,12 @@
gp_breadcrumb( array( __( 'Your Settings', 'glotpress' ) ) );
gp_tmpl_header();

// phpcs:disable WordPress.WP.GlobalVariablesOverride.Prohibited
$per_page = (int) get_user_option( 'gp_per_page' );
if ( 0 === $per_page ) {
$per_page = 15;
}
// phpcs:enable WordPress.WP.GlobalVariablesOverride.Prohibited

$default_sort = get_user_option( 'gp_default_sort' );
if ( ! is_array( $default_sort ) ) {
@@ -113,4 +113,71 @@
<exclude-pattern>/vendor/*</exclude-pattern>
<exclude-pattern>/locales/*</exclude-pattern>
<exclude-pattern>/bin/*</exclude-pattern>

<rule ref="Squiz.Commenting.InlineComment.InvalidEndChar">
<type>warning</type>
</rule>
<rule ref="Squiz.Commenting.FunctionComment.Missing">
<type>warning</type>
</rule>
<rule ref="Squiz.Commenting.FunctionComment.MissingParamTag">
<type>warning</type>
</rule>
<rule ref="Squiz.Commenting.FunctionComment.MissingParamComment">
<type>warning</type>
</rule>
<rule ref="Squiz.Commenting.FunctionComment.ParamNameNoMatch">
<type>warning</type>
</rule>
<rule ref="Squiz.Commenting.FunctionComment.ParamCommentFullStop">
<type>warning</type>
</rule>
<rule ref="Squiz.Commenting.FunctionComment.WrongStyle">
<type>warning</type>
</rule>
<rule ref="Squiz.Commenting.FunctionComment.MissingParamName">
<type>warning</type>
</rule>
<rule ref="Squiz.Commenting.FunctionComment.SpacingAfter">
<type>warning</type>
</rule>
<rule ref="Squiz.Commenting.VariableComment.Missing">
<type>warning</type>
</rule>
<rule ref="Squiz.Commenting.VariableComment.WrongStyle">
<type>warning</type>
</rule>
<rule ref="Squiz.Commenting.ClassComment.Missing">
<type>warning</type>
</rule>
<rule ref="Squiz.Commenting.FileComment.Missing">
<type>warning</type>
</rule>
<rule ref="Squiz.Commenting.FileComment.SpacingAfterComment">
<type>warning</type>
</rule>
<rule ref="Squiz.Commenting.FileComment.MissingPackageTag">
<type>warning</type>
</rule>
<rule ref="WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase">
<type>warning</type>
</rule>
<rule ref="Squiz.Operators.IncrementDecrementUsage.Found">
<type>warning</type>
</rule>
<rule ref="Squiz.PHP.DisallowMultipleAssignments.Found">
<type>warning</type>
</rule>
<rule ref="Squiz.PHP.DisallowMultipleAssignments.FoundInControlStructure">
<type>warning</type>
</rule>
<rule ref="PSR2.Classes.PropertyDeclaration.VarUsed">
<type>warning</type>
</rule>
<rule ref="PSR2.Classes.PropertyDeclaration.ScopeMissing">
<type>warning</type>
</rule>
<rule ref="WordPress.PHP.DontExtract.extract_extract">
<type>warning</type>
</rule>
</ruleset>

0 comments on commit abde809

Please sign in to comment.