onionco / wp-seeds

Transferrable tokens.
GNU General Public License v3.0
0 stars 3 forks source link

Create a composer task to run code-sniffer #44

Closed limikael closed 4 years ago

limikael commented 4 years ago

...as it says... :)

nielslange commented 4 years ago

That's what I run in the terminal:

phpcs . --ignore=class-tgm-plugin-activation.php --standard=WordPress

And that's how the Twenty Twenty theme runs PHPCS and WPCS.

https://github.com/WordPress/twentytwenty/blob/bc89c516bbb13b61d32848c2f021afc532c3810d/composer.json#L20-L29:

    "require-dev": {
        "dealerdirect/phpcodesniffer-composer-installer": "^0.5.0",
        "wptrt/wpthemereview": "^0.2.0"
    },
    "scripts": {
        "checkcs": "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs --runtime-set testVersion 5.6-",
        "fixcs": "@php ./vendor/squizlabs/php_codesniffer/bin/phpcbf --runtime-set testVersion 5.6-",
    },

https://github.com/WordPress/twentytwenty/blob/bc89c516bbb13b61d32848c2f021afc532c3810d/.travis.yml#L48:

 # Check the code against the standards as documented in the phpcs.xml.dist file.
  - if [[ "$PHPCS" == 1 ]]; then composer checkcs; fi