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..a03f7fe 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: @@ -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 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/* + + + + + + + + + + + + + + + + + + + + + + + + + + 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.