JustBlackBird / gulp-phpcs

Gulp plugin for running PHP Code Sniffer
MIT License
47 stars 12 forks source link

report.txt is empty #23

Closed devatrox closed 8 years ago

devatrox commented 8 years ago

I'm on Win7

gulp php:lint
[14:53:30] Starting 'php:lint'...
[14:53:34] Your PHPCS report with 202 errors got written to report.txt
[14:53:34] Finished 'php:lint' after 4.04 s

This is the relevant Gulp stuff:

options.phpcs = {
    bin: (require('os').type() == 'Windows_NT' ? 'vendor/bin/phpcs.bat' : 'vendor/bin/phpcs'),
    standard: 'PSR2',
    warningSeverity: 0,
};

gulp.task('php:lint', function () {
    return gulp.src(['**/*.php', '!vendor/**/*.*', '!node_modules/**/*.*'])
        .pipe(phpcs(options.phpcs))
        .pipe(phpcs.reporter('file', { path: 'report.txt' }));
});

Also when I use phpcs.reporter('log') it just prints out a bunch of [15:03:11] PHP Code Sniffer found a problem in {filename} without telling me what exactly is wrong.

JustBlackBird commented 8 years ago

Hi! Sorry for the late answer there were too many tasks in my TODO list.

I reproduce your problem at Win 7 and played with it for a while. It turns that you use wrong path separator in windows. The correct bin option is:

{
    bin: (require('os').type() == 'Windows_NT' ? 'vendor\\bin\\phpcs.bat' : 'vendor/bin/phpcs')
}

(notice slashes \\ in path)

At the same time, I'm not sure why the plugin does not warn about the problem. I need more time to investigate the reason why there is no warning.

devatrox commented 8 years ago

That solved it. Thank you!

JustBlackBird commented 8 years ago

You're welcome. It seems that I finally found a solution for resolving phpcs bin and will release it soon.