Skip to content

Commit

Permalink
add phpcs github action
Browse files Browse the repository at this point in the history
  • Loading branch information
Sidsector9 committed Jun 6, 2022
1 parent 4949f93 commit 9ee0971
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Tests
name: ESLint

on:
push:
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/phpcs.yml
Original file line number Diff line number Diff line change
@@ -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
9 changes: 5 additions & 4 deletions insert-special-characters.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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' );
9 changes: 9 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0"?>
<ruleset name="Insert Special Characters">
<rule ref="10up-Default" />
<file>.</file>
<exclude-pattern>dist/</exclude-pattern>
<exclude-pattern>vendor/</exclude-pattern>
<exclude-pattern>tests/</exclude-pattern>
<exclude-pattern>build/</exclude-pattern>
</ruleset>

0 comments on commit 9ee0971

Please sign in to comment.