nickwilde1990/drupal-standards-composer-commands

Provides composer commands for standards checks on your Drupal project

1.0.0-beta3 2018-09-19 22:32 UTC

This package is auto-updated.

Last update: 2024-10-27 18:14:08 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License

Table Of Contents

Introduction

Provides composer commands to check your project according to Drupal Standards. Sets up all the requirements for basic standards checks. If you have them, this will use phpcs.xml and similar depending on the specific tool if available to use your customized standards or will use Drupal 8 defaults.

Installation

Install through Composer. Due to the status of some of the dependencies, you will need to have "minimum-stability": "dev" in your composer config. When using that, in most cases, it is recommended to also use "prefer-stable": true.

composer require --dev nickwilde1990/drupal-standards-composer-commands

Usage

Run

composer commandname/alias

Note: Unless/Until this pull request lands in composer, you will need to run any command provided by this in your project root (same location as your composer.json).

Available Commands

  • drupal-eslint [cs-js-scan]: Runs Eslint on your code (check JS standards). Will use default Drupal 8 standards if you do not have a .eslintrc.json.

  • drupal-eslint-fix [cs-js-fix]: Runs Eslint fix mode on your code (automatically fix JS standards compliance issues). Will use default Drupal 8 standards if you do not have a .eslintrc.json.

  • drupal-phpcs [cs-php-scan]: Runs PHPCS on your code (check PHP standards). Will use standard Drupal 8 mode if you do not have a phpcs.xml or phpcs.xml.dist.

  • drupal-phpcbf [cs-php-fix]: Runs PHPCBF on your code (automatically fix many PHP standards complaince issues). Will use standard Drupal 8 mode if you do not have a phpcs.xml or phpcs.xml.dist.

  • drupal-stylelint [cs-css-scan]: Runs Stylelint on your code (check CSS standards). Will use default Drupal 8 standards if you do not have a .stylelintrc.json.

  • drupal-stylelint-fix [cs-css-fix]: Runs Stylelint fix mode on your code (automatically fix CSS standards compliance issues). Will use default Drupal 8 standards if you do not have a .stylelintrc.json.

Configuration

Some custom configuration can be provided in your package's composer.json in the extra key under drupal-standards-commands. Specifically:

  • ignore-paths: Provide an array of extra paths for tools to ignore (affects all scan/fix tools). Default: ["core"] Example:
    {
      "extra": {
        "drupal-standards-commands": {
          "ignore-paths": [
            "core",
            "tests"
          ]
        }
      }
    }

Known issues

See open bug reports in the issue queue

Contribution

Contributions are welcome!

License

Copyright (C) 2018 Nick Wilde.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/