Giter VIP home page Giter VIP logo

phpcs-drupal-action's Introduction

Lightweight GitHub action to check Drupal PHP coding standards, with annotations

PHPCS Drupal action

This GitHub action allows to check your code against the Drupal PHP coding standards.

  • It has GitHub annotations working out-of-the box, without any special token needed;
  • It's lightweight: unlike most other actions, it does NOT install all your composer dependencies. Thanks to this, a lot of GitHub action minutes can be saved over the time. Also, the action is much quicker. The downside is that the Drupal and DrupalPractice PHPCS standards are fixed and do not depend on your code base.

It uses this Docker image: https://github.com/guix77/docker-phpcs-drupal

Requirements

Installation

In the root of your Drupal project, create phpcs.xml:

<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="drupal">
  <description>PHP CodeSniffer configuration for Drupal coding standards.</description>
  <file>./web/modules/custom</file>
  <file>./web/themes/custom</file>
  <arg name="extensions" value="php,module,inc,install,test,profile,theme,css,info,txt,md,yml" />
  <config name="drupal_core_version" value="8" />
  <rule ref="Drupal" />
  <rule ref="DrupalPractice" />
</ruleset>

In the root of your Drupal project, create .github/workflows/drupalCodingStandards.yml:

name: Drupal coding standards

on: [pull_request]

jobs:
  phpcs-drupal:
      name: Drupal coding standards
      runs-on: ubuntu-latest
      steps:
        - uses: actions/checkout@v2
        - uses: guix77/[email protected]

You can customize the trigger of course (\\on: [pull_request]\\).

That's it.

Example

Credits

Inspired by https://github.com/chekalsky/phpcs-action

phpcs-drupal-action's People

Contributors

guix77 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.