@@ -34,24 +34,24 @@ discard block |
||
| 34 | 34 | protected function configure() : void |
| 35 | 35 | { |
| 36 | 36 | $this->setName('configure') |
| 37 | - ->setDescription('Configure your hooks') |
|
| 38 | - ->setHelp('This command creates or updates your captainhook configuration') |
|
| 39 | - ->addOption('extend', 'e', InputOption::VALUE_NONE, 'Extend existing configuration file') |
|
| 40 | - ->addOption('force', 'f', InputOption::VALUE_NONE, 'Overwrite existing configuration file') |
|
| 41 | - ->addOption('advanced', 'a', InputOption::VALUE_NONE, 'More options, but more to type') |
|
| 42 | - ->addOption( |
|
| 43 | - 'configuration', |
|
| 44 | - 'c', |
|
| 45 | - InputOption::VALUE_OPTIONAL, |
|
| 46 | - 'Path to your json configuration', |
|
| 47 | - './' . CH::CONFIG |
|
| 48 | - ) |
|
| 49 | - ->addOption( |
|
| 50 | - 'vendor-directory', |
|
| 51 | - null, |
|
| 52 | - InputOption::VALUE_OPTIONAL, |
|
| 53 | - 'Path to composers vendor directory' |
|
| 54 | - ); |
|
| 37 | + ->setDescription('Configure your hooks') |
|
| 38 | + ->setHelp('This command creates or updates your captainhook configuration') |
|
| 39 | + ->addOption('extend', 'e', InputOption::VALUE_NONE, 'Extend existing configuration file') |
|
| 40 | + ->addOption('force', 'f', InputOption::VALUE_NONE, 'Overwrite existing configuration file') |
|
| 41 | + ->addOption('advanced', 'a', InputOption::VALUE_NONE, 'More options, but more to type') |
|
| 42 | + ->addOption( |
|
| 43 | + 'configuration', |
|
| 44 | + 'c', |
|
| 45 | + InputOption::VALUE_OPTIONAL, |
|
| 46 | + 'Path to your json configuration', |
|
| 47 | + './' . CH::CONFIG |
|
| 48 | + ) |
|
| 49 | + ->addOption( |
|
| 50 | + 'vendor-directory', |
|
| 51 | + null, |
|
| 52 | + InputOption::VALUE_OPTIONAL, |
|
| 53 | + 'Path to composers vendor directory' |
|
| 54 | + ); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
@@ -70,9 +70,9 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | $configurator = new Creator($io, $config); |
| 72 | 72 | $configurator->force(IOUtil::argToBool($input->getOption('force'))) |
| 73 | - ->extend(IOUtil::argToBool($input->getOption('extend'))) |
|
| 74 | - ->advanced(IOUtil::argToBool($input->getOption('advanced'))) |
|
| 75 | - ->run(); |
|
| 73 | + ->extend(IOUtil::argToBool($input->getOption('extend'))) |
|
| 74 | + ->advanced(IOUtil::argToBool($input->getOption('advanced'))) |
|
| 75 | + ->run(); |
|
| 76 | 76 | return 0; |
| 77 | 77 | } |
| 78 | 78 | } |
@@ -68,8 +68,8 @@ |
||
| 68 | 68 | protected function configure() : void |
| 69 | 69 | { |
| 70 | 70 | $this->setName($this->name) |
| 71 | - ->setDescription('Run git ' . $this->name . ' hook.') |
|
| 72 | - ->setHelp('This command executes the ' . $this->name . ' hook.'); |
|
| 71 | + ->setDescription('Run git ' . $this->name . ' hook.') |
|
| 72 | + ->setHelp('This command executes the ' . $this->name . ' hook.'); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /** |
@@ -35,16 +35,16 @@ discard block |
||
| 35 | 35 | protected function configure() : void |
| 36 | 36 | { |
| 37 | 37 | $this->setName('add') |
| 38 | - ->setDescription('Add an action to a hook configuration') |
|
| 39 | - ->setHelp('This command will add an action configuration to a given hook configuration') |
|
| 40 | - ->addArgument('hook', InputArgument::REQUIRED, 'Hook you want to add the action to') |
|
| 41 | - ->addOption( |
|
| 42 | - 'configuration', |
|
| 43 | - 'c', |
|
| 44 | - InputOption::VALUE_OPTIONAL, |
|
| 45 | - 'Path to your json configuration', |
|
| 46 | - getcwd() . DIRECTORY_SEPARATOR . CH::CONFIG |
|
| 47 | - ); |
|
| 38 | + ->setDescription('Add an action to a hook configuration') |
|
| 39 | + ->setHelp('This command will add an action configuration to a given hook configuration') |
|
| 40 | + ->addArgument('hook', InputArgument::REQUIRED, 'Hook you want to add the action to') |
|
| 41 | + ->addOption( |
|
| 42 | + 'configuration', |
|
| 43 | + 'c', |
|
| 44 | + InputOption::VALUE_OPTIONAL, |
|
| 45 | + 'Path to your json configuration', |
|
| 46 | + getcwd() . DIRECTORY_SEPARATOR . CH::CONFIG |
|
| 47 | + ); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /** |
@@ -62,8 +62,8 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | $editor = new Editor($io, $config); |
| 64 | 64 | $editor->setHook(IOUtil::argToString($input->getArgument('hook'))) |
| 65 | - ->setChange('AddAction') |
|
| 66 | - ->run(); |
|
| 65 | + ->setChange('AddAction') |
|
| 66 | + ->run(); |
|
| 67 | 67 | |
| 68 | 68 | return 0; |
| 69 | 69 | } |
@@ -38,46 +38,46 @@ discard block |
||
| 38 | 38 | protected function configure() : void |
| 39 | 39 | { |
| 40 | 40 | $this->setName('install') |
| 41 | - ->setDescription('Install git hooks') |
|
| 42 | - ->setHelp('This command will install the git hooks to your .git directory') |
|
| 43 | - ->addArgument('hook', InputArgument::OPTIONAL, 'Hook you want to install') |
|
| 44 | - ->addOption( |
|
| 45 | - 'configuration', |
|
| 46 | - 'c', |
|
| 47 | - InputOption::VALUE_OPTIONAL, |
|
| 48 | - 'Path to your json configuration', |
|
| 49 | - getcwd() . DIRECTORY_SEPARATOR . CH::CONFIG |
|
| 50 | - ) |
|
| 51 | - ->addOption( |
|
| 52 | - 'force', |
|
| 53 | - 'f', |
|
| 54 | - InputOption::VALUE_NONE, |
|
| 55 | - 'Force to overwrite existing hooks' |
|
| 56 | - ) |
|
| 57 | - ->addOption( |
|
| 58 | - 'git-directory', |
|
| 59 | - 'g', |
|
| 60 | - InputOption::VALUE_OPTIONAL, |
|
| 61 | - 'Path to your .git directory' |
|
| 62 | - ) |
|
| 63 | - ->addOption( |
|
| 64 | - 'vendor-directory', |
|
| 65 | - null, |
|
| 66 | - InputOption::VALUE_OPTIONAL, |
|
| 67 | - 'Path to composers vendor directory' |
|
| 68 | - ) |
|
| 69 | - ->addOption( |
|
| 70 | - 'run-mode', |
|
| 71 | - 'm', |
|
| 72 | - InputOption::VALUE_OPTIONAL, |
|
| 73 | - 'Git hook run mode [local|docker]' |
|
| 74 | - ) |
|
| 75 | - ->addOption( |
|
| 76 | - 'run-exec', |
|
| 77 | - 'e', |
|
| 78 | - InputOption::VALUE_OPTIONAL, |
|
| 79 | - 'The Docker command to start your container e.g. \'docker exec CONTAINER\'' |
|
| 80 | - ); |
|
| 41 | + ->setDescription('Install git hooks') |
|
| 42 | + ->setHelp('This command will install the git hooks to your .git directory') |
|
| 43 | + ->addArgument('hook', InputArgument::OPTIONAL, 'Hook you want to install') |
|
| 44 | + ->addOption( |
|
| 45 | + 'configuration', |
|
| 46 | + 'c', |
|
| 47 | + InputOption::VALUE_OPTIONAL, |
|
| 48 | + 'Path to your json configuration', |
|
| 49 | + getcwd() . DIRECTORY_SEPARATOR . CH::CONFIG |
|
| 50 | + ) |
|
| 51 | + ->addOption( |
|
| 52 | + 'force', |
|
| 53 | + 'f', |
|
| 54 | + InputOption::VALUE_NONE, |
|
| 55 | + 'Force to overwrite existing hooks' |
|
| 56 | + ) |
|
| 57 | + ->addOption( |
|
| 58 | + 'git-directory', |
|
| 59 | + 'g', |
|
| 60 | + InputOption::VALUE_OPTIONAL, |
|
| 61 | + 'Path to your .git directory' |
|
| 62 | + ) |
|
| 63 | + ->addOption( |
|
| 64 | + 'vendor-directory', |
|
| 65 | + null, |
|
| 66 | + InputOption::VALUE_OPTIONAL, |
|
| 67 | + 'Path to composers vendor directory' |
|
| 68 | + ) |
|
| 69 | + ->addOption( |
|
| 70 | + 'run-mode', |
|
| 71 | + 'm', |
|
| 72 | + InputOption::VALUE_OPTIONAL, |
|
| 73 | + 'Git hook run mode [local|docker]' |
|
| 74 | + ) |
|
| 75 | + ->addOption( |
|
| 76 | + 'run-exec', |
|
| 77 | + 'e', |
|
| 78 | + InputOption::VALUE_OPTIONAL, |
|
| 79 | + 'The Docker command to start your container e.g. \'docker exec CONTAINER\'' |
|
| 80 | + ); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | /** |
@@ -106,9 +106,9 @@ discard block |
||
| 106 | 106 | |
| 107 | 107 | $installer = new Installer($io, $config, $repo); |
| 108 | 108 | $installer->setForce(IOUtil::argToBool($input->getOption('force'))) |
| 109 | - ->setHook(IOUtil::argToString($input->getArgument('hook'))) |
|
| 110 | - ->setTemplate(Template\Builder::build($config, $repo)) |
|
| 111 | - ->run(); |
|
| 109 | + ->setHook(IOUtil::argToString($input->getArgument('hook'))) |
|
| 110 | + ->setTemplate(Template\Builder::build($config, $repo)) |
|
| 111 | + ->run(); |
|
| 112 | 112 | |
| 113 | 113 | return 0; |
| 114 | 114 | } |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | * |
| 39 | 39 | * @var string |
| 40 | 40 | */ |
| 41 | - protected $hookToExecute = ''; |
|
| 41 | + protected $hookToExecute = ''; |
|
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | 44 | * Repository path setter |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | ); |
| 80 | 80 | |
| 81 | 81 | if (IOUtil::answerToBool($answer)) { |
| 82 | - $call = '\\CaptainHook\\App\\Hook\\PHP\\Action\\Linting'; |
|
| 82 | + $call = '\\CaptainHook\\App\\Hook\\PHP\\Action\\Linting'; |
|
| 83 | 83 | $config->addAction(new Config\Action($call)); |
| 84 | 84 | } |
| 85 | 85 | } |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | ); |
| 123 | 123 | |
| 124 | 124 | if (IOUtil::answerToBool($answer)) { |
| 125 | - $call = $this->io->ask( |
|
| 125 | + $call = $this->io->ask( |
|
| 126 | 126 | ' <info>Enter the phpcs command you want to execute.</info> ' |
| 127 | 127 | . '<comment>[phpcs --standard=psr2 src]</comment> ', |
| 128 | 128 | 'phpcs --standard=psr2 src' |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | } |
| 76 | 76 | ob_start(); |
| 77 | 77 | $class::$method(); |
| 78 | - return (string)ob_get_clean(); |
|
| 78 | + return (string) ob_get_clean(); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | /** |
@@ -104,6 +104,6 @@ discard block |
||
| 104 | 104 | */ |
| 105 | 105 | protected function isStaticMethodCall(string $class) : bool |
| 106 | 106 | { |
| 107 | - return (bool)preg_match('#^\\\\.+::.+$#i', $class); |
|
| 107 | + return (bool) preg_match('#^\\\\.+::.+$#i', $class); |
|
| 108 | 108 | } |
| 109 | 109 | } |
@@ -65,9 +65,9 @@ |
||
| 65 | 65 | public function beforeHook() : void |
| 66 | 66 | { |
| 67 | 67 | $this->commentChar = $this->repository->getConfigOperator()->getSafely('core.commentchar', '#'); |
| 68 | - $this->file = (string)$this->io->getArgument('file'); |
|
| 69 | - $this->mode = (string)$this->io->getArgument('mode'); |
|
| 70 | - $this->hash = (string)$this->io->getArgument('hash'); |
|
| 68 | + $this->file = (string) $this->io->getArgument('file'); |
|
| 69 | + $this->mode = (string) $this->io->getArgument('mode'); |
|
| 70 | + $this->hash = (string) $this->io->getArgument('hash'); |
|
| 71 | 71 | |
| 72 | 72 | if (empty($this->file)) { |
| 73 | 73 | throw new \RuntimeException('commit message file argument is missing'); |
@@ -80,7 +80,7 @@ |
||
| 80 | 80 | 'CAPTAINHOOK FOUND ' . $err . ' PROBLEM' . ($err === 1 ? '' : 'S') . ' IN YOUR COMMIT MESSAGE', |
| 81 | 81 | IOUtil::getLineSeparator(80, '-') |
| 82 | 82 | ]; |
| 83 | - $msg = OutputUtil::trimEmptyLines($repository->getCommitMsg()->getLines()); |
|
| 83 | + $msg = OutputUtil::trimEmptyLines($repository->getCommitMsg()->getLines()); |
|
| 84 | 84 | |
| 85 | 85 | $lines = [IOUtil::getLineSeparator(80, '-')]; |
| 86 | 86 | foreach ($problems as $problem) { |