Passed
Pull Request — main (#241)
by
unknown
03:48
created
tests/unit/Runner/Hook/PreCommitTest.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
 
79 79
         // every action has to get executed
80 80
         $actionConfigFail->expects($this->atLeastOnce())
81
-                         ->method('getAction')
82
-                         ->willReturn(CH_PATH_FILES . '/bin/failure');
81
+                            ->method('getAction')
82
+                            ->willReturn(CH_PATH_FILES . '/bin/failure');
83 83
 
84 84
         // so even if the first actions fails this action has to get executed
85 85
         $actionConfigSuccess->expects($this->atLeastOnce())
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
 
89 89
         $hookConfig->method('isEnabled')->willReturn(true);
90 90
         $hookConfig->expects($this->once())
91
-                   ->method('getActions')
92
-                   ->willReturn([$actionConfigFail, $actionConfigSuccess]);
91
+                    ->method('getActions')
92
+                    ->willReturn([$actionConfigFail, $actionConfigSuccess]);
93 93
 
94 94
         $config->expects($this->once())->method('getHookConfigToExecute')->willReturn($hookConfig);
95 95
         $config->method('isHookEnabled')->willReturn(true);
@@ -125,8 +125,8 @@  discard block
 block discarded – undo
125 125
 
126 126
         $hookConfig->method('isEnabled')->willReturn(true);
127 127
         $hookConfig->expects($this->once())
128
-                   ->method('getActions')
129
-                   ->willReturn([$actionConfigFail, $actionConfigSuccess]);
128
+                    ->method('getActions')
129
+                    ->willReturn([$actionConfigFail, $actionConfigSuccess]);
130 130
 
131 131
         $config->expects($this->once())->method('getHookConfigToExecute')->willReturn($hookConfig);
132 132
         $config->expects($this->atLeastOnce())->method('isHookEnabled')->willReturn(true);
Please login to merge, or discard this patch.
src/Git/ChangedFiles/Detector/Factory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
         $command = $io->getArgument(Hooks::ARG_COMMAND);
51 51
 
52 52
         /** @var \CaptainHook\App\Git\ChangedFiles\Detecting $class */
53
-        $class    = self::$detectors[$command] ?? '\\CaptainHook\\App\\Git\\ChangedFiles\\Detector\\Fallback';
53
+        $class = self::$detectors[$command] ?? '\\CaptainHook\\App\\Git\\ChangedFiles\\Detector\\Fallback';
54 54
         return new $class($io, $repository);
55 55
     }
56 56
 }
Please login to merge, or discard this patch.
tests/unit/Hook/Condition/FileChanged/OfTypeTest.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -45,13 +45,13 @@
 block discarded – undo
45 45
         $io = $this->createIOMock();
46 46
         $io->method('getArgument')->willReturn('hook:pre-push');
47 47
         $io->expects($this->atLeastOnce())
48
-           ->method('getStandardInput')
49
-           ->willReturn(
50
-               [
51
-                   'refs/heads/main 9dfa0fa6221d75f48b2dfac359127324bedf8409' .
52
-                   ' refs/heads/main 8309f6e16097754469c485e604900c573bf2c5d8'
53
-               ]
54
-           );
48
+            ->method('getStandardInput')
49
+            ->willReturn(
50
+                [
51
+                    'refs/heads/main 9dfa0fa6221d75f48b2dfac359127324bedf8409' .
52
+                    ' refs/heads/main 8309f6e16097754469c485e604900c573bf2c5d8'
53
+                ]
54
+            );
55 55
         $operator   = $this->createGitDiffOperator(['fiz.php', 'foo.txt']);
56 56
         $repository = $this->createRepositoryMock('');
57 57
         $repository->expects($this->once())->method('getDiffOperator')->willReturn($operator);
Please login to merge, or discard this patch.
tests/unit/Runner/Action/Cli/Command/Placeholder/BranchFilesTest.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
             ->method('getBranchRevFromRefLog')
49 49
             ->willReturn('main');
50 50
         $info->expects($this->once())
51
-             ->method('getCurrentBranch')
52
-             ->willReturn('foo');
51
+                ->method('getCurrentBranch')
52
+                ->willReturn('foo');
53 53
 
54 54
         $repo->expects($this->atLeastOnce())->method('getLogOperator')->willReturn($log);
55 55
         $repo->expects($this->atLeastOnce())->method('getInfoOperator')->willReturn($info);
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
             ->method('getChangedFilesSince')
103 103
             ->willReturn(['file1.php', 'file2.php', 'README.md', 'foo.txt']);
104 104
         $info->expects($this->once())
