Skip to content
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
16 changes: 7 additions & 9 deletions .phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@

<description>Coding standards used for checking the code of the Theme Check plugin</description>

<!--
Prevent errors caused by WordPress Coding Standards not supporting PHP 8.0+.
See https://github.com/WordPress/WordPress-Coding-Standards/issues/2035
-->
<ini name="error_reporting" value="E_ALL &#38; ~E_DEPRECATED" />

<!-- Exclude the Composer Vendor directory. -->
<exclude-pattern>/vendor/*</exclude-pattern>

Expand Down Expand Up @@ -79,13 +73,17 @@
<exclude name="WordPress.Files.FileName.NotHyphenatedLowercase"/>

<!-- We're not strict about this. -->
<exclude name="WordPress.PHP.StrictComparisons.LooseComparison"/>
<exclude name="Universal.Operators.StrictComparisons"/>

<!-- We don't want Yoda conditions.. -->
<exclude name="WordPress.PHP.YodaConditions.NotYoda"/>

<!-- We want to allow this. -->
<exclude name="WordPress.CodeAnalysis.AssignmentInCondition.Found"/>
<exclude name="WordPress.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition"/>
<exclude name="Generic.CodeAnalysis.AssignmentInCondition.Found"/>
<exclude name="Generic.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition"/>

<!-- New in WPCS 3.x; restructuring these is left as a judgment call. -->
<exclude name="Universal.ControlStructures.DisallowLonelyIf.Found"/>
<exclude name="Universal.Files.SeparateFunctionsFromOO.Mixed"/>
</rule>
</ruleset>
14 changes: 7 additions & 7 deletions checkbase.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ public function getError();
*/
function run_themechecks_against_theme( $theme, $theme_slug ) {
$files = $theme->get_files(
null /* all file types */,
-1 /* infinite recursion */,
null, /* all file types */
-1, /* infinite recursion */
true /* include parent theme files */
);
unset( $files[0] ); // Work around https://core.trac.wordpress.org/ticket/53599
Expand Down Expand Up @@ -161,7 +161,7 @@ function display_themechecks() {

function checkcount() {
global $checkcount;
$checkcount++;
++$checkcount;
}

// some functions theme checks use.
Expand All @@ -182,7 +182,7 @@ function tc_grep( $error, $file ) {
$pre = ltrim( htmlspecialchars( $pre ) );
$bad_lines .= "<pre class='tc-grep'>" . __( 'Line ', 'theme-check' ) . ( $line_index + 1 ) . ': ' . $pre . htmlspecialchars( substr( stristr( $this_line, $error ), 0, 75 ) ) . '</pre>';
}
$line_index++;
++$line_index;
}
return str_replace( $error, '<span class="tc-grep">' . $error . '</span>', $bad_lines );
}
Expand All @@ -208,7 +208,7 @@ function tc_preg( $preg, $file ) {
$pre = ltrim( htmlspecialchars( $pre ) );
$bad_lines .= "<pre class='tc-grep'>" . __( 'Line ', 'theme-check' ) . ( $line_index + 1 ) . ': ' . $pre . htmlspecialchars( substr( stristr( $this_line, $error ), 0, 75 ) ) . '</pre>';
}
$line_index++;
++$line_index;

}
return str_replace( $error, '<span class="tc-grep">' . $error . '</span>', $bad_lines );
Expand Down Expand Up @@ -252,8 +252,8 @@ function _get_filename_from_current_theme( $file ) {
$theme_path = $theme_check_current_theme->get_stylesheet_directory();

$theme_files = $theme_check_current_theme->get_files(
null /* all file types */,
-1 /* infinite recursion */,
null, /* all file types */
-1, /* infinite recursion */
true /* include parent theme files */
);
}
Expand Down
2 changes: 1 addition & 1 deletion checks/class-file-check.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function check( $php_files, $css_files, $other_files ) {

$fse_find = array_filter(
array_keys( $other_files ),
function( $file_name ) {
function ( $file_name ) {
if ( false !== stripos( $file_name, 'templates/index.html' ) || false !== stripos( $file_name, 'block-templates/index.html' ) ) {
return true;
}
Expand Down
1 change: 0 additions & 1 deletion checks/class-filesystem-http-check.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ public function check( $php_files, $css_files, $other_files ) {
}

return true;

}

/**
Expand Down
6 changes: 3 additions & 3 deletions checks/class-i18n-check.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ public function check( $php_files, $css_files, $other_files ) {
while ( $open > 0 && isset( $search[ $i ] ) ) {
switch ( $search[ $i ] ) {
case '(':
$open++;
++$open;
break;
case ')':
$open--;
--$open;
break;
}
$i++;
++$i;
}
$stmts[] = substr( $search, 0, $i );
$search = substr( $search, $i );
Expand Down
2 changes: 1 addition & 1 deletion checks/class-style-tags-check.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function check( $php_files, $css_files, $other_files ) {

if ( in_array( strtolower( $tag ), $subject_tags ) ) {
$subject_tags_name .= strtolower( $tag ) . ', ';
$subject_tags_count++;
++$subject_tags_count;
}

if ( $tag === 'full-site-editing' && $this->wp_theme ) {
Expand Down
2 changes: 1 addition & 1 deletion checks/class-textdomain-check.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ function check( $php_files, $css_files, $other_files ) {
$found_domain = true;
}
if ( $parens_balance == 1 ) {
$args_count++;
++$args_count;
$args[] = $text;
}
}
Expand Down
1 change: 0 additions & 1 deletion checks/class-title-check.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ public function check( $php_files, $css_files, $other_files ) {
}

return true;

}

/**
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "A plugin to check if the theme follows theme review standards",
"type": "wordpress-plugin",
"require-dev": {
"wp-coding-standards/wpcs": "^2.3",
"wp-coding-standards/wpcs": "^3.4.1",
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
"phpcompatibility/phpcompatibility-wp": "^2.1"
},
Expand Down
Loading
Loading