@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | |
| 4 | 4 | namespace TheCodingMachine\WashingMachine\Clover; |
| 5 | 5 | |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | |
| 4 | 4 | namespace TheCodingMachine\WashingMachine\Clover; |
| 5 | 5 | |
@@ -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 |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | |
| 4 | 4 | namespace TheCodingMachine\WashingMachine\Clover; |
| 5 | 5 | |
@@ -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); |
@@ -1,7 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace TheCodingMachine\WashingMachine\Gitlab; |
| 3 | 3 | use Gitlab\Client; |
| 4 | -use GuzzleHttp\Psr7\Stream; |
|
| 5 | 4 | use GuzzleHttp\Psr7\StreamWrapper; |
| 6 | 5 | use Symfony\Component\Filesystem\Filesystem; |
| 7 | 6 | |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | * @param string $projectName |
| 72 | 72 | * @param string $commitId |
| 73 | 73 | * @param int $numIter |
| 74 | - * @return array |
|
| 74 | + * @return string |
|
| 75 | 75 | * @throws BuildNotFoundException |
| 76 | 76 | */ |
| 77 | 77 | public function getLatestPipelineFromCommitId(string $projectName, string $commitId, int $numIter = 0) : array |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | /** |
| 109 | 109 | * @param string $projectName |
| 110 | 110 | * @param string $branchName |
| 111 | - * @return array |
|
| 111 | + * @return string |
|
| 112 | 112 | * @throws BuildNotFoundException |
| 113 | 113 | */ |
| 114 | 114 | public function getLatestPipelineFromBranch(string $projectName, string $branchName) : array |
@@ -76,7 +76,7 @@ |
||
| 76 | 76 | return $this->pipelines[$projectName]; |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - public function findPipelineByCommit(string $projectName, string $commitId) : ?array |
|
| 79 | + public function findPipelineByCommit(string $projectName, string $commitId) : ? array |
|
| 80 | 80 | { |
| 81 | 81 | $pipelines = $this->getPipelines($projectName); |
| 82 | 82 | |
@@ -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 | } |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | |
| 265 | 265 | $commit = $project->commit($commitRef); |
| 266 | 266 | |
| 267 | - return $commit->committer ? $commit->committer->id : null; |
|
| 267 | + return $commit->committer ? $commit->committer->id : null; |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | /** |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | |
| 283 | 283 | $buildService->dumpArtifactFromBranch($projectName, $targetBranch, $buildName, $jobStage, $tmpFile); |
| 284 | 284 | $zipFile = new \ZipArchive(); |
| 285 | - if ($zipFile->open($tmpFile)!==true) { |
|
| 285 | + if ($zipFile->open($tmpFile) !== true) { |
|
| 286 | 286 | throw new \RuntimeException('Invalid ZIP archive '.$tmpFile); |
| 287 | 287 | } |
| 288 | 288 | return $this->getMeasuresFromZipFile($zipFile, $cloverPath, $crap4JPath); |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | $pipeline = $buildService->getLatestPipelineFromCommitId($projectName, $commitId); |
| 308 | 308 | $buildService->dumpArtifact($projectName, $pipeline['id'], $buildName, $jobStage, $tmpFile); |
| 309 | 309 | $zipFile = new \ZipArchive(); |
| 310 | - if ($zipFile->open($tmpFile)!==true) { |
|
| 310 | + if ($zipFile->open($tmpFile) !== true) { |
|
| 311 | 311 | throw new \RuntimeException('Invalid ZIP archive '.$tmpFile); |
| 312 | 312 | } |
| 313 | 313 | return $this->getMeasuresFromZipFile($zipFile, $cloverPath, $crap4JPath); |