105
-             ->method('getCurrentBranch')
106
-             ->willReturn('foo');
105
+                ->method('getCurrentBranch')
106
+                ->willReturn('foo');
107 107
 
108 108
         $repo->expects($this->atLeastOnce())->method('getLogOperator')->willReturn($log);
109 109
         $repo->expects($this->atLeastOnce())->method('getInfoOperator')->willReturn($info);
@@ -129,8 +129,8 @@  discard block
 block discarded – undo
129 129
             ->method('getChangedFilesSince')
130 130
             ->willReturn(['foo/file1.php', 'foo/file2.php', 'README.md']);
131 131
         $info->expects($this->once())
132
-             ->method('getCurrentBranch')
133
-             ->willReturn('foo');
132
+                ->method('getCurrentBranch')
133
+                ->willReturn('foo');
134 134
 
135 135
         $repo->expects($this->atLeastOnce())->method('getLogOperator')->willReturn($log);
136 136
         $repo->expects($this->atLeastOnce())->method('getInfoOperator')->willReturn($info);
Please login to merge, or discard this patch.
src/Hook/Template/Local/PHP.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@
 block discarded – undo
110 110
 
111 111
         $executableInclude = substr($executablePath, 0, 1) == '/'
112 112
                            ? '\'' . $executablePath . '\''
