grunt-phpcs icon indicating copy to clipboard operation
grunt-phpcs copied to clipboard

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

Open jeremiahsmall opened this issue 9 years ago • 1 comments

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

jeremiahsmall avatar Nov 30 '15 01:11 jeremiahsmall

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.

matt-bernhardt avatar Feb 05 '16 18:02 matt-bernhardt