From 692329804ee8ec11cb8335ee3df12d93c9625547 Mon Sep 17 00:00:00 2001 From: Christoph Daum Date: Sun, 21 Jun 2026 20:32:44 +0200 Subject: [PATCH 1/3] refactor: use elseif instead of lonely if Replace two `else { if (...) }` blocks with `elseif` in the repository and auto-update columns of render_table_row(). This resolves the Universal.ControlStructures.DisallowLonelyIf errors and removes the misplaced phpcs:ignore comments that never took effect (they sat on the `if` line while the sniff reports on the `else`). Behaviour is unchanged. Co-Authored-By: Claude Opus 4.8 --- rt-plugin-report.php | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/rt-plugin-report.php b/rt-plugin-report.php index 6edaafc..d2fe0ae 100644 --- a/rt-plugin-report.php +++ b/rt-plugin-report.php @@ -464,14 +464,12 @@ private function render_table_row( $report ) { // Plugin is available on wp.org. $html .= 'wordpress.org'; } + } elseif ( $parsed_repo_url && isset( $parsed_repo_url['host'] ) ) { + // Update URI is a valid URL, display the host. + $html .= '' . esc_html( $repo_host ) . ''; } else { - if ( $parsed_repo_url && isset( $parsed_repo_url['host'] ) ) { // phpcs:ignore Universal.ControlStructures.DisallowLonelyIf.Found - // Update URI is a valid URL, display the host. - $html .= '' . esc_html( $repo_host ) . ''; - } else { - // Some other value (like 'false'), so assume updates are disabled. - $html .= '' . esc_html__( 'Updates disabled', 'plugin-report' ) . ''; - } + // Some other value (like 'false'), so assume updates are disabled. + $html .= '' . esc_html__( 'Updates disabled', 'plugin-report' ) . ''; } } elseif ( version_compare( $wp_version, '5.8', '<' ) ) { $html .= $this->render_error_cell( esc_html__( 'Only available in WP 5.8+', 'plugin-report' ) ); @@ -531,12 +529,10 @@ private function render_table_row( $report ) { // Auto-update. if ( version_compare( $wp_version, '5.5', '<' ) ) { $html .= '' . esc_html__( 'Requires WordPress 5.5 or higher', 'plugin-report' ) . ''; + } elseif ( isset( $report['auto-update'] ) && $report['auto-update'] ) { + $html .= '' . esc_html__( 'Enabled', 'plugin-report' ) . ''; } else { - if ( isset( $report['auto-update'] ) && $report['auto-update'] ) { // phpcs:ignore Universal.ControlStructures.DisallowLonelyIf.Found - $html .= '' . esc_html__( 'Enabled', 'plugin-report' ) . ''; - } else { - $html .= '' . esc_html__( 'Not enabled', 'plugin-report' ) . ''; - } + $html .= '' . esc_html__( 'Not enabled', 'plugin-report' ) . ''; } // Last updates. From 9d1ea62d3a3ee9791edfa575cdbf8a3c4ec09a5f Mon Sep 17 00:00:00 2001 From: Christoph Daum Date: Sun, 21 Jun 2026 20:32:44 +0200 Subject: [PATCH 2/3] ci: add WPCS ruleset for coding standards Add a project .phpcs.xml.dist that extends the WordPress standard and excludes WordPress.Files.FileName.InvalidClassFileName, since the plugin ships as a single bootstrap file named after the plugin and cannot be renamed to class-*.php. Also configures the text domain and global prefixes. Point the CI WPCS step at the ruleset and exclude the ruleset file from the distributed plugin zip via .distignore. Co-Authored-By: Claude Opus 4.8 --- .distignore | 1 + .github/workflows/ci.yml | 2 +- .phpcs.xml.dist | 41 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 .phpcs.xml.dist diff --git a/.distignore b/.distignore index 41c64ea..a791c55 100644 --- a/.distignore +++ b/.distignore @@ -7,6 +7,7 @@ # Files /.distignore /.gitignore +/.phpcs.xml.dist /.wp-env.json /composer.json /composer.lock diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ab3d8e1..c9c919f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,7 +32,7 @@ jobs: - name: WPCS check uses: 10up/wpcs-action@stable with: - standard: WordPress + standard: .phpcs.xml.dist paths: . plugin-check: diff --git a/.phpcs.xml.dist b/.phpcs.xml.dist new file mode 100644 index 0000000..ceed9de --- /dev/null +++ b/.phpcs.xml.dist @@ -0,0 +1,41 @@ + + + Coding standards for the Plugin Report plugin. + + + + + + + /vendor/* + /node_modules/* + + + + + + + + + + + + + + + + + + + + + + + + + + From 389b829d1bdaf7fef0dfdce12d249301fab50255 Mon Sep 17 00:00:00 2001 From: Christoph Daum Date: Mon, 22 Jun 2026 08:56:26 +0200 Subject: [PATCH 3/3] ci: exclude dev files from Plugin Check Plugin Check scans the raw repo checkout, so it flags .wp-env.json and .phpcs.xml.dist as hidden/application files (.dist is a flagged extension). Both are development-only files already excluded from the distributed plugin via .distignore, so exclude them from the check. Resolves the hidden_files and application_files errors. Co-Authored-By: Claude Opus 4.8 --- .github/workflows/ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c9c919f..a03f7fe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,3 +52,7 @@ jobs: uses: wordpress/plugin-check-action@v1.1.6 with: wp-version: "latest" + # Development-only files that ship excluded via .distignore but are + # present in the CI checkout; skip them so Plugin Check doesn't flag + # them as hidden/application files. + exclude-files: .wp-env.json,.phpcs.xml.dist