113
-                           : '__DIR__ . \'/../../' . $executablePath  . '\'';
113
+                           : '__DIR__ . \'/../../' . $executablePath . '\'';
114 114
         return array_merge(
115 115
             [
116 116
                 '#!/usr/bin/env php',
Please login to merge, or discard this patch.
src/Hook/Template/Inspector.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@
 block discarded – undo
81 81
                 '<fg=red>Warning: Hook script is out of date</>',
82 82
                 'The git hook script needs to be updated.',
83 83
                 'Required version is <info>' . CH::MIN_REQ_INSTALLER . '</info>'
84
-                  . ' found <fg=red>' . $installerVersion . '</>.',
84
+                    . ' found <fg=red>' . $installerVersion . '</>.',
85 85
                 'Please re-install your hook by running:',
86 86
                 '  <comment>captainhook install ' . $this->hook . '</comment>',
87 87
                 '',
Please login to merge, or discard this patch.
src/Hook/UserInput/EventHandler/AskConfirmation.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
      */
60 60
     public function handle(Event $event): void
61 61
     {
62
-        if (!IOUtil::answerToBool($event->io()->ask(PHP_EOL .  $this->question . ' ', $this->default ? 'y' : 'n'))) {
62
+        if (!IOUtil::answerToBool($event->io()->ask(PHP_EOL . $this->question . ' ', $this->default ? 'y' : 'n'))) {
63 63
             throw new ActionFailed('no confirmation, abort!');
64 64
         }
65 65
     }
Please login to merge, or discard this patch.
src/Runner/Installer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -228,7 +228,7 @@
 block discarded – undo
228 228
         // if hook is configured and no force option is set
229 229
         // ask the user if overwriting the hook is ok
230 230
         if ($this->needConfirmation($hook)) {
231
-            $ans  = $this->io->ask(
231
+            $ans = $this->io->ask(
232 232
                 'The <comment>' . $hook . '</comment> hook exists! Overwrite? <comment>[y,N]</comment> ',
233 233
                 'n'
234 234
             );
Please login to merge, or discard this patch.
src/Console/Command/Install.php 1 patch
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -41,64 +41,64 @@  discard block
 block discarded – undo
41 41
     {
42 42
         parent::configure();
43 43
         $this->setName('install')
44
-             ->setDescription('Install hooks to your .git/hooks directory')
45
-             ->setHelp('Install git hooks to your .git/hooks directory')
46
-             ->addArgument(
47
-                 'hook',
48
-                 InputArgument::OPTIONAL,
49
-                 'Limit the hooks you want to install. ' .
50
-                 'You can specify multiple hooks with comma as delimiter. ' .
51
-                 'By default all hooks get installed'
52
-             )
53
-             ->addOption(
54
-                 'only-enabled',
55
-                 null,
56
-                 InputOption::VALUE_NONE,
57
-                 'Limit the hooks you want to install to those enabled in your conf. ' .
58
-                 'By default all hooks get installed'
59
-             )
60
-             ->addOption(
61
-                 'force',
62
-                 'f',
63
-                 InputOption::VALUE_NONE,
64
-                 'Force install without confirmation'
65
-             )
66
-             ->addOption(
67
-                 'skip-existing',
68
-                 's',
69
-                 InputOption::VALUE_NONE,
70
-                 'Do not overwrite existing hooks'
71
-             )
72
-             ->addOption(
73
-                 'move-existing-to',
74
-                 null,
75
-                 InputOption::VALUE_OPTIONAL,
76
-                 'Move existing hooks to given directory'
77
-             )
78
-             ->addOption(
79
-                 'bootstrap',
80
-                 'b',
81
-                 InputOption::VALUE_OPTIONAL,
82
-                 'Path to composers vendor/autoload.php'
83
-             )
84
-             ->addOption(
85
-                 'run-mode',
86
-                 'm',
87
-                 InputOption::VALUE_OPTIONAL,
88
-                 'Git hook run mode [php|shell|docker]'
89
-             )
90
-             ->addOption(
91
-                 'run-exec',
92
-                 'e',
93
-                 InputOption::VALUE_OPTIONAL,
94
-                 'The Docker command to start your container e.g. \'docker exec CONTAINER\''
95
-             )
96
-             ->addOption(
97
-                 'run-path',
98
-                 'p',
99
-                 InputOption::VALUE_OPTIONAL,
100
-                 'The path to the CaptainHook executable \'/usr/bin/captainhook\''
101
-             );
44
+                ->setDescription('Install hooks to your .git/hooks directory')
45
+                ->setHelp('Install git hooks to your .git/hooks directory')
46
+                ->addArgument(
47
+                    'hook',
48
+                    InputArgument::OPTIONAL,
49
+                    'Limit the hooks you want to install. ' .
50
+                    'You can specify multiple hooks with comma as delimiter. ' .
51
+                    'By default all hooks get installed'
52
+                )
53
+                ->addOption(
54
+                    'only-enabled',
55
+                    null,
56
+                    InputOption::VALUE_NONE,
57
+                    'Limit the hooks you want to install to those enabled in your conf. ' .
58
+                    'By default all hooks get installed'
59
+                )
60
+                ->addOption(
61
+                    'force',
62
+                    'f',
63
+                    InputOption::VALUE_NONE,
64
+                    'Force install without confirmation'
65
+                )
66
+                ->addOption(
67
+                    'skip-existing',
68
+                    's',
69
+                    InputOption::VALUE_NONE,
70
+                    'Do not overwrite existing hooks'
71
+                )
72
+                ->addOption(
73
+                    'move-existing-to',
74
+                    null,
75
+                    InputOption::VALUE_OPTIONAL,
76
+                    'Move existing hooks to given directory'
77
+                )
78
+                ->addOption(
79
+                    'bootstrap',
80
+                    'b',
81
+                    InputOption::VALUE_OPTIONAL,
82
+                    'Path to composers vendor/autoload.php'
83
+                )
84
+                ->addOption(
85
+                    'run-mode',
86
+                    'm',
87
+                    InputOption::VALUE_OPTIONAL,
88
+                    'Git hook run mode [php|shell|docker]'
89
+                )
90
+                ->addOption(
91
+                    'run-exec',
92
+                    'e',
93
+                    InputOption::VALUE_OPTIONAL,
94
+                    'The Docker command to start your container e.g. \'docker exec CONTAINER\''
95
+                )
96
+                ->addOption(
97
+                    'run-path',
98
+                    'p',
99
+                    InputOption::VALUE_OPTIONAL,
100
+                    'The path to the CaptainHook executable \'/usr/bin/captainhook\''
101
+                );
102 102
     }
103 103
 
104 104
     /**
@@ -130,11 +130,11 @@  discard block
 block discarded – undo
130 130
         $template  = Template\Builder::build($config, $repo, $this->resolver);
131 131
         $installer = new Installer($io, $config, $repo, $template);
132 132
         $installer->setHook(IOUtil::argToString($input->getArgument('hook')))
133
-                  ->setForce(IOUtil::argToBool($input->getOption('force')))
134
-                  ->setSkipExisting(IOUtil::argToBool($input->getOption('skip-existing')))
135
-                  ->setMoveExistingTo(IOUtil::argToString($input->getOption('move-existing-to')))
136
-                  ->setOnlyEnabled(IOUtil::argToBool($input->getOption('only-enabled')))
137
-                  ->run();
133
+                    ->setForce(IOUtil::argToBool($input->getOption('force')))
134
+                    ->setSkipExisting(IOUtil::argToBool($input->getOption('skip-existing')))
135
+                    ->setMoveExistingTo(IOUtil::argToString($input->getOption('move-existing-to')))
136
+                    ->setOnlyEnabled(IOUtil::argToBool($input->getOption('only-enabled')))
137
+                    ->run();
138 138
 
139 139
         return 0;
140 140
     }
Please login to merge, or discard this patch.