Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fail reporter fails on Warnings #37

Open
tdmalone opened this issue Nov 22, 2017 · 1 comment
Open

fail reporter fails on Warnings #37

tdmalone opened this issue Nov 22, 2017 · 1 comment

Comments

@tdmalone
Copy link

I'm running the log reporter followed by the fail reporter, and unexpectedly, the fail reporter is failing on warnings:

[10:08:03] PHP Code Sniffer found a problem in C:\Users\Tim\Dropbox\Chromatix\htdocs\base\theme-portal\inc\portal-setup.php

    FILE: ...\Dropbox\Chromatix\htdocs\base\theme-portal\inc\portal-setup.php
    ----------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ----------------------------------------------------------------------
      10 | WARNING | Inline comments must start with a capital letter
         |         | (Squiz.Commenting.InlineComment.NotCapital)
    ----------------------------------------------------------------------

    Time: 817ms; Memory: 10Mb

C:\Users\Tim\Dropbox\Chromatix\htdocs\base\gulp-tasks\node_modules\longjohn\dist\longjohn.js:192
        throw e;
        ^
Error: PHP Code Sniffer failed on
    C:\Users\Tim\Dropbox\Chromatix\htdocs\base\theme-portal\inc\portal-setup.php

I'm not sure if this is intended behaviour or not. I'm assuming it's not - but if it is, would it be possible to have an optional flag to only fail on errors?

@tdmalone
Copy link
Author

tdmalone commented Nov 23, 2017

Sorry, in digging into this further I've realised it's not an issue with gulp-phpcs - at least not directly anyway. phpcs itself exits with 1 by default on warnings.

There's a command line flag to change that, if possible it would be fantastic if gulp-phpcs could provide a mechanism to pass that through? Ideally we could manually pass through any args not specifically passed in this function.

(Note that the warning-severity option determines whether to display warnings or not, but doesn't allow warnings to still be displayed while ignoring the exit code).

Meantime I might also enquire of phpcs whether it's possible to set this option in the phpcs.xml.

EDIT: This can sort of be worked around by running vendor/bin/phpcs --config-set ignore_warnings_on_exit 1 in composer's post-install-cmd (ideally though it'd be great to be able to pass arbitrary command line options through to phpcs so we can configure this in the gulpfile) - BUT, this will also cause the gulp-phpcs log reporter to not report the warnings visibly at all.

EDIT 2: I imagine this check in gulp-phpcs is the cause of a non-error warning not being output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant