@@ -60,7 +60,7 @@ |
||
60 | 60 | |
61 | 61 | // Now, let's order the differences by crap order. |
62 | 62 | usort($differences, function(Difference $d1, Difference $d2) { |
63 | - return $d2->getCrapScore() <=> $d1->getCrapScore(); |
|
63 | + return $d2->getCrapScore() <=> $d1->getCrapScore(); |
|
64 | 64 | }); |
65 | 65 | |
66 | 66 | // Now, let's limit the number of returned differences |
@@ -125,7 +125,7 @@ |
||
125 | 125 | $url = $this->getArtifactFileUrl($file->getFilename(), $gitlabUrl, $projectName, $buildId); |
126 | 126 | |
127 | 127 | $this->msg .= sprintf("\n<strong>[%s](%s)</strong>\n", $file->getFilename(), $url); |
128 | - $this->msg .= sprintf("```\n%s%s```\n", $text, $isComplete?'':"... (file truncated)\n"); |
|
128 | + $this->msg .= sprintf("```\n%s%s```\n", $text, $isComplete ? '' : "... (file truncated)\n"); |
|
129 | 129 | |
130 | 130 | if (!$isComplete) { |
131 | 131 | $this->msg .= sprintf("[Download complete file](%s)\n", $url); |
@@ -53,9 +53,9 @@ |
||
53 | 53 | throw new \RuntimeException('Could not find the Gitlab URL in the "CI_REPOSITORY_URL" environment variable (usually set by Gitlab CI). Either set this environment variable or pass the URL via the --gitlab-url command line option.'); |
54 | 54 | } |
55 | 55 | $parsed_url = parse_url($ciProjectUrl); |
56 | - $scheme = isset($parsed_url['scheme']) ? $parsed_url['scheme'] . '://' : ''; |
|
56 | + $scheme = isset($parsed_url['scheme']) ? $parsed_url['scheme'].'://' : ''; |
|
57 | 57 | $host = isset($parsed_url['host']) ? $parsed_url['host'] : ''; |
58 | - $port = isset($parsed_url['port']) ? ':' . $parsed_url['port'] : ''; |
|
58 | + $port = isset($parsed_url['port']) ? ':'.$parsed_url['port'] : ''; |
|
59 | 59 | $gitlabUrl = $scheme.$host.$port; |
60 | 60 | } |
61 | 61 | return rtrim($gitlabUrl, '/'); |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | public function getMergeBase(string $commit1, string $commit2) : string |
12 | 12 | { |
13 | 13 | try { |
14 | - $this->extractFromCommand('git merge-base --is-ancestor ' . escapeshellarg($commit1) . ' ' . escapeshellarg($commit2)); |
|
14 | + $this->extractFromCommand('git merge-base --is-ancestor '.escapeshellarg($commit1).' '.escapeshellarg($commit2)); |
|
15 | 15 | } catch (GitException $e) { |
16 | 16 | // The command will return exit code 1 if $commit1 is an ancestor of $commit2 |
17 | 17 | // Exit code one triggers an exception. We catch it. |
@@ -19,14 +19,14 @@ discard block |
||
19 | 19 | } |
20 | 20 | |
21 | 21 | |
22 | - $results = $this->extractFromCommand('git merge-base ' . escapeshellarg($commit1). ' '. escapeshellarg($commit2)); |
|
22 | + $results = $this->extractFromCommand('git merge-base '.escapeshellarg($commit1).' '.escapeshellarg($commit2)); |
|
23 | 23 | |
24 | 24 | return $results[0]; |
25 | 25 | } |
26 | 26 | |
27 | 27 | public function getLatestCommitForBranch(string $branch) : string |
28 | 28 | { |
29 | - $results = $this->extractFromCommand('git log -n 1 --pretty=format:"%H" ' . escapeshellarg($branch)); |
|
29 | + $results = $this->extractFromCommand('git log -n 1 --pretty=format:"%H" '.escapeshellarg($branch)); |
|
30 | 30 | |
31 | 31 | return $results[0]; |
32 | 32 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * @param string $commitId |
83 | 83 | * @param string|null $excludePipelineId A pipeline ID we want to exclude (we don't want to get the current pipeline ID). |
84 | 84 | * @param int $numIter |
85 | - * @return array |
|
85 | + * @return string |
|
86 | 86 | * @throws BuildNotFoundException |
87 | 87 | */ |
88 | 88 | public function getLatestPipelineFromCommitId(string $projectName, string $commitId, string $excludePipelineId = null, int $numIter = 0) : array |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * @param string $projectName |
117 | 117 | * @param string $branchName |
118 | 118 | * @param string $excludePipelineId A pipeline ID we want to exclude (we don't want to get the current pipeline ID). |
119 | - * @return array |
|
119 | + * @return string |
|
120 | 120 | * @throws BuildNotFoundException |
121 | 121 | */ |
122 | 122 | public function getLatestPipelineFromBranch(string $projectName, string $branchName, string $excludePipelineId) : array |
@@ -2,7 +2,6 @@ |
||
2 | 2 | namespace TheCodingMachine\WashingMachine\Gitlab; |
3 | 3 | use Gitlab\Client; |
4 | 4 | use Gitlab\ResultPager; |
5 | -use GuzzleHttp\Psr7\Stream; |
|
6 | 5 | use GuzzleHttp\Psr7\StreamWrapper; |
7 | 6 | use Psr\Log\LoggerInterface; |
8 | 7 | use Symfony\Component\Filesystem\Filesystem; |
@@ -183,7 +183,7 @@ |
||
183 | 183 | $jobItem['stage'] === $jobStage && |
184 | 184 | isset($jobItem['artifacts_file']) && |
185 | 185 | (in_array($jobItem['status'], ['failed', 'success'])) |
186 | - ) { |
|
186 | + ) { |
|
187 | 187 | $job = $jobItem; |
188 | 188 | break; |
189 | 189 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | if (!isset($this->pipelines[$projectName])) { |
81 | 81 | $pager = new ResultPager($this->client); |
82 | 82 | $this->pipelines[$projectName] = $pager->fetchAll($this->client->api('projects'), 'pipelines', |
83 | - [ $projectName ] |
|
83 | + [$projectName] |
|
84 | 84 | ); |
85 | 85 | } |
86 | 86 | return $this->pipelines[$projectName]; |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | if ($job === null) { |
193 | 193 | throw new BuildNotFoundException('Could not find finished job with build name "'.$buildName.'", stage "'.$jobStage.'" and artifacts file in pipeline "'.$pipelineId.'"'); |
194 | 194 | } |
195 | - $this->logger->debug('Found job '. $job['id'] . ' for pipeline ' . $pipelineId); |
|
195 | + $this->logger->debug('Found job '.$job['id'].' for pipeline '.$pipelineId); |
|
196 | 196 | |
197 | 197 | $artifactContent = $this->client->jobs->artifacts($projectName, $job['id']); |
198 | 198 |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | |
275 | 275 | $commit = $project->commit($commitRef); |
276 | 276 | |
277 | - return $commit->committer ? $commit->committer->id : null; |
|
277 | + return $commit->committer ? $commit->committer->id : null; |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | /** |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | |
294 | 294 | $buildService->dumpArtifactFromBranch($projectName, $targetBranch, $buildName, $jobStage, $tmpFile, $excludePipelineId); |
295 | 295 | $zipFile = new \ZipArchive(); |
296 | - if ($zipFile->open($tmpFile)!==true) { |
|
296 | + if ($zipFile->open($tmpFile) !== true) { |
|
297 | 297 | throw new \RuntimeException('Invalid ZIP archive '.$tmpFile); |
298 | 298 | } |
299 | 299 | return $this->getMeasuresFromZipFile($zipFile, $cloverPath, $crap4JPath); |