Skip to content

Instantly share code, notes, and snippets.

@alejandrofloresm
Last active March 10, 2023 21:06
Show Gist options
  • Save alejandrofloresm/c344960b480bf01430b46eab138c7a69 to your computer and use it in GitHub Desktop.
Save alejandrofloresm/c344960b480bf01430b46eab138c7a69 to your computer and use it in GitHub Desktop.

Revisión de estilo automática

Github Actions

name: PSR-12 validation

on:
  push:

jobs:
  psr12-validation:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Install PHP and Composer
        uses: shivammathur/setup-php@v2
        with:
          php-version: '7.4'
          tools: composer
      - name: Install PSR-12 sniffer
        run: composer global require "squizlabs/php_codesniffer=*"
      - name: Validate PSR-12 compliance
        run: git diff --name-only HEAD~1 HEAD | grep '\.php$' | xargs php ~/.composer/vendor/bin/phpcs --standard=PSR12

Bitbucket

# Configuración del pipeline
pipelines:
  default:
    - step:
        name: Validación del estándar PSR-12
        image: php:7.4
        script:
          - apt-get update && apt-get install -y git
          - git clone https://github.com/php-fig/fig-standards.git
          - cd fig-standards && git checkout master
          - cd ../ && git diff --name-only HEAD~1 HEAD | grep '\.php$' | xargs php fig-standards/checkstyle/checkstyle.php --config=PSR12.xml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment