Skip to content

Commit

Permalink
Add code quality workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ernilambar committed Jan 13, 2024
1 parent 258957e commit 075cd84
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 3 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Code Quality Checks

on:
pull_request:
push:
branches:
- main
- master

jobs:
code-quality:
uses: wp-cli/.github/.github/workflows/reusable-code-quality.yml@main
15 changes: 15 additions & 0 deletions .github/workflows/regenerate-readme.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Regenerate README file

on:
workflow_dispatch:
push:
branches:
- main
- master
paths-ignore:
- "features/**"
- "README.md"

jobs:
regenerate-readme:
uses: wp-cli/.github/.github/workflows/reusable-regenerate-readme.yml@main
9 changes: 9 additions & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,13 @@
<!-- Rules: Include the base ruleset for WP-CLI projects. -->
<rule ref="WP_CLI_CS"/>

<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
<properties>
<property name="prefixes" type="array">
<element value="Nilambar\WP_CLI_Database"/><!-- Namespaces. -->
<element value="wpcli_database_command"/><!-- Global variables and such. -->
</property>
</properties>
</rule>

</ruleset>
6 changes: 3 additions & 3 deletions src/DatabaseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function reset( $args, $assoc_args ) {
private function reset_callback( $user ) {
WP_CLI::log( 'Resetting...' );

// We dont want email notification.
// We don't want email notification.
if ( ! function_exists( 'wp_new_blog_notification' ) ) {
function wp_new_blog_notification() {
// Silence is golden.
Expand All @@ -79,10 +79,10 @@ function wp_new_blog_notification() {

$prefix = str_replace( '_', '\_', $wpdb->prefix );

$tables = $wpdb->get_col( "SHOW TABLES LIKE '{$prefix}%'" );
$tables = $wpdb->get_col( $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $prefix . '%' ) ) );

foreach ( $tables as $table ) {
$wpdb->query( "DROP TABLE $table" );
$wpdb->query( $wpdb->prepare( 'DROP TABLE %s', $table ) );
}

// Set site URL.
Expand Down

0 comments on commit 075cd84

Please sign in to comment.