Skip to content

Commit

Permalink
Add PHPCS.
Browse files Browse the repository at this point in the history
  • Loading branch information
puresyntax71 committed Jan 9, 2025
1 parent c601778 commit ac9e60e
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/phpcs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Drupal coding standards

on: pull_request

jobs:
phpcs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: shivammathur/setup-php@verbose
with:
php-version: 8.1
coverage: none
tools: composer:v2, cs2pr, dealerdirect/phpcodesniffer-composer-installer:*, drupal/coder
- name: Get composer cache directory
id: composercache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v2
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: Detect coding standard violations
run: phpcs -q --report=checkstyle | cs2pr --graceful-warnings
12 changes: 12 additions & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="civicrm_entity">
<description>PHP CodeSniffer configuration for CiviCRM entity.</description>
<file>.</file>
<arg name="extensions" value="php,module,inc,install,test,profile,theme,info,yml"/>

<exclude-pattern>*/vendor/*</exclude-pattern>
<exclude-pattern>*/node_modules/*</exclude-pattern>

<rule ref="Drupal"/>
<rule ref="DrupalPractice"/>
</ruleset>

0 comments on commit ac9e60e

Please sign in to comment.