Passed
Pull Request — master (#103)
by Sebastian
02:29
created
src/Console/Command/Configuration.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -37,17 +37,17 @@  discard block
 block discarded – undo
37 37
     {
38 38
         parent::configure();
39 39
         $this->setName('configure')
40
-             ->setDescription('Configure your hooks')
41
-             ->setHelp('This command creates or updates your captainhook configuration')
42
-             ->addOption('extend', 'e', InputOption::VALUE_NONE, 'Extend existing configuration file')
43
-             ->addOption('force', 'f', InputOption::VALUE_NONE, 'Overwrite existing configuration file')
44
-             ->addOption('advanced', 'a', InputOption::VALUE_NONE, 'More options, but more to type')
45
-             ->addOption(
46
-                 'bootstrap',
47
-                 null,
48
-                 InputOption::VALUE_OPTIONAL,
49
-                 'Path to composers vendor/autoload.php'
50
-             );
40
+                ->setDescription('Configure your hooks')
41
+                ->setHelp('This command creates or updates your captainhook configuration')
42
+                ->addOption('extend', 'e', InputOption::VALUE_NONE, 'Extend existing configuration file')
43
+                ->addOption('force', 'f', InputOption::VALUE_NONE, 'Overwrite existing configuration file')
44
+                ->addOption('advanced', 'a', InputOption::VALUE_NONE, 'More options, but more to type')
45
+                ->addOption(
46
+                    'bootstrap',
47
+                    null,
48
+                    InputOption::VALUE_OPTIONAL,
49
+                    'Path to composers vendor/autoload.php'
50
+                );
51 51
     }
52 52
 
53 53
     /**
@@ -65,10 +65,10 @@  discard block
 block discarded – undo
65 65
 
66 66
         $configurator = new Creator($io, $config);
67 67
         $configurator->force(IOUtil::argToBool($input->getOption('force')))
68
-                     ->extend(IOUtil::argToBool($input->getOption('extend')))
69
-                     ->advanced(IOUtil::argToBool($input->getOption('advanced')))
70
-                     ->setExecutable($this->resolver->getExecutable())
71
-                     ->run();
68
+                        ->extend(IOUtil::argToBool($input->getOption('extend')))
69
+                        ->advanced(IOUtil::argToBool($input->getOption('advanced')))
70
+                        ->setExecutable($this->resolver->getExecutable())
71
+                        ->run();
72 72
         return 0;
73 73
     }
74 74
 }
Please login to merge, or discard this patch.
tests/CaptainHook/Console/ApplicationTest.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
     {
27 27
         $input = new ArrayInput(['--version' => true]);
28 28
         $output = $this->getMockBuilder(NullOutput::class)
29
-                       ->disableOriginalConstructor()
30
-                       ->getMock();
29
+                        ->disableOriginalConstructor()
30
+                        ->getMock();
31 31
 
32 32
         $output->expects($this->once())->method('writeLn');
33 33
 
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
     {
47 47
         $input = new ArrayInput(['command' => 'list']);
48 48
         $output = $this->getMockBuilder(NullOutput::class)
49
-                       ->disableOriginalConstructor()
50
-                       ->getMock();
49
+                        ->disableOriginalConstructor()
50
+                        ->getMock();
51 51
 
52 52
         $output->expects($this->atLeastOnce())->method('write');
53 53
 
Please login to merge, or discard this patch.
tests/CaptainHook/Runner/InstallerTest.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -119,9 +119,9 @@  discard block
 block discarded – undo
119 119
         $template = $this->createTemplateMock();
120 120
 
121 121
         $template->expects($this->once())
122
-                 ->method('getCode')
123
-                 ->with('pre-commit')
124
-                 ->willReturn('');
122
+                    ->method('getCode')
123
+                    ->with('pre-commit')
124
+                    ->willReturn('');
125 125
 
126 126
         $runner = new Installer($io, $config, $repo, $template);
127 127
         $runner->setHook('pre-commit');
@@ -156,14 +156,14 @@  discard block
 block discarded – undo
156 156
         $repo     = new Repository($fakeRepo->getRoot());
157 157
 
158 158
         $template->expects($this->once())
159
-                 ->method('getCode')
160
-                 ->with('pre-commit')
161
-                 ->willReturn('');
159
+                    ->method('getCode')
160
+                    ->with('pre-commit')
161
+                    ->willReturn('');
162 162
 
163 163
         $runner = new Installer($io, $config, $repo, $template);
164 164
         $runner->setHook('pre-commit')
165
-               ->setMoveExistingTo('foo/bar/')
166
-               ->run();
165
+                ->setMoveExistingTo('foo/bar/')
166
+                ->run();
167 167
 
168 168
         $this->assertFileExists($fakeRepo->getHookDir() . '/pre-commit');
169 169
         $this->assertFileExists($fakeRepo->getRoot() . '/foo/bar/pre-commit');
@@ -194,14 +194,14 @@  discard block
 block discarded – undo
194 194
         $repo     = new Repository($fakeRepo->getRoot());
195 195
 
196 196
         $template->expects($this->once())
197
-                 ->method('getCode')
198
-                 ->with('pre-commit')
199
-                 ->willReturn('');
197
+                    ->method('getCode')
198
+                    ->with('pre-commit')
199
+                    ->willReturn('');
200 200
 
201 201
         $runner = new Installer($io, $config, $repo, $template);
202 202
         $runner->setHook('pre-commit')
203
-               ->setMoveExistingTo('foo/bar/')
204
-               ->run();
203
+                ->setMoveExistingTo('foo/bar/')
204
+                ->run();
205 205
 
206 206
         $this->assertFileExists($fakeRepo->getHookDir() . '/pre-commit');
207 207
     }
@@ -235,8 +235,8 @@  discard block
 block discarded – undo
235 235
 
236 236
         $runner = new Installer($io, $config, $repo, $template);
237 237
         $runner->setHook('pre-commit')
238
-               ->setMoveExistingTo('foo')
239
-               ->run();
238
+                ->setMoveExistingTo('foo')
239
+                ->run();
240 240
     }
241 241
 
242 242
     /**
Please login to merge, or discard this patch.
src/Console/Command/Install.php 1 patch
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -41,55 +41,55 @@  discard block
 block discarded – undo
41 41
     {
42 42
         parent::configure();
43 43
         $this->setName('install')
44
-             ->setDescription('Install git hooks')
45
-             ->setHelp('This command will install the git hooks to your .git directory')
46
-             ->addArgument(
47
-                 'hook',
48
-                 InputArgument::OPTIONAL,
49
-                 'Limit the hook you want to install. By default all hooks get installed.'
50
-             )
51
-             ->addOption(
52
-                 'force',
53
-                 'f',
54
-                 InputOption::VALUE_NONE,
55
-                 'Force install without confirmation'
56
-             )
57
-             ->addOption(
58
-                 'skip-existing',
59
-                 's',
60
-                 InputOption::VALUE_NONE,
61
-                 'Do not overwrite existing hooks'
62
-             )
63
-             ->addOption(
64
-                 'move-existing-to',
65
-                 null,
66
-                 InputOption::VALUE_OPTIONAL,
67
-                 'Move existing hooks to given directory'
68
-             )
69
-             ->addOption(
70
-                 'bootstrap',
71
-                 'b',
72
-                 InputOption::VALUE_OPTIONAL,
73
-                 'Path to composers vendor/autoload.php'
74
-             )
75
-             ->addOption(
76
-                 'run-mode',
77
-                 'm',
78
-                 InputOption::VALUE_OPTIONAL,
79
-                 'Git hook run mode [php|shell|docker]'
80
-             )
81
-             ->addOption(
82
-                 'run-exec',
83
-                 'e',
84
-                 InputOption::VALUE_OPTIONAL,
85
-                 'The Docker command to start your container e.g. \'docker exec CONTAINER\''
86
-             )
87
-             ->addOption(
88
-                 'run-path',
89
-                 'p',
90
-                 InputOption::VALUE_OPTIONAL,
91
-                 'The path to the CaptainHook executable \'/usr/bin/captainhook\''
92
-             );
44
+                ->setDescription('Install git hooks')
45
+                ->setHelp('This command will install the git hooks to your .git directory')
46
+                ->addArgument(
47
+                    'hook',
48
+                    InputArgument::OPTIONAL,
49
+                    'Limit the hook you want to install. By default all hooks get installed.'
50
+                )
51
+                ->addOption(
52
+                    'force',
53
+                    'f',
54
+                    InputOption::VALUE_NONE,
55
+                    'Force install without confirmation'
56
+                )
57
+                ->addOption(
58
+                    'skip-existing',
59
+                    's',
60
+                    InputOption::VALUE_NONE,
61
+                    'Do not overwrite existing hooks'
62
+                )
63
+                ->addOption(
64
+                    'move-existing-to',
65
+                    null,
66
+                    InputOption::VALUE_OPTIONAL,
67
+                    'Move existing hooks to given directory'
68
+                )
69
+                ->addOption(
70
+                    'bootstrap',
71
+                    'b',
72
+                    InputOption::VALUE_OPTIONAL,
73
+                    'Path to composers vendor/autoload.php'
74
+                )
75
+                ->addOption(
76
+                    'run-mode',
77
+                    'm',
78
+                    InputOption::VALUE_OPTIONAL,
79
+                    'Git hook run mode [php|shell|docker]'
80
+                )
81
+                ->addOption(
82
+                    'run-exec',
83
+                    'e',
84
+                    InputOption::VALUE_OPTIONAL,
85
+                    'The Docker command to start your container e.g. \'docker exec CONTAINER\''
86
+                )
87
+                ->addOption(
88
+                    'run-path',
89
+                    'p',
90
+                    InputOption::VALUE_OPTIONAL,
91
+                    'The path to the CaptainHook executable \'/usr/bin/captainhook\''
92
+                );
93 93
     }
94 94
 
95 95
     /**
@@ -115,10 +115,10 @@  discard block
 block discarded – undo
115 115
         $template  = Template\Builder::build($config, $repo, $this->resolver);
116 116
         $installer = new Installer($io, $config, $repo, $template);
117 117
         $installer->setForce(IOUtil::argToBool($input->getOption('force')))
118
-                  ->setSkipExisting(IOUtil::argToBool($input->getOption('skip-existing')))
119
-                  ->setMoveExistingTo(IOUtil::argToString($input->getOption('move-existing-to')))
120
-                  ->setHook(IOUtil::argToString($input->getArgument('hook')))
121
-                  ->run();
118
+                    ->setSkipExisting(IOUtil::argToBool($input->getOption('skip-existing')))
119
+                    ->setMoveExistingTo(IOUtil::argToString($input->getOption('move-existing-to')))
120
+                    ->setHook(IOUtil::argToString($input->getArgument('hook')))
121
+                    ->run();
122 122
 
123 123
         return 0;
124 124
     }
Please login to merge, or discard this patch.
tests/CaptainHook/Runner/Hook/PostRewriteTest.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 
49 49
         // the config wll return the actually called config and then the virtual hook config
50 50
         $config->expects($this->exactly(2))
51
-               ->method('getHookConfig')
52
-               ->willReturnOnConsecutiveCalls($hookConfig, $vHookConfig);
51
+                ->method('getHookConfig')
52
+                ->willReturnOnConsecutiveCalls($hookConfig, $vHookConfig);
53 53
 
54 54
         $io->expects($this->atLeast(1))->method('write');
55 55
 
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
 
82 82
         // the config wll return the actually called config and then the virtual hook config
83 83
         $config->expects($this->exactly(2))
84
-               ->method('getHookConfig')
85
-               ->willReturnOnConsecutiveCalls($hookConfig, $vHookConfig);
84
+                ->method('getHookConfig')
85
+                ->willReturnOnConsecutiveCalls($hookConfig, $vHookConfig);
86 86
 
87 87
         $io->expects($this->atLeast(1))->method('write');
88 88
 
Please login to merge, or discard this patch.
tests/CaptainHook/Runner/Hook/PreCommitTest.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
 
77 77
         // every action has to get executed
78 78
         $actionConfigFail->expects($this->atLeastOnce())
79
-                         ->method('getAction')
80
-                         ->willReturn(CH_PATH_FILES . '/bin/failure');
79
+                            ->method('getAction')
80
+                            ->willReturn(CH_PATH_FILES . '/bin/failure');
81 81
 
82 82
         // so even if the first actions fails this action has to get executed
83 83
         $actionConfigSuccess->expects($this->atLeastOnce())
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
 
87 87
         $hookConfig->expects($this->once())->method('isEnabled')->willReturn(true);
88 88
         $hookConfig->expects($this->once())
89
-                   ->method('getActions')
90
-                   ->willReturn([$actionConfigFail, $actionConfigSuccess]);
89
+                    ->method('getActions')
90
+                    ->willReturn([$actionConfigFail, $actionConfigSuccess]);
91 91
 
92 92
         $config->expects($this->once())->method('getHookConfig')->willReturn($hookConfig);
93 93
         $io->expects($this->atLeast(1))->method('write');
Please login to merge, or discard this patch.
tests/CaptainHook/Mockery.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
     public function createResolverMock(string $executable = 'vendor/bin/captainhook', bool $isPhar = false): Resolver
30 30
     {
31 31
         $repo = $this->getMockBuilder(Resolver::class)
32
-                     ->disableOriginalConstructor()
33
-                     ->getMock();
32
+                        ->disableOriginalConstructor()
33
+                        ->getMock();
34 34
 
35 35
         $repo->method('getExecutable')->willReturn($executable);
36 36
         $repo->method('isPharRelease')->willReturn($isPhar);
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
     public function createRepositoryMock(string $root = ''): Repository
48 48
     {
49 49
         $repo = $this->getMockBuilder(Repository::class)
50
-                     ->disableOriginalConstructor()
51
-                     ->getMock();
50
+                        ->disableOriginalConstructor()
51
+                        ->getMock();
52 52
 
53 53
         $repo->method('getRoot')->willReturn($root);
54 54
         $repo->method('getHooksDir')->willReturn($root . '/.git/hooks');
@@ -66,8 +66,8 @@  discard block
 block discarded – undo
66 66
     public function createGitInfoOperator(string $tag = 'v1.0.0', string $branch = 'master'): Info
67 67
     {
68 68
         $operator = $this->getMockBuilder(Info::class)
69
-                         ->disableOriginalConstructor()
70
-                         ->getMock();
69
+                            ->disableOriginalConstructor()
70
+                            ->getMock();
71 71
 
72 72
         $operator->method('getCurrentTag')->willReturn($tag);
73 73
         $operator->method('getCurrentBranch')->willReturn($branch);
@@ -84,8 +84,8 @@  discard block
 block discarded – undo
84 84
     public function createGitDiffOperator(array $changedFiles = []): Diff
85 85
     {
86 86
         $operator = $this->getMockBuilder(Diff::class)
87
-                         ->disableOriginalConstructor()
88
-                         ->getMock();
87
+                            ->disableOriginalConstructor()
88
+                            ->getMock();
89 89
 
90 90
         $operator->method('getChangedFiles')->willReturn($changedFiles);
91 91
 
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
     public function createGitIndexOperator(array $stagedFiles = []): Index
102 102
     {
103 103
         $operator = $this->getMockBuilder(Index::class)
104
-                         ->disableOriginalConstructor()
105
-                         ->getMock();
104
+                            ->disableOriginalConstructor()
105
+                            ->getMock();
106 106
 
107 107
         $operator->method('getStagedFiles')->willReturn($stagedFiles);
108 108
 
Please login to merge, or discard this patch.
src/Console/Command/Hook.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
     {
47 47
         parent::configure();
48 48
         $this->setName('hook:' . $this->hookName)
49
-             ->setDescription('Run git ' . $this->hookName . ' hook.')
50
-             ->setHelp('This command executes the ' . $this->hookName . ' hook.');
49
+                ->setDescription('Run git ' . $this->hookName . ' hook.')
50
+                ->setHelp('This command executes the ' . $this->hookName . ' hook.');
51 51
 
52 52
         $this->addOption(
53 53
             'bootstrap',
@@ -120,10 +120,10 @@  discard block
 block discarded – undo
120 120
     private function handleError(OutputInterface $output, Exception $e): int
121 121
     {
122 122
         $error = IOUtil::$tplError
123
-               . PHP_EOL . IOUtil::getLineSeparator() . PHP_EOL
124
-               . IOUtil::formatHeadline(get_class($e), 80, '>', '<') . PHP_EOL
125
-               . IOUtil::getLineSeparator() . PHP_EOL
126
-               . $e->getMessage()  . PHP_EOL;
123
+                . PHP_EOL . IOUtil::getLineSeparator() . PHP_EOL
124
+                . IOUtil::formatHeadline(get_class($e), 80, '>', '<') . PHP_EOL
125
+                . IOUtil::getLineSeparator() . PHP_EOL
126
+                . $e->getMessage()  . PHP_EOL;
127 127
 
128 128
         $output->writeLn($error);
129 129
 
Please login to merge, or discard this patch.