Skip to content

Commit

Permalink
Revert "Allow to configure which hooks to run"
Browse files Browse the repository at this point in the history
This reverts commit ee7707e.
  • Loading branch information
claudiu-cristea committed May 26, 2024
1 parent 0c1245e commit 426a6a5
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 22 deletions.
1 change: 0 additions & 1 deletion resources/config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ services:
- '%hooks_dir%'
- '%hooks_preset%'
- '%git_hook_variables%'
- '%git_hooks%'
GrumPHP\Configuration\Model\ParallelConfig:
factory: ['GrumPHP\Configuration\Model\ParallelConfig', 'fromArray']
arguments:
Expand Down
9 changes: 0 additions & 9 deletions src/Configuration/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace GrumPHP\Configuration;

use GrumPHP\Console\Command\Git\InitCommand;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
Expand Down Expand Up @@ -71,14 +70,6 @@ public function getConfigTreeBuilder(): TreeBuilder
$ascii->children()->variableNode('failed')->defaultValue('grumphp-grumpy.txt');
$ascii->children()->variableNode('succeeded')->defaultValue('grumphp-happy.txt');

$rootNode->children()->arrayNode('git_hooks')->defaultValue(InitCommand::$hooks)
->prototype('scalar')
->validate()
->ifNotInArray(InitCommand::$hooks)
->thenInvalid('Invalid item %s')
->end()
->end();

// parallel
$parallel = $rootNode->children()->arrayNode('parallel');
$parallel->canBeDisabled();
Expand Down
8 changes: 1 addition & 7 deletions src/Configuration/Model/HooksConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ class HooksConfig
public function __construct(
?string $dir,
string $preset,
array $variables,
private array $gitHooks,
array $variables
) {
$this->dir = $dir;
$this->preset = $preset;
Expand All @@ -49,9 +48,4 @@ public function getVariables(): array
{
return $this->variables;
}

public function getGitHooks(): array
{
return $this->gitHooks;
}
}
1 change: 0 additions & 1 deletion src/Console/Command/Git/DeInitCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class DeInitCommand extends Command
*/
protected static $hooks = [
'pre-commit',
'pre-push',
'commit-msg',
];

Expand Down
4 changes: 0 additions & 4 deletions src/Console/Command/Git/InitCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ class InitCommand extends Command
*/
public static $hooks = [
'pre-commit',
'pre-push',
'commit-msg',
];

Expand Down Expand Up @@ -101,9 +100,6 @@ public function execute(InputInterface $input, OutputInterface $output): int
}

foreach (self::$hooks as $hook) {
if (!in_array($hook, $this->hooksConfig->getGitHooks(), true)) {
continue;
}
$gitHook = $this->filesystem->buildPath($gitHooksPath, $hook);
$hookTemplate = $this->filesystem->guessFile(
[
Expand Down

0 comments on commit 426a6a5

Please sign in to comment.