SaschaGalley / grunt-phpcs

Grunt plugin for running PHP Code Sniffer.
MIT License
47 stars 25 forks source link

Support for all PHPCS features such as -p switch and --extensions arg #54

Open jeremiahsmall opened 9 years ago

jeremiahsmall commented 9 years ago

I've discovered through trial and error that I can configure PHPCS features that this library doesn't directly support through configuration. Example:

        options: {
            // hack: args not directly supported by grunt-phpcs can be added in the bin path
            bin: 'vendor/bin/phpcs -p --extensions=dist,php,phtml',
            standard: 'PSR2',
            encoding: 'utf-8'
        }

I'd like to propose that support for all of the PHPCS features be added, in one of two ways.

Option 1: Explicit implementation as options. Example:

        options: {
            bin: 'vendor/bin/phpcs',
            progress: true,
            extensions: 'dist,php,phtml',
            standard: 'PSR2',
            encoding: 'utf-8'
        }

Option 2: Passthrough support for args. Example:

        options: {
            bin: 'vendor/bin/phpcs',
            args: '-p --extensions=dist,php,phtml',
            standard: 'PSR2',
            encoding: 'utf-8'
        }

If there is support for either of these ideas, I'd be happy to create a PR.

See https://github.com/squizlabs/PHP_CodeSniffer/wiki/Usage

matt-bernhardt commented 8 years ago

I'd be in favor of anything that prevents this integration from interfering with functionality provided by phpcs. Whether that's enumerated options, a combined args option, or just documentation that command-line switches are supported by the bin option. Anything will help expose the flexibility offered by phpcs, rather than masking it.