phase2 / grunt-drupal-tasks

Grunt-based build and testing tasks for Drupal
https://phase2.github.io/grunt-drupal-tasks/
MIT License
124 stars 50 forks source link

The phpcs:validate task never ends if there are no files #174

Closed jhedstrom closed 9 years ago

jhedstrom commented 9 years ago

To reproduce:

yo gadget
grunt

It eventually (many minutes):

Running "phpcs:validate" (phpcs) task
Starting phpcs (target: validate) in src/**/*.css src/**/*.php src/**/*.module src/**/*.inc src/**/*.install src/**/*.profile !src/sites/** !src/**/*.box.inc !src/**/*.features.*inc !src/**/*.pages_default.inc !src/**/*.panelizer.inc !src/**/*.strongarm.inc
ERROR: You must supply at least one file or directory to process.

Usage: phpcs [-nwlsaepvi] [-d key[=value]]
    [--report=<report>] [--report-file=<reportfile>] [--report-<report>=<reportfile>] ...
    [--report-width=<reportWidth>] [--generator=<generator>] [--tab-width=<tabWidth>]
    [--severity=<severity>] [--error-severity=<severity>] [--warning-severity=<severity>]
    [--runtime-set key value] [--config-set key value] [--config-delete key] [--config-show]
    [--standard=<standard>] [--sniffs=<sniffs>] [--encoding=<encoding>]
    [--extensions=<extensions>] [--ignore=<patterns>] <file> ...
                      Set runtime value (see --config-set)
        -n            Do not print warnings (shortcut for --warning-severity=0)
        -w            Print both warnings and errors (on by default)
        -l            Local directory only, no recursion
        -s            Show sniff codes in all reports
        -a            Run interactively
        -e            Explain a standard by showing the sniffs it includes
        -p            Show progress of the run
        -v[v][v]      Print verbose output
        -i            Show a list of installed coding standards
        -d            Set the [key] php.ini value to [value] or [true] if value is omitted
        --help        Print this help message
        --version     Print version information
        <file>        One or more files and/or directories to check
        <extensions>  A comma separated list of file extensions to check
                      (only valid if checking a directory)
        <patterns>    A comma separated list of patterns to ignore files and directories
        <encoding>    The encoding of the files being checked (default is iso-8859-1)
        <sniffs>      A comma separated list of sniff codes to limit the check to
                      (all sniffs must be part of the specified standard)
        <severity>    The minimum severity required to display an error or warning
        <standard>    The name or path of the coding standard to use
        <tabWidth>    The number of spaces each tab represents
        <generator>   The name of a doc generator to use
                      (forces doc generation instead of checking)
        <report>      Print either the "full", "xml", "checkstyle", "csv", "json"
                      "emacs", "source", "summary", "svnblame", "gitblame", "hgblame" or
                      "notifysend" report
                      (the "full" report is printed by default)
        <reportfile>  Write the report to the specified file path
        <reportWidth> How many columns wide screen reports should be printed
grayside commented 9 years ago

Recently we updated our fork of grunt-phpcs to base off a rewrite. This behavior is not new since that change, as we've noted it always has taken a couple minutes.

I believe the correct fix is not in GDT, but for grunt-phpcs to validate it has files to scan before executing phpcs.

smerth commented 9 years ago

Hi There, after running yo gadget then grunt I get the same issue as above, then the process aborts due to warnings... how can I move forward?

grayside commented 9 years ago

Try creating a file in src/modules that would be processed as php. E.g., a .module file.

smerth commented 9 years ago

When I run grunt without a file in src/modules it complains about there not being anything to check and aborts. If I put in an empty php file it complains that the file is empty then aborts. No matter what php I put in the file I get back a long list of errors and it aborts (Warning: Task phpcs:validate failed). Even if I copy a php file from a module in core grunt aborts after telling me Warning: Task phpcs:validate failed.

Any suggestions?

Dev-Dipesh commented 9 years ago

@EvanLovely :+1: for the fix