From 9ee0971fbf69d4d800498117c44889482863f343 Mon Sep 17 00:00:00 2001 From: Siddharth Thevaril Date: Mon, 6 Jun 2022 12:20:04 +0530 Subject: [PATCH] add phpcs github action --- .github/workflows/{test.yml => eslint.yml} | 2 +- .github/workflows/phpcs.yml | 31 ++++++++++++++++++++++ insert-special-characters.php | 9 ++++--- phpcs.xml | 9 +++++++ 4 files changed, 46 insertions(+), 5 deletions(-) rename .github/workflows/{test.yml => eslint.yml} (96%) create mode 100644 .github/workflows/phpcs.yml create mode 100644 phpcs.xml diff --git a/.github/workflows/test.yml b/.github/workflows/eslint.yml similarity index 96% rename from .github/workflows/test.yml rename to .github/workflows/eslint.yml index 529ce20..de34c96 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/eslint.yml @@ -1,4 +1,4 @@ -name: Tests +name: ESLint on: push: diff --git a/.github/workflows/phpcs.yml b/.github/workflows/phpcs.yml new file mode 100644 index 0000000..bdf1c17 --- /dev/null +++ b/.github/workflows/phpcs.yml @@ -0,0 +1,31 @@ +name: PHPCS + +on: + push: + branches: + - develop + - trunk + pull_request: + branches: + - develop + +jobs: + phpcs: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Set PHP version + uses: shivammathur/setup-php@v2 + with: + php-version: '7.3' + coverage: none + tools: composer:v2 + + - name: Install dependencies + run: composer install + + - name: Run PHPCS + run: ./vendor/bin/phpcs diff --git a/insert-special-characters.php b/insert-special-characters.php index a1dd141..6dc9ea6 100644 --- a/insert-special-characters.php +++ b/insert-special-characters.php @@ -14,11 +14,12 @@ * * @package insert-special-characters */ + namespace InsertSpecialCharacters; - /** - * Enqueue the admin JavaScript assets. - */ +/** + * Enqueue the admin JavaScript assets. + */ function gcm_block_enqueue_scripts() { $asset_data_file = trailingslashit( plugin_dir_path( __FILE__ ) ) . 'build/index.asset.php'; @@ -35,7 +36,7 @@ function gcm_block_enqueue_scripts() { $script_data['version'], true ); - + wp_set_script_translations( 'insert-special-characters', 'insert-special-characters' ); } add_action( 'enqueue_block_editor_assets', __NAMESPACE__ . '\gcm_block_enqueue_scripts' ); diff --git a/phpcs.xml b/phpcs.xml new file mode 100644 index 0000000..6a49985 --- /dev/null +++ b/phpcs.xml @@ -0,0 +1,9 @@ + + + + . + dist/ + vendor/ + tests/ + build/ +