diff --git a/README.md b/README.md index 33db5620a..feef113ba 100644 --- a/README.md +++ b/README.md @@ -119,6 +119,7 @@ Since GrumPHP is just a CLI tool, these commands can be triggered: - [git:deinit](doc/commands.md#installation) - [git:pre-commit](doc/commands.md#git-hooks) - [git:commit-msg](doc/commands.md#git-hooks) +- [git:pre-push](doc/commands.md#git-hooks) - [run](doc/commands.md#run) ## Compatibility diff --git a/doc/commands.md b/doc/commands.md index 5f901fd21..8d8706079 100644 --- a/doc/commands.md +++ b/doc/commands.md @@ -26,6 +26,7 @@ GrumPHP will be triggered with GIT hooks. However, you can run following command ```sh php ./vendor/bin/grumphp git:pre-commit php ./vendor/bin/grumphp git:commit-msg +php ./vendor/bin/grumphp git:pre-push ``` Both commands support raw git diffs and file lists as STDIN input. @@ -76,4 +77,3 @@ git ls-files src | php ./vendor/bin/grumphp run ``` :exclamation: *If you use the stdin, we won't be able to answer questions interactively.* - \ No newline at end of file diff --git a/doc/testsuites.md b/doc/testsuites.md index 25b5d9f77..0a9503991 100644 --- a/doc/testsuites.md +++ b/doc/testsuites.md @@ -44,4 +44,7 @@ grumphp: # Specify the test-suite for the git:pre-commit command: git_pre_commit: tasks: [] + # Specify the test-suite for the git:pre-push command: + git_pre_push: + tasks: [] ``` diff --git a/grumphp.yml.dist b/grumphp.yml.dist index 769f24d9b..493c43810 100644 --- a/grumphp.yml.dist +++ b/grumphp.yml.dist @@ -39,6 +39,8 @@ grumphp: testsuites: git_pre_commit: tasks: [phpcs, phpspec, phpunit, composer, composer_normalize, yamllint, phplint, phpparser, psalm] + git_pre_push: + tasks: [phpcs, phpspec, phpunit, composer, composer_normalize, yamllint, phplint, phpparser, psalm] # On CI, we run paratest separately. For some reason this currently fails in GitHub actions. ci: tasks: [phpcs, phpspec, phpunit, composer, composer_normalize, yamllint, phplint, phpparser, psalm] diff --git a/resources/config/console.yml b/resources/config/console.yml index 31e33315f..a48f27f64 100644 --- a/resources/config/console.yml +++ b/resources/config/console.yml @@ -65,6 +65,15 @@ services: - '@GrumPHP\IO\IOInterface' tags: - { name: 'console.command' } + GrumPHP\Console\Command\Git\PrePushCommand: + arguments: + - '@GrumPHP\Collection\TestSuiteCollection' + - '@GrumPHP\Locator\StdInFiles' + - '@GrumPHP\Locator\ChangedFiles' + - '@GrumPHP\Runner\TaskRunner' + - '@GrumPHP\IO\IOInterface' + tags: + - { name: 'console.command' } # This one is loaded through the TestSuiteCompilerPass GrumPHP\Collection\TestSuiteCollection: diff --git a/resources/hooks/.DS_Store b/resources/hooks/.DS_Store new file mode 100644 index 000000000..adc92ad9c Binary files /dev/null and b/resources/hooks/.DS_Store differ diff --git a/resources/hooks/local/pre-push b/resources/hooks/local/pre-push new file mode 100644 index 000000000..135713ee6 --- /dev/null +++ b/resources/hooks/local/pre-push @@ -0,0 +1,6 @@ +#!/bin/sh + +$(ENV) + +# Run GrumPHP +(cd "${HOOK_EXEC_PATH}" | $(EXEC_GRUMPHP_COMMAND) $(HOOK_COMMAND)) diff --git a/resources/hooks/vagrant/pre-push b/resources/hooks/vagrant/pre-push new file mode 100644 index 000000000..ef502e456 --- /dev/null +++ b/resources/hooks/vagrant/pre-push @@ -0,0 +1,13 @@ +#!/bin/sh + +$(ENV) + +# Run GrumPHP +cd $(VAGRANT_HOST_DIR) && vagrant ssh --command '$(which sh)' << COMMANDS + cd $(VAGRANT_PROJECT_DIR) + + # Add grumphp envs: + $(ENV) + + $(EXEC_GRUMPHP_COMMAND) $(HOOK_COMMAND)) +COMMANDS diff --git a/src/Console/Command/Git/PrePushCommand.php b/src/Console/Command/Git/PrePushCommand.php new file mode 100644 index 000000000..2732876ed --- /dev/null +++ b/src/Console/Command/Git/PrePushCommand.php @@ -0,0 +1,115 @@ +testSuites = $testSuites; + $this->stdInFilesLocator = $stdInFilesLocator; + $this->changedFilesLocator = $changedFilesLocator; + $this->taskRunner = $taskRunner; + $this->io = $io; + } + + public static function getDefaultName(): string + { + return self::COMMAND_NAME; + } + + protected function configure(): void + { + $this->setDescription('Executed by the pre-push hook'); + $this->addOption( + 'skip-success-output', + null, + InputOption::VALUE_NONE, + 'Skips the success output. This will be shown by another command in the git commit hook chain.' + ); + } + + public function execute(InputInterface $input, OutputInterface $output): int + { + $localRef = $this->changedFilesLocator->getLocalRef(); + $localSha = $this->changedFilesLocator->getLocalSHA1(); + $remoteSha = $this->changedFilesLocator->getRemoteSHA1(); + + $taskRunnerContext = ( + new TaskRunnerContext( + new GitPrePushContext($this->getPushedFiles($localRef, $localSha, $remoteSha)), + $this->testSuites->getOptional('git_pre_push') + ) + )->withSkippedSuccessOutput((bool) $input->getOption('skip-success-output')); + + $output->writeln('GrumPHP detected a pre-push command.'); + $results = $this->taskRunner->run($taskRunnerContext); + + return $results->isFailed() ? self::EXIT_CODE_NOK : self::EXIT_CODE_OK; + } + + protected function getPushedFiles(?string $localRef, ?string $localSha, ?string $remoteSha): FilesCollection + { + if (empty($remoteSha)) { + return $this->changedFilesLocator->locateFromRawDiffInput('HEAD'); + } + + if ($localRef === '(delete)') { + return new FilesCollection([]); + } + + return $this->changedFilesLocator->locateFromGitDiff($remoteSha, $localSha); + } +} diff --git a/src/Locator/ChangedFiles.php b/src/Locator/ChangedFiles.php index 6f4294078..7c03d209e 100644 --- a/src/Locator/ChangedFiles.php +++ b/src/Locator/ChangedFiles.php @@ -10,7 +10,7 @@ use GrumPHP\Git\GitRepository; use GrumPHP\Util\Filesystem; use GrumPHP\Util\Paths; -use Symfony\Component\Finder\SplFileInfo; +use SplFileInfo; /** * Class Git. @@ -46,6 +46,66 @@ public function locateFromGitRepository(): FilesCollection return $this->parseFilesFromDiff($diff); } + public function getLocalRef(): ?string + { + return $this->repository->run('symbolic-ref', ['HEAD']); + } + public function getLocalSHA1(): ?string + { + return $this->repository->run('rev-parse', ['HEAD']); + } + private function getRemoteRef(): ?string + { + return $this->repository->tryToRunWithFallback( + function (): ?string { + return $this->repository->run('rev-parse', ['--abbrev-ref', '--symbolic-full-name', '@{u}']); + }, + 'null' + ); + } + + public function getRemoteSHA1(): ?string + { + if ($this->getRemoteRef() === 'null') { + return null; + } + /** + * @psalm-suppress PossiblyUndefinedArrayOffset + * @psalm-suppress PossiblyNullArgument + */ + list($remoteName, $branchName) = explode('/', $this->getRemoteRef(), 2); + $output = $this->repository->run('ls-remote', [$remoteName, $branchName]); + return $output ? strtok($output, "\t") : null; + } + + /** + * @return FilesCollection + */ + public function locateFromGitDiff(string $fromSha, ?string $toSha): FilesCollection + { + if (empty($toSha)) { + $toSha = 'HEAD'; + } + $files = []; + $commits = $fromSha . '..' . $toSha; + $diff = $this->repository->tryToRunWithFallback( + function () use ($commits): ?string { + return $this->repository->run('diff', ['--name-only', trim($commits), '--oneline']); + }, + 'null' + ); + if ($diff === 'null') { + return new FilesCollection($files); + } + + foreach (explode("\n", $diff) as $file) { + $fileObject = new SplFileInfo($file); + $files[] = $fileObject; + } + + return new FilesCollection($files); + } + public function locateFromRawDiffInput(string $rawDiff): FilesCollection { $diff = $this->repository->createRawDiff($rawDiff); @@ -75,6 +135,6 @@ private function makeFileRelativeToProjectDir(File $file): SplFileInfo $file->isRename() ? $file->getNewName() : $file->getName() ); - return new SplFileInfo($filePath, dirname($filePath), $filePath); + return new SplFileInfo($filePath); } } diff --git a/src/Task/Ant.php b/src/Task/Ant.php index f6d506535..02bcc49d2 100644 --- a/src/Task/Ant.php +++ b/src/Task/Ant.php @@ -10,6 +10,7 @@ use GrumPHP\Task\Config\ConfigOptionsResolver; use GrumPHP\Task\Context\ContextInterface; use GrumPHP\Task\Context\GitPreCommitContext; +use GrumPHP\Task\Context\GitPrePushContext; use GrumPHP\Task\Context\RunContext; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -36,7 +37,9 @@ public static function getConfigurableOptions(): ConfigOptionsResolver public function canRunInContext(ContextInterface $context): bool { - return $context instanceof GitPreCommitContext || $context instanceof RunContext; + return $context instanceof GitPreCommitContext + || $context instanceof GitPrePushContext + || $context instanceof RunContext; } public function run(ContextInterface $context): TaskResultInterface diff --git a/src/Task/Atoum.php b/src/Task/Atoum.php index 4ae47dd42..815345cf1 100644 --- a/src/Task/Atoum.php +++ b/src/Task/Atoum.php @@ -10,6 +10,7 @@ use GrumPHP\Task\Config\ConfigOptionsResolver; use GrumPHP\Task\Context\ContextInterface; use GrumPHP\Task\Context\GitPreCommitContext; +use GrumPHP\Task\Context\GitPrePushContext; use GrumPHP\Task\Context\RunContext; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -47,7 +48,9 @@ public static function getConfigurableOptions(): ConfigOptionsResolver */ public function canRunInContext(ContextInterface $context): bool { - return $context instanceof GitPreCommitContext || $context instanceof RunContext; + return $context instanceof GitPreCommitContext + || $context instanceof GitPrePushContext + || $context instanceof RunContext; } /** diff --git a/src/Task/Behat.php b/src/Task/Behat.php index 50988de8c..37639203a 100644 --- a/src/Task/Behat.php +++ b/src/Task/Behat.php @@ -10,6 +10,7 @@ use GrumPHP\Task\Config\ConfigOptionsResolver; use GrumPHP\Task\Context\ContextInterface; use GrumPHP\Task\Context\GitPreCommitContext; +use GrumPHP\Task\Context\GitPrePushContext; use GrumPHP\Task\Context\RunContext; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -43,7 +44,9 @@ public static function getConfigurableOptions(): ConfigOptionsResolver */ public function canRunInContext(ContextInterface $context): bool { - return $context instanceof GitPreCommitContext || $context instanceof RunContext; + return $context instanceof GitPreCommitContext + || $context instanceof GitPrePushContext + || $context instanceof RunContext; } /** diff --git a/src/Task/Brunch.php b/src/Task/Brunch.php index d60f6614f..45d86a717 100644 --- a/src/Task/Brunch.php +++ b/src/Task/Brunch.php @@ -10,6 +10,7 @@ use GrumPHP\Task\Config\ConfigOptionsResolver; use GrumPHP\Task\Context\ContextInterface; use GrumPHP\Task\Context\GitPreCommitContext; +use GrumPHP\Task\Context\GitPrePushContext; use GrumPHP\Task\Context\RunContext; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -43,7 +44,9 @@ public static function getConfigurableOptions(): ConfigOptionsResolver */ public function canRunInContext(ContextInterface $context): bool { - return $context instanceof GitPreCommitContext || $context instanceof RunContext; + return $context instanceof GitPreCommitContext + || $context instanceof GitPrePushContext + || $context instanceof RunContext; } /** diff --git a/src/Task/CloverCoverage.php b/src/Task/CloverCoverage.php index 9315a3604..de54e024e 100644 --- a/src/Task/CloverCoverage.php +++ b/src/Task/CloverCoverage.php @@ -11,6 +11,7 @@ use GrumPHP\Task\Config\TaskConfigInterface; use GrumPHP\Task\Context\ContextInterface; use GrumPHP\Task\Context\GitPreCommitContext; +use GrumPHP\Task\Context\GitPrePushContext; use GrumPHP\Task\Context\RunContext; use GrumPHP\Util\Filesystem; use SimpleXMLElement; @@ -72,7 +73,9 @@ public static function getConfigurableOptions(): ConfigOptionsResolver */ public function canRunInContext(ContextInterface $context): bool { - return $context instanceof GitPreCommitContext || $context instanceof RunContext; + return $context instanceof GitPreCommitContext + || $context instanceof GitPrePushContext + || $context instanceof RunContext; } /** diff --git a/src/Task/Codeception.php b/src/Task/Codeception.php index 2a228959b..52112f8c1 100644 --- a/src/Task/Codeception.php +++ b/src/Task/Codeception.php @@ -10,6 +10,7 @@ use GrumPHP\Task\Config\ConfigOptionsResolver; use GrumPHP\Task\Context\ContextInterface; use GrumPHP\Task\Context\GitPreCommitContext; +use GrumPHP\Task\Context\GitPrePushContext; use GrumPHP\Task\Context\RunContext; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -45,7 +46,9 @@ public static function getConfigurableOptions(): ConfigOptionsResolver */ public function canRunInContext(ContextInterface $context): bool { - return $context instanceof GitPreCommitContext || $context instanceof RunContext; + return $context instanceof GitPreCommitContext + || $context instanceof GitPrePushContext + || $context instanceof RunContext; } /** diff --git a/src/Task/Composer.php b/src/Task/Composer.php index 9290e0ce9..ddf6da702 100644 --- a/src/Task/Composer.php +++ b/src/Task/Composer.php @@ -11,6 +11,7 @@ use GrumPHP\Task\Config\ConfigOptionsResolver; use GrumPHP\Task\Context\ContextInterface; use GrumPHP\Task\Context\GitPreCommitContext; +use GrumPHP\Task\Context\GitPrePushContext; use GrumPHP\Task\Context\RunContext; use GrumPHP\Util\Filesystem; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -61,7 +62,9 @@ public static function getConfigurableOptions(): ConfigOptionsResolver public function canRunInContext(ContextInterface $context): bool { - return $context instanceof GitPreCommitContext || $context instanceof RunContext; + return $context instanceof GitPreCommitContext + || $context instanceof GitPrePushContext + || $context instanceof RunContext; } public function run(ContextInterface $context): TaskResultInterface diff --git a/src/Task/ComposerNormalize.php b/src/Task/ComposerNormalize.php index e2af71616..a3d275b35 100644 --- a/src/Task/ComposerNormalize.php +++ b/src/Task/ComposerNormalize.php @@ -9,6 +9,7 @@ use GrumPHP\Task\Config\ConfigOptionsResolver; use GrumPHP\Task\Context\ContextInterface; use GrumPHP\Task\Context\GitPreCommitContext; +use GrumPHP\Task\Context\GitPrePushContext; use GrumPHP\Task\Context\RunContext; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Process\Process; @@ -20,7 +21,9 @@ class ComposerNormalize extends AbstractExternalTask { public function canRunInContext(ContextInterface $context): bool { - return $context instanceof GitPreCommitContext || $context instanceof RunContext; + return $context instanceof GitPreCommitContext + || $context instanceof GitPrePushContext + || $context instanceof RunContext; } public static function getConfigurableOptions(): ConfigOptionsResolver diff --git a/src/Task/ComposerRequireChecker.php b/src/Task/ComposerRequireChecker.php index 46ed1ce66..16bd7d1a5 100644 --- a/src/Task/ComposerRequireChecker.php +++ b/src/Task/ComposerRequireChecker.php @@ -10,6 +10,7 @@ use GrumPHP\Task\Config\ConfigOptionsResolver; use GrumPHP\Task\Context\ContextInterface; use GrumPHP\Task\Context\GitPreCommitContext; +use GrumPHP\Task\Context\GitPrePushContext; use GrumPHP\Task\Context\RunContext; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -41,7 +42,9 @@ public static function getConfigurableOptions(): ConfigOptionsResolver */ public function canRunInContext(ContextInterface $context): bool { - return $context instanceof GitPreCommitContext || $context instanceof RunContext; + return $context instanceof GitPreCommitContext + || $context instanceof GitPrePushContext + || $context instanceof RunContext; } /** diff --git a/src/Task/ComposerScript.php b/src/Task/ComposerScript.php index 1def9a99d..fe788c563 100644 --- a/src/Task/ComposerScript.php +++ b/src/Task/ComposerScript.php @@ -10,6 +10,7 @@ use GrumPHP\Task\Config\ConfigOptionsResolver; use GrumPHP\Task\Context\ContextInterface; use GrumPHP\Task\Context\GitPreCommitContext; +use GrumPHP\Task\Context\GitPrePushContext; use GrumPHP\Task\Context\RunContext; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -39,7 +40,9 @@ public static function getConfigurableOptions(): ConfigOptionsResolver */ public function canRunInContext(ContextInterface $context): bool { - return $context instanceof GitPreCommitContext || $context instanceof RunContext; + return $context instanceof GitPreCommitContext + || $context instanceof GitPrePushContext + || $context instanceof RunContext; } /** diff --git a/src/Task/Context/GitPrePushContext.php b/src/Task/Context/GitPrePushContext.php new file mode 100644 index 000000000..8bd63ef54 --- /dev/null +++ b/src/Task/Context/GitPrePushContext.php @@ -0,0 +1,22 @@ +files = $files; + } + + public function getFiles(): FilesCollection + { + return $this->files; + } +} diff --git a/src/Task/Deptrac.php b/src/Task/Deptrac.php index 3c407833f..8a5d87fb1 100644 --- a/src/Task/Deptrac.php +++ b/src/Task/Deptrac.php @@ -10,6 +10,7 @@ use GrumPHP\Task\Config\ConfigOptionsResolver; use GrumPHP\Task\Context\ContextInterface; use GrumPHP\Task\Context\GitPreCommitContext; +use GrumPHP\Task\Context\GitPrePushContext; use GrumPHP\Task\Context\RunContext; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -38,7 +39,9 @@ public static function getConfigurableOptions(): ConfigOptionsResolver public function canRunInContext(ContextInterface $context): bool { - return $context instanceof GitPreCommitContext || $context instanceof RunContext; + return $context instanceof GitPreCommitContext + || $context instanceof GitPrePushContext + || $context instanceof RunContext; } public function run(ContextInterface $context): TaskResultInterface diff --git a/src/Task/DoctrineOrm.php b/src/Task/DoctrineOrm.php index 356e85a3a..567564d33 100644 --- a/src/Task/DoctrineOrm.php +++ b/src/Task/DoctrineOrm.php @@ -10,6 +10,7 @@ use GrumPHP\Task\Config\ConfigOptionsResolver; use GrumPHP\Task\Context\ContextInterface; use GrumPHP\Task\Context\GitPreCommitContext; +use GrumPHP\Task\Context\GitPrePushContext; use GrumPHP\Task\Context\RunContext; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -39,7 +40,9 @@ public static function getConfigurableOptions(): ConfigOptionsResolver */ public function canRunInContext(ContextInterface $context): bool { - return $context instanceof GitPreCommitContext || $context instanceof RunContext; + return $context instanceof GitPreCommitContext + || $context instanceof GitPrePushContext + || $context instanceof RunContext; } /** diff --git a/src/Task/Ecs.php b/src/Task/Ecs.php index 93d703537..007b75169 100644 --- a/src/Task/Ecs.php +++ b/src/Task/Ecs.php @@ -13,6 +13,7 @@ use GrumPHP\Task\Config\ConfigOptionsResolver; use GrumPHP\Task\Context\ContextInterface; use GrumPHP\Task\Context\GitPreCommitContext; +use GrumPHP\Task\Context\GitPrePushContext; use GrumPHP\Task\Context\RunContext; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Process\Process; @@ -48,7 +49,9 @@ public static function getConfigurableOptions(): ConfigOptionsResolver public function canRunInContext(ContextInterface $context): bool { - return $context instanceof GitPreCommitContext || $context instanceof RunContext; + return $context instanceof GitPreCommitContext + || $context instanceof GitPrePushContext + || $context instanceof RunContext; } public function run(ContextInterface $context): TaskResultInterface diff --git a/src/Task/Gherkin.php b/src/Task/Gherkin.php index 00fc4cd1c..372857f0c 100644 --- a/src/Task/Gherkin.php +++ b/src/Task/Gherkin.php @@ -10,6 +10,7 @@ use GrumPHP\Task\Config\ConfigOptionsResolver; use GrumPHP\Task\Context\ContextInterface; use GrumPHP\Task\Context\GitPreCommitContext; +use GrumPHP\Task\Context\GitPrePushContext; use GrumPHP\Task\Context\RunContext; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -38,7 +39,9 @@ public static function getConfigurableOptions(): ConfigOptionsResolver */ public function canRunInContext(ContextInterface $context): bool { - return $context instanceof GitPreCommitContext || $context instanceof RunContext; + return $context instanceof GitPreCommitContext + || $context instanceof GitPrePushContext + || $context instanceof RunContext; } /** diff --git a/src/Task/Grunt.php b/src/Task/Grunt.php index c284887ba..95eafc90c 100644 --- a/src/Task/Grunt.php +++ b/src/Task/Grunt.php @@ -10,6 +10,7 @@ use GrumPHP\Task\Config\ConfigOptionsResolver; use GrumPHP\Task\Context\ContextInterface; use GrumPHP\Task\Context\GitPreCommitContext; +use GrumPHP\Task\Context\GitPrePushContext; use GrumPHP\Task\Context\RunContext; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -39,7 +40,9 @@ public static function getConfigurableOptions(): ConfigOptionsResolver */ public function canRunInContext(ContextInterface $context): bool { - return $context instanceof GitPreCommitContext || $context instanceof RunContext; + return $context instanceof GitPreCommitContext + || $context instanceof GitPrePushContext + || $context instanceof RunContext; } /** diff --git a/src/Task/Gulp.php b/src/Task/Gulp.php index 215384e1a..3af8fc140 100644 --- a/src/Task/Gulp.php +++ b/src/Task/Gulp.php @@ -10,6 +10,7 @@ use GrumPHP\Task\Config\ConfigOptionsResolver; use GrumPHP\Task\Context\ContextInterface; use GrumPHP\Task\Context\GitPreCommitContext; +use GrumPHP\Task\Context\GitPrePushContext; use GrumPHP\Task\Context\RunContext; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -39,7 +40,9 @@ public static function getConfigurableOptions(): ConfigOptionsResolver */ public function canRunInContext(ContextInterface $context): bool { - return $context instanceof GitPreCommitContext || $context instanceof RunContext; + return $context instanceof GitPreCommitContext + || $context instanceof GitPrePushContext + || $context instanceof RunContext; } /** diff --git a/src/Task/Infection.php b/src/Task/Infection.php index 65d83152d..c918dc830 100644 --- a/src/Task/Infection.php +++ b/src/Task/Infection.php @@ -10,6 +10,7 @@ use GrumPHP\Task\Config\ConfigOptionsResolver; use GrumPHP\Task\Context\ContextInterface; use GrumPHP\Task\Context\GitPreCommitContext; +use GrumPHP\Task\Context\GitPrePushContext; use GrumPHP\Task\Context\RunContext; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -56,7 +57,9 @@ public static function getConfigurableOptions(): ConfigOptionsResolver */ public function canRunInContext(ContextInterface $context): bool { - return $context instanceof GitPreCommitContext || $context instanceof RunContext; + return $context instanceof GitPreCommitContext + || $context instanceof GitPrePushContext + || $context instanceof RunContext; } /** diff --git a/src/Task/JsonLint.php b/src/Task/JsonLint.php index d928df9e2..02fb8b7d1 100644 --- a/src/Task/JsonLint.php +++ b/src/Task/JsonLint.php @@ -11,6 +11,7 @@ use GrumPHP\Task\Config\ConfigOptionsResolver; use GrumPHP\Task\Context\ContextInterface; use GrumPHP\Task\Context\GitPreCommitContext; +use GrumPHP\Task\Context\GitPrePushContext; use GrumPHP\Task\Context\RunContext; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -41,7 +42,9 @@ public static function getConfigurableOptions(): ConfigOptionsResolver */ public function canRunInContext(ContextInterface $context): bool { - return $context instanceof GitPreCommitContext || $context instanceof RunContext; + return $context instanceof GitPreCommitContext + || $context instanceof GitPrePushContext + || $context instanceof RunContext; } /** diff --git a/src/Task/Kahlan.php b/src/Task/Kahlan.php index c4262adfb..f2d251f82 100644 --- a/src/Task/Kahlan.php +++ b/src/Task/Kahlan.php @@ -10,6 +10,7 @@ use GrumPHP\Task\Config\ConfigOptionsResolver; use GrumPHP\Task\Context\ContextInterface; use GrumPHP\Task\Context\GitPreCommitContext; +use GrumPHP\Task\Context\GitPrePushContext; use GrumPHP\Task\Context\RunContext; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -72,7 +73,9 @@ public static function getConfigurableOptions(): ConfigOptionsResolver */ public function canRunInContext(ContextInterface $context): bool { - return $context instanceof GitPreCommitContext || $context instanceof RunContext; + return $context instanceof GitPreCommitContext + || $context instanceof GitPrePushContext + || $context instanceof RunContext; } /** diff --git a/src/Task/Make.php b/src/Task/Make.php index d8750f07d..2919d5784 100644 --- a/src/Task/Make.php +++ b/src/Task/Make.php @@ -10,6 +10,7 @@ use GrumPHP\Task\Config\ConfigOptionsResolver; use GrumPHP\Task\Context\ContextInterface; use GrumPHP\Task\Context\GitPreCommitContext; +use GrumPHP\Task\Context\GitPrePushContext; use GrumPHP\Task\Context\RunContext; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -39,7 +40,9 @@ public static function getConfigurableOptions(): ConfigOptionsResolver */ public function canRunInContext(ContextInterface $context): bool { - return $context instanceof GitPreCommitContext || $context instanceof RunContext; + return $context instanceof GitPreCommitContext + || $context instanceof GitPrePushContext + || $context instanceof RunContext; } /** diff --git a/src/Task/NpmScript.php b/src/Task/NpmScript.php index 88e7a5361..9cce55644 100644 --- a/src/Task/NpmScript.php +++ b/src/Task/NpmScript.php @@ -10,6 +10,7 @@ use GrumPHP\Task\Config\ConfigOptionsResolver; use GrumPHP\Task\Context\ContextInterface; use GrumPHP\Task\Context\GitPreCommitContext; +use GrumPHP\Task\Context\GitPrePushContext; use GrumPHP\Task\Context\RunContext; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -43,7 +44,9 @@ public static function getConfigurableOptions(): ConfigOptionsResolver */ public function canRunInContext(ContextInterface $context): bool { - return $context instanceof GitPreCommitContext || $context instanceof RunContext; + return $context instanceof GitPreCommitContext + || $context instanceof GitPrePushContext + || $context instanceof RunContext; } /** diff --git a/src/Task/Paratest.php b/src/Task/Paratest.php index 602809cb8..9a2fb9038 100644 --- a/src/Task/Paratest.php +++ b/src/Task/Paratest.php @@ -10,6 +10,7 @@ use GrumPHP\Task\Config\ConfigOptionsResolver; use GrumPHP\Task\Context\ContextInterface; use GrumPHP\Task\Context\GitPreCommitContext; +use GrumPHP\Task\Context\GitPrePushContext; use GrumPHP\Task\Context\RunContext; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -60,7 +61,9 @@ public static function getConfigurableOptions(): ConfigOptionsResolver public function canRunInContext(ContextInterface $context): bool { - return $context instanceof GitPreCommitContext || $context instanceof RunContext; + return $context instanceof GitPreCommitContext + || $context instanceof GitPrePushContext + || $context instanceof RunContext; } public function run(ContextInterface $context): TaskResultInterface diff --git a/src/Task/Pest.php b/src/Task/Pest.php index e1c33a293..508ca534a 100644 --- a/src/Task/Pest.php +++ b/src/Task/Pest.php @@ -10,6 +10,7 @@ use GrumPHP\Task\Config\ConfigOptionsResolver; use GrumPHP\Task\Context\ContextInterface; use GrumPHP\Task\Context\GitPreCommitContext; +use GrumPHP\Task\Context\GitPrePushContext; use GrumPHP\Task\Context\RunContext; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -38,7 +39,9 @@ public static function getConfigurableOptions(): ConfigOptionsResolver public function canRunInContext(ContextInterface $context): bool { - return $context instanceof GitPreCommitContext || $context instanceof RunContext; + return $context instanceof GitPreCommitContext + || $context instanceof GitPrePushContext + || $context instanceof RunContext; } public function run(ContextInterface $context): TaskResultInterface diff --git a/src/Task/Phan.php b/src/Task/Phan.php index a42a8e4ec..5892d1772 100644 --- a/src/Task/Phan.php +++ b/src/Task/Phan.php @@ -10,6 +10,7 @@ use GrumPHP\Task\Config\ConfigOptionsResolver; use GrumPHP\Task\Context\ContextInterface; use GrumPHP\Task\Context\GitPreCommitContext; +use GrumPHP\Task\Context\GitPrePushContext; use GrumPHP\Task\Context\RunContext; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -43,7 +44,9 @@ public static function getConfigurableOptions(): ConfigOptionsResolver */ public function canRunInContext(ContextInterface $context): bool { - return $context instanceof GitPreCommitContext || $context instanceof RunContext; + return $context instanceof GitPreCommitContext + || $context instanceof GitPrePushContext + || $context instanceof RunContext; } /** diff --git a/src/Task/Phing.php b/src/Task/Phing.php index 7ccb23585..ea85e3ea0 100644 --- a/src/Task/Phing.php +++ b/src/Task/Phing.php @@ -10,6 +10,7 @@ use GrumPHP\Task\Config\ConfigOptionsResolver; use GrumPHP\Task\Context\ContextInterface; use GrumPHP\Task\Context\GitPreCommitContext; +use GrumPHP\Task\Context\GitPrePushContext; use GrumPHP\Task\Context\RunContext; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -39,7 +40,9 @@ public static function getConfigurableOptions(): ConfigOptionsResolver */ public function canRunInContext(ContextInterface $context): bool { - return $context instanceof GitPreCommitContext || $context instanceof RunContext; + return $context instanceof GitPreCommitContext + || $context instanceof GitPrePushContext + || $context instanceof RunContext; } /** diff --git a/src/Task/PhpArkitect.php b/src/Task/PhpArkitect.php index 5a35785cd..5a520c3f7 100644 --- a/src/Task/PhpArkitect.php +++ b/src/Task/PhpArkitect.php @@ -10,6 +10,7 @@ use GrumPHP\Task\Config\ConfigOptionsResolver; use GrumPHP\Task\Context\ContextInterface; use GrumPHP\Task\Context\GitPreCommitContext; +use GrumPHP\Task\Context\GitPrePushContext; use GrumPHP\Task\Context\RunContext; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -39,7 +40,9 @@ public static function getConfigurableOptions(): ConfigOptionsResolver */ public function canRunInContext(ContextInterface $context): bool { - return $context instanceof GitPreCommitContext || $context instanceof RunContext; + return $context instanceof GitPreCommitContext + || $context instanceof GitPrePushContext + || $context instanceof RunContext; } /** diff --git a/src/Task/PhpCpd.php b/src/Task/PhpCpd.php index 87476dc5b..1c6fe60af 100644 --- a/src/Task/PhpCpd.php +++ b/src/Task/PhpCpd.php @@ -10,6 +10,7 @@ use GrumPHP\Task\Config\ConfigOptionsResolver; use GrumPHP\Task\Context\ContextInterface; use GrumPHP\Task\Context\GitPreCommitContext; +use GrumPHP\Task\Context\GitPrePushContext; use GrumPHP\Task\Context\RunContext; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -45,7 +46,9 @@ public static function getConfigurableOptions(): ConfigOptionsResolver */ public function canRunInContext(ContextInterface $context): bool { - return $context instanceof GitPreCommitContext || $context instanceof RunContext; + return $context instanceof GitPreCommitContext + || $context instanceof GitPrePushContext + || $context instanceof RunContext; } /** diff --git a/src/Task/PhpCsFixer.php b/src/Task/PhpCsFixer.php index cfec6ae9b..28b100ed7 100644 --- a/src/Task/PhpCsFixer.php +++ b/src/Task/PhpCsFixer.php @@ -11,6 +11,7 @@ use GrumPHP\Task\Config\ConfigOptionsResolver; use GrumPHP\Task\Context\ContextInterface; use GrumPHP\Task\Context\GitPreCommitContext; +use GrumPHP\Task\Context\GitPrePushContext; use GrumPHP\Task\Context\RunContext; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Process\Process; @@ -58,7 +59,9 @@ public static function getConfigurableOptions(): ConfigOptionsResolver */ public function canRunInContext(ContextInterface $context): bool { - return $context instanceof GitPreCommitContext || $context instanceof RunContext; + return $context instanceof GitPreCommitContext + || $context instanceof GitPrePushContext + || $context instanceof RunContext; } /** diff --git a/src/Task/PhpMd.php b/src/Task/PhpMd.php index 1aeccdaa7..02a04085a 100644 --- a/src/Task/PhpMd.php +++ b/src/Task/PhpMd.php @@ -10,6 +10,7 @@ use GrumPHP\Task\Config\ConfigOptionsResolver; use GrumPHP\Task\Context\ContextInterface; use GrumPHP\Task\Context\GitPreCommitContext; +use GrumPHP\Task\Context\GitPrePushContext; use GrumPHP\Task\Context\RunContext; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -44,7 +45,9 @@ public static function getConfigurableOptions(): ConfigOptionsResolver */ public function canRunInContext(ContextInterface $context): bool { - return $context instanceof GitPreCommitContext || $context instanceof RunContext; + return $context instanceof GitPreCommitContext + || $context instanceof GitPrePushContext + || $context instanceof RunContext; } /** diff --git a/src/Task/PhpMnd.php b/src/Task/PhpMnd.php index 00caa55a4..7c8df0a8e 100644 --- a/src/Task/PhpMnd.php +++ b/src/Task/PhpMnd.php @@ -10,6 +10,7 @@ use GrumPHP\Task\Config\ConfigOptionsResolver; use GrumPHP\Task\Context\ContextInterface; use GrumPHP\Task\Context\GitPreCommitContext; +use GrumPHP\Task\Context\GitPrePushContext; use GrumPHP\Task\Context\RunContext; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -57,7 +58,9 @@ public static function getConfigurableOptions(): ConfigOptionsResolver */ public function canRunInContext(ContextInterface $context): bool { - return $context instanceof GitPreCommitContext || $context instanceof RunContext; + return $context instanceof GitPreCommitContext + || $context instanceof GitPrePushContext + || $context instanceof RunContext; } /** diff --git a/src/Task/PhpParser.php b/src/Task/PhpParser.php index 7fef195c6..4013b50e4 100644 --- a/src/Task/PhpParser.php +++ b/src/Task/PhpParser.php @@ -7,6 +7,7 @@ use GrumPHP\Task\Config\ConfigOptionsResolver; use GrumPHP\Task\Context\ContextInterface; use GrumPHP\Task\Context\GitPreCommitContext; +use GrumPHP\Task\Context\GitPrePushContext; use GrumPHP\Task\Context\RunContext; use GrumPHP\Runner\TaskResult; use GrumPHP\Runner\TaskResultInterface; @@ -44,7 +45,9 @@ public static function getConfigurableOptions(): ConfigOptionsResolver public function canRunInContext(ContextInterface $context): bool { - return $context instanceof GitPreCommitContext || $context instanceof RunContext; + return $context instanceof GitPreCommitContext + || $context instanceof GitPrePushContext + || $context instanceof RunContext; } public function run(ContextInterface $context): TaskResultInterface diff --git a/src/Task/PhpStan.php b/src/Task/PhpStan.php index 0fa048bd7..7372601cc 100644 --- a/src/Task/PhpStan.php +++ b/src/Task/PhpStan.php @@ -10,6 +10,7 @@ use GrumPHP\Task\Config\ConfigOptionsResolver; use GrumPHP\Task\Context\ContextInterface; use GrumPHP\Task\Context\GitPreCommitContext; +use GrumPHP\Task\Context\GitPrePushContext; use GrumPHP\Task\Context\RunContext; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -60,7 +61,9 @@ function ($value) { */ public function canRunInContext(ContextInterface $context): bool { - return $context instanceof GitPreCommitContext || $context instanceof RunContext; + return $context instanceof GitPreCommitContext + || $context instanceof GitPrePushContext + || $context instanceof RunContext; } /** diff --git a/src/Task/Phpcs.php b/src/Task/Phpcs.php index c16320b31..844c4d0bd 100644 --- a/src/Task/Phpcs.php +++ b/src/Task/Phpcs.php @@ -15,6 +15,7 @@ use GrumPHP\Task\Config\ConfigOptionsResolver; use GrumPHP\Task\Context\ContextInterface; use GrumPHP\Task\Context\GitPreCommitContext; +use GrumPHP\Task\Context\GitPrePushContext; use GrumPHP\Task\Context\RunContext; use Symfony\Component\Console\Exception\CommandNotFoundException; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -70,7 +71,9 @@ public static function getConfigurableOptions(): ConfigOptionsResolver public function canRunInContext(ContextInterface $context): bool { - return $context instanceof GitPreCommitContext || $context instanceof RunContext; + return $context instanceof GitPreCommitContext + || $context instanceof GitPrePushContext + || $context instanceof RunContext; } public function run(ContextInterface $context): TaskResultInterface diff --git a/src/Task/Phpspec.php b/src/Task/Phpspec.php index c5ae99883..8111786eb 100644 --- a/src/Task/Phpspec.php +++ b/src/Task/Phpspec.php @@ -10,6 +10,7 @@ use GrumPHP\Task\Config\ConfigOptionsResolver; use GrumPHP\Task\Context\ContextInterface; use GrumPHP\Task\Context\GitPreCommitContext; +use GrumPHP\Task\Context\GitPrePushContext; use GrumPHP\Task\Context\RunContext; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -38,7 +39,9 @@ public static function getConfigurableOptions(): ConfigOptionsResolver public function canRunInContext(ContextInterface $context): bool { - return $context instanceof GitPreCommitContext || $context instanceof RunContext; + return $context instanceof GitPreCommitContext + || $context instanceof GitPrePushContext + || $context instanceof RunContext; } public function run(ContextInterface $context): TaskResultInterface diff --git a/src/Task/Phpunit.php b/src/Task/Phpunit.php index 857950bd5..30b46a660 100644 --- a/src/Task/Phpunit.php +++ b/src/Task/Phpunit.php @@ -10,6 +10,7 @@ use GrumPHP\Task\Config\ConfigOptionsResolver; use GrumPHP\Task\Context\ContextInterface; use GrumPHP\Task\Context\GitPreCommitContext; +use GrumPHP\Task\Context\GitPrePushContext; use GrumPHP\Task\Context\RunContext; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -42,7 +43,9 @@ public static function getConfigurableOptions(): ConfigOptionsResolver public function canRunInContext(ContextInterface $context): bool { - return $context instanceof GitPreCommitContext || $context instanceof RunContext; + return $context instanceof GitPreCommitContext + || $context instanceof GitPrePushContext + || $context instanceof RunContext; } public function run(ContextInterface $context): TaskResultInterface diff --git a/src/Task/Robo.php b/src/Task/Robo.php index d33e43140..cf04ae4b1 100644 --- a/src/Task/Robo.php +++ b/src/Task/Robo.php @@ -10,6 +10,7 @@ use GrumPHP\Task\Config\ConfigOptionsResolver; use GrumPHP\Task\Context\ContextInterface; use GrumPHP\Task\Context\GitPreCommitContext; +use GrumPHP\Task\Context\GitPrePushContext; use GrumPHP\Task\Context\RunContext; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -39,7 +40,9 @@ public static function getConfigurableOptions(): ConfigOptionsResolver */ public function canRunInContext(ContextInterface $context): bool { - return $context instanceof GitPreCommitContext || $context instanceof RunContext; + return $context instanceof GitPreCommitContext + || $context instanceof GitPrePushContext + || $context instanceof RunContext; } /** diff --git a/src/Task/SecurityChecker.php b/src/Task/SecurityChecker.php index 4937f74b7..0a3d027e1 100644 --- a/src/Task/SecurityChecker.php +++ b/src/Task/SecurityChecker.php @@ -10,6 +10,7 @@ use GrumPHP\Task\Config\ConfigOptionsResolver; use GrumPHP\Task\Context\ContextInterface; use GrumPHP\Task\Context\GitPreCommitContext; +use GrumPHP\Task\Context\GitPrePushContext; use GrumPHP\Task\Context\RunContext; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -40,7 +41,9 @@ public static function getConfigurableOptions(): ConfigOptionsResolver public function canRunInContext(ContextInterface $context): bool { - return $context instanceof GitPreCommitContext || $context instanceof RunContext; + return $context instanceof GitPreCommitContext + || $context instanceof GitPrePushContext + || $context instanceof RunContext; } public function run(ContextInterface $context): TaskResultInterface diff --git a/src/Task/SecurityCheckerComposeraudit.php b/src/Task/SecurityCheckerComposeraudit.php index d57dc1a69..66a26f8bb 100644 --- a/src/Task/SecurityCheckerComposeraudit.php +++ b/src/Task/SecurityCheckerComposeraudit.php @@ -10,6 +10,7 @@ use GrumPHP\Task\Config\ConfigOptionsResolver; use GrumPHP\Task\Context\ContextInterface; use GrumPHP\Task\Context\GitPreCommitContext; +use GrumPHP\Task\Context\GitPrePushContext; use GrumPHP\Task\Context\RunContext; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -40,7 +41,9 @@ public static function getConfigurableOptions(): ConfigOptionsResolver public function canRunInContext(ContextInterface $context): bool { - return $context instanceof GitPreCommitContext || $context instanceof RunContext; + return $context instanceof GitPreCommitContext + || $context instanceof GitPrePushContext + || $context instanceof RunContext; } public function run(ContextInterface $context): TaskResultInterface diff --git a/src/Task/SecurityCheckerEnlightn.php b/src/Task/SecurityCheckerEnlightn.php index 614e41ec2..295b80ec5 100644 --- a/src/Task/SecurityCheckerEnlightn.php +++ b/src/Task/SecurityCheckerEnlightn.php @@ -10,6 +10,7 @@ use GrumPHP\Task\Config\ConfigOptionsResolver; use GrumPHP\Task\Context\ContextInterface; use GrumPHP\Task\Context\GitPreCommitContext; +use GrumPHP\Task\Context\GitPrePushContext; use GrumPHP\Task\Context\RunContext; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -34,7 +35,9 @@ public static function getConfigurableOptions(): ConfigOptionsResolver public function canRunInContext(ContextInterface $context): bool { - return $context instanceof GitPreCommitContext || $context instanceof RunContext; + return $context instanceof GitPreCommitContext + || $context instanceof GitPrePushContext + || $context instanceof RunContext; } public function run(ContextInterface $context): TaskResultInterface diff --git a/src/Task/SecurityCheckerLocal.php b/src/Task/SecurityCheckerLocal.php index 5858a400a..f4b5ad1eb 100644 --- a/src/Task/SecurityCheckerLocal.php +++ b/src/Task/SecurityCheckerLocal.php @@ -10,6 +10,7 @@ use GrumPHP\Task\Config\ConfigOptionsResolver; use GrumPHP\Task\Context\ContextInterface; use GrumPHP\Task\Context\GitPreCommitContext; +use GrumPHP\Task\Context\GitPrePushContext; use GrumPHP\Task\Context\RunContext; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -38,7 +39,9 @@ public static function getConfigurableOptions(): ConfigOptionsResolver public function canRunInContext(ContextInterface $context): bool { - return $context instanceof GitPreCommitContext || $context instanceof RunContext; + return $context instanceof GitPreCommitContext + || $context instanceof GitPrePushContext + || $context instanceof RunContext; } public function run(ContextInterface $context): TaskResultInterface diff --git a/src/Task/SecurityCheckerRoave.php b/src/Task/SecurityCheckerRoave.php index 548d6cdec..45176119e 100644 --- a/src/Task/SecurityCheckerRoave.php +++ b/src/Task/SecurityCheckerRoave.php @@ -11,6 +11,7 @@ use GrumPHP\Task\Config\ConfigOptionsResolver; use GrumPHP\Task\Context\ContextInterface; use GrumPHP\Task\Context\GitPreCommitContext; +use GrumPHP\Task\Context\GitPrePushContext; use GrumPHP\Task\Context\RunContext; use GrumPHP\Util\Filesystem; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -50,7 +51,9 @@ public static function getConfigurableOptions(): ConfigOptionsResolver public function canRunInContext(ContextInterface $context): bool { - return $context instanceof GitPreCommitContext || $context instanceof RunContext; + return $context instanceof GitPreCommitContext + || $context instanceof GitPrePushContext + || $context instanceof RunContext; } public function run(ContextInterface $context): TaskResultInterface diff --git a/src/Task/SecurityCheckerSymfony.php b/src/Task/SecurityCheckerSymfony.php index bbb77ba5a..38c0f7f2e 100644 --- a/src/Task/SecurityCheckerSymfony.php +++ b/src/Task/SecurityCheckerSymfony.php @@ -10,6 +10,7 @@ use GrumPHP\Task\Config\ConfigOptionsResolver; use GrumPHP\Task\Context\ContextInterface; use GrumPHP\Task\Context\GitPreCommitContext; +use GrumPHP\Task\Context\GitPrePushContext; use GrumPHP\Task\Context\RunContext; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -36,7 +37,9 @@ public static function getConfigurableOptions(): ConfigOptionsResolver public function canRunInContext(ContextInterface $context): bool { - return $context instanceof GitPreCommitContext || $context instanceof RunContext; + return $context instanceof GitPreCommitContext + || $context instanceof GitPrePushContext + || $context instanceof RunContext; } public function run(ContextInterface $context): TaskResultInterface diff --git a/src/Task/Shell.php b/src/Task/Shell.php index ab4b1f6cc..c75701caa 100644 --- a/src/Task/Shell.php +++ b/src/Task/Shell.php @@ -11,6 +11,7 @@ use GrumPHP\Task\Config\ConfigOptionsResolver; use GrumPHP\Task\Context\ContextInterface; use GrumPHP\Task\Context\GitPreCommitContext; +use GrumPHP\Task\Context\GitPrePushContext; use GrumPHP\Task\Context\RunContext; use Symfony\Component\OptionsResolver\Options; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -50,7 +51,9 @@ function ($script) { */ public function canRunInContext(ContextInterface $context): bool { - return $context instanceof GitPreCommitContext || $context instanceof RunContext; + return $context instanceof GitPreCommitContext + || $context instanceof GitPrePushContext + || $context instanceof RunContext; } /** diff --git a/src/Task/Tester.php b/src/Task/Tester.php index 0f94b281a..32fcef800 100644 --- a/src/Task/Tester.php +++ b/src/Task/Tester.php @@ -10,6 +10,7 @@ use GrumPHP\Task\Config\ConfigOptionsResolver; use GrumPHP\Task\Context\ContextInterface; use GrumPHP\Task\Context\GitPreCommitContext; +use GrumPHP\Task\Context\GitPrePushContext; use GrumPHP\Task\Context\RunContext; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -58,7 +59,9 @@ public static function getConfigurableOptions(): ConfigOptionsResolver public function canRunInContext(ContextInterface $context): bool { - return $context instanceof GitPreCommitContext || $context instanceof RunContext; + return $context instanceof GitPreCommitContext + || $context instanceof GitPrePushContext + || $context instanceof RunContext; } public function run(ContextInterface $context): TaskResultInterface diff --git a/src/Task/TwigCs.php b/src/Task/TwigCs.php index 125f96694..7ce5c8df5 100644 --- a/src/Task/TwigCs.php +++ b/src/Task/TwigCs.php @@ -10,6 +10,7 @@ use GrumPHP\Task\Config\ConfigOptionsResolver; use GrumPHP\Task\Context\ContextInterface; use GrumPHP\Task\Context\GitPreCommitContext; +use GrumPHP\Task\Context\GitPrePushContext; use GrumPHP\Task\Context\RunContext; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -42,7 +43,9 @@ public static function getConfigurableOptions(): ConfigOptionsResolver public function canRunInContext(ContextInterface $context): bool { - return $context instanceof GitPreCommitContext || $context instanceof RunContext; + return $context instanceof GitPreCommitContext + || $context instanceof GitPrePushContext + || $context instanceof RunContext; } public function run(ContextInterface $context): TaskResultInterface diff --git a/src/Task/TwigCsFixer.php b/src/Task/TwigCsFixer.php index 20bdaa8b5..7fd36d3b6 100644 --- a/src/Task/TwigCsFixer.php +++ b/src/Task/TwigCsFixer.php @@ -10,6 +10,7 @@ use GrumPHP\Task\Config\ConfigOptionsResolver; use GrumPHP\Task\Context\ContextInterface; use GrumPHP\Task\Context\GitPreCommitContext; +use GrumPHP\Task\Context\GitPrePushContext; use GrumPHP\Task\Context\RunContext; use Symfony\Component\OptionsResolver\OptionsResolver; use GrumPHP\Fixer\Provider\FixableProcessResultProvider; @@ -45,7 +46,9 @@ public static function getConfigurableOptions(): ConfigOptionsResolver public function canRunInContext(ContextInterface $context): bool { - return $context instanceof GitPreCommitContext || $context instanceof RunContext; + return $context instanceof GitPreCommitContext + || $context instanceof GitPrePushContext + || $context instanceof RunContext; } public function run(ContextInterface $context): TaskResultInterface diff --git a/src/Task/XmlLint.php b/src/Task/XmlLint.php index d8c2ebd21..33c04da3d 100644 --- a/src/Task/XmlLint.php +++ b/src/Task/XmlLint.php @@ -11,6 +11,7 @@ use GrumPHP\Task\Config\ConfigOptionsResolver; use GrumPHP\Task\Context\ContextInterface; use GrumPHP\Task\Context\GitPreCommitContext; +use GrumPHP\Task\Context\GitPrePushContext; use GrumPHP\Task\Context\RunContext; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -49,7 +50,9 @@ public static function getConfigurableOptions(): ConfigOptionsResolver */ public function canRunInContext(ContextInterface $context): bool { - return $context instanceof GitPreCommitContext || $context instanceof RunContext; + return $context instanceof GitPreCommitContext + || $context instanceof GitPrePushContext + || $context instanceof RunContext; } /** diff --git a/src/Task/YamlLint.php b/src/Task/YamlLint.php index d0064582b..104a68678 100644 --- a/src/Task/YamlLint.php +++ b/src/Task/YamlLint.php @@ -12,6 +12,7 @@ use GrumPHP\Task\Config\ConfigOptionsResolver; use GrumPHP\Task\Context\ContextInterface; use GrumPHP\Task\Context\GitPreCommitContext; +use GrumPHP\Task\Context\GitPrePushContext; use GrumPHP\Task\Context\RunContext; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -48,7 +49,9 @@ public static function getConfigurableOptions(): ConfigOptionsResolver public function canRunInContext(ContextInterface $context): bool { - return $context instanceof GitPreCommitContext || $context instanceof RunContext; + return $context instanceof GitPreCommitContext + || $context instanceof GitPrePushContext + || $context instanceof RunContext; } public function run(ContextInterface $context): TaskResultInterface