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

Validating single file with help of grunt-contrib-watch #33

Open
pdrylo opened this issue Oct 30, 2014 · 3 comments
Open

Validating single file with help of grunt-contrib-watch #33

pdrylo opened this issue Oct 30, 2014 · 3 comments

Comments

@pdrylo
Copy link

pdrylo commented Oct 30, 2014

Is it possible to run phpcs on changed files only?

I have tried the following inside Gruntfile.js, but it does not affect grunt-phpcs configuration at all:

grunt.event.on('watch', function (action, filepath) {
    grunt.config.set('phpcs.application.dir', [filepath]);
});

Cheers

@rolandba
Copy link

rolandba commented Dec 7, 2014

Hi,

if you want to modify config variables on the fly, you have to set

options: {
    spawn: false
}

in your watch section. That's the magic.

@pdrylo
Copy link
Author

pdrylo commented Dec 12, 2014

Thanks, it helped in some way with changing the value of phpcs.application.dir, but phpcs task is not executing anymore. Changing it back to spawn: true fixes it, but the problem persists. Any ideas?

Thanks in advance

@rolandba
Copy link

It should be working, my part of gruntfile is:

grunt.event.on('watch', function (action, filepath) {
if (grunt.file.isMatch(grunt.config('watch.cs_strict.files'), filepath)) {
grunt.config('phpcs.strict.dir', [filepath]);
}
});

Maybe just try to remove .set

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

2 participants