Skip to content

Github Action helps you check your code with PHP_CodeSniffer

License

Notifications You must be signed in to change notification settings

kfzteile24/phpcs-action

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP CodeSniffer GitHub Action

This action will help you to run phpcs (PHP_CodeSniffer) with GitHub Actions platform. It also supports annotations out of the box — you don't need to use any tokens to make it work.

How Annotations Works

Usage

Add the following code to .github/workflows/phpcs.yml file.

name: PHPCS check

on: pull_request

jobs:
  phpcs:
      name: PHPCS
      runs-on: ubuntu-latest
      steps:
        - uses: actions/checkout@v2
        - name: PHPCS check
          uses: chekalsky/phpcs-action@v1
            with:
              dir: ./path/to/code

Eventually you could also check for warnings.

        ...
        - name: PHPCS check
          uses: chekalsky/phpcs-action@v1
          with:
            dir: ./path/to/code
            enable_warnings: true

If you want to run a custom phpcs instance, you can define the path to the binary like the following:

        ...
        - name: Install dependencies
          run: composer install --dev --prefer-dist --no-progress --no-suggest
        - name: PHPCS check
          uses: chekalsky/phpcs-action@v1
          with:
            dir: ./path/to/code
            phpcs_bin_path: './vendor/bin/phpcs'

If you like to define a custom code standard:

        ...
        - name: Install dependencies
          run: composer install --dev --prefer-dist --no-progress --no-suggest
        - name: PHPCS check
          uses: chekalsky/phpcs-action@v1
          with:
            dir: ./path/to/code
            standard: ./path/to/standard

About

Github Action helps you check your code with PHP_CodeSniffer

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 78.5%
  • Dockerfile 21.5%