Skip to content

Github Action helps you check your code with PHP_CodeSniffer

License

Notifications You must be signed in to change notification settings

egeniq/phpcs-action

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 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

Eventually you could also check for warnings.

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

You probably would like to have configuration file for PHP_CodeSniffer in order to make it work as you like.

installed_paths and Dealerdirect/phpcodesniffer-composer-installer

If you are using custom standards, you have two options on how to customize this action.

  1. Just use special library which will find and activate all the standards you have in your composer.json.

It will also change phpcs installed_paths setting, but will prefer local phpcs install. That means we should use local phpcs binary in the action. To do so run action with certain parameter.

        ...
        - name: Install dependencies
          run: composer install --dev --prefer-dist --no-progress --no-suggest
        - name: PHPCS check
          uses: chekalsky/phpcs-action@v1
          with:
            phpcs_bin_path: './vendor/bin/phpcs'
  1. Change the installed_paths directly by using another option.
        ...
        - name: PHPCS check
          uses: chekalsky/phpcs-action@v1
          with:
            installed_paths: '${{ github.workspace }}/vendor/phpcompatibility/php-compatibility'

About

Github Action helps you check your code with PHP_CodeSniffer

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 79.7%
  • Dockerfile 20.3%