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

No tasks runs when no files changed #33

Closed
igormukhingmailcom opened this issue Sep 1, 2015 · 9 comments
Closed

No tasks runs when no files changed #33

igormukhingmailcom opened this issue Sep 1, 2015 · 9 comments

Comments

@igormukhingmailcom
Copy link
Contributor

Hi.

When I run php ./vendor/bin/grumphp git:pre-commit manually (and have no changed files) - I see green man even shouldn't. So, no tasks executed.

But tasks such as 'phpunit', 'phpspec', 'behat' need to be executed.

@veewee
Copy link
Contributor

veewee commented Sep 13, 2015

You want GrumPHP to validate the full codebase? Currently we only run tasks when files have changed.
I am thinking of some continious integration commands that can run all configured tasks on the codebase. More info at #20

@igormukhingmailcom
Copy link
Contributor Author

Tasks like phunit/behat/phpspec not executed on separate files.
Its executed as is and any file list not passed to it as argument.
So i think that independent types of tasks need to run even if no file changed.

@veewee
Copy link
Contributor

veewee commented Sep 14, 2015

If no PHP file has changed during pre-commit, why should these tasks be ran?
Normally the tests and code should be in the previous committed state and shouldn't contain any errors.

For example: a front-end designer wants to add a CSS file, and all of a sudden he gets an exceptions on the unit tests which he does not know anything about. This doesn't seem to make much sense to me.

What is your opinion @aderuwe ?

@aderuwe
Copy link
Contributor

aderuwe commented Sep 14, 2015

@igormukhingmailcom I spoke to @veewee about this for a couple minutes this morning.
How about we introduce a grumphp:ci (or something similar) command that runs all the tasks on all of the files, while we make it so that "normal" GrumPHP usage is based off of the changed files only? (For independent tasks, as you call them, that would mean we trigger the entire suit, but only if there's changed files.)
What do you think?

@igormukhingmailcom
Copy link
Contributor Author

@aderuwe I thing that its a great idea.
I propose to name this command something like grumphp run (similar as php-cs-fixer run or phpspec run) or grumphp check, because this command will be used not only with CI.

@igormukhingmailcom
Copy link
Contributor Author

Also option --skip=task will be helpful I think...

For example:

  • grumphp run --skip=phpunit to skip phpunit tests
  • grumphp run --skip=phpunit,behat to skip phpunit and behat tests

WDYT?

@veewee
Copy link
Contributor

veewee commented Sep 14, 2015

sounds good! This will require some context in which the tasks needs to run.
Also: some tasks will not be able to run, like the blacklist task, since this only checks files that are being committed. So the tasks need to know in which context they can run.
During commit, only the changed files should be added.
During run, all files should be added. (Note: wouldn't this be slow on big codebases?)

This feature will require some thinking about the architecture of the project and propably BC breaks.

@aderuwe
Copy link
Contributor

aderuwe commented Sep 14, 2015

@igormukhingmailcom +1 on both counts!

@veewee
Copy link
Contributor

veewee commented Oct 26, 2015

The run command is implemented. This issue can be closed.
The ability to skip tests is not implemented but is added as a new issue in #50.

@veewee veewee closed this as completed Oct 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants