Skip to content

Commit

Permalink
Fixed pint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
cradu committed Apr 15, 2024
1 parent 9815219 commit da5ce9f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
11 changes: 6 additions & 5 deletions src/Console/Commands/Hooks/BaseCodeAnalyzerPreCommitHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ protected function analizeCommittedFiles($commitFiles)
$command = $this->dockerCommand($this->analyzerCommand().' '.$filePath);

$params = [
'show-output' => config('git-hooks.debug_output')
'show-output' => config('git-hooks.debug_output'),
];

$process = $this->runCommands($command, $params);
Expand All @@ -151,7 +151,7 @@ protected function analizeCommittedFiles($commitFiles)
);
$this->filesBadlyFormattedPaths[] = $filePath;

if (config('git-hooks.output_errors') && !config('git-hooks.debug_commands')) {
if (config('git-hooks.output_errors') && ! config('git-hooks.debug_commands')) {
$this->command->newLine();
$this->command->getOutput()->write($process->getOutput());
}
Expand Down Expand Up @@ -288,7 +288,7 @@ protected function suggestAutoFixOrExit(): bool
private function autoFixFiles(): bool
{
$params = [
'show-output' => config('git-hooks.debug_output')
'show-output' => config('git-hooks.debug_output'),
];

foreach ($this->filesBadlyFormattedPaths as $key => $filePath) {
Expand Down Expand Up @@ -323,7 +323,7 @@ private function autoFixFiles(): bool
sprintf('<fg=red> %s Autofix Failed:</> %s', $this->getName(), $filePath)
);

if (config('git-hooks.output_errors') && !config('git-hooks.debug_commands')) {
if (config('git-hooks.output_errors') && ! config('git-hooks.debug_commands')) {
$this->command->newLine();
$this->command->getOutput()->write($process->getOutput());
}
Expand All @@ -337,9 +337,10 @@ private function autoFixFiles(): bool
*/
public function getOutput(): ?OutputStyle
{
if (!config('git-hooks.debug_output')) {
if (! config('git-hooks.debug_output')) {
return null;
}

return $this->command->getOutput();
}

Expand Down
2 changes: 1 addition & 1 deletion src/Console/Commands/PreCommit.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Igorsgm\GitHooks\Facades\GitHooks;
use Igorsgm\GitHooks\Git\ChangedFiles;
use Igorsgm\GitHooks\Traits\WithPipeline;
use \Igorsgm\GitHooks\Traits\WithPipelineFailCheck;
use Igorsgm\GitHooks\Traits\WithPipelineFailCheck;
use Illuminate\Console\Command;

class PreCommit extends Command implements HookCommand
Expand Down
6 changes: 4 additions & 2 deletions src/Traits/WithPipelineFailCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ protected function markPipelineFailed(): void
protected function checkPipelineFailed(): bool
{
$tmpFile = $this->getPipelineFailedTempFile();

return file_exists($tmpFile);
}

Expand All @@ -28,10 +29,11 @@ protected function clearPipelineFailed(): void
unlink($tmpFile);
}
}

protected function getPipelineFailedTempFile(): string
{
$tmpFile = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'githooks-pipeline-fail-' . getmypid();
$tmpFile = sys_get_temp_dir().DIRECTORY_SEPARATOR.'githooks-pipeline-fail-'.getmypid();

return $tmpFile;
}
}

0 comments on commit da5ce9f

Please # to comment.