Skip to content

Commit

Permalink
feat: adds placeholder when peck detects no issues
Browse files Browse the repository at this point in the history
  • Loading branch information
nunomaduro committed Dec 27, 2024
1 parent 44c8ce5 commit 094d323
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,15 @@
"refacto": "rector",
"lint": "pint",
"test:refacto": "rector --dry-run",
"test:typos": "peck",
"test:lint": "pint --test",
"test:types": "phpstan analyse --ansi",
"test:unit": "pest --colors=always --coverage --parallel --min=100",
"test": [
"@test:refacto",
"@test:lint",
"@test:types",
"@test:types", // pypo (typo)
"@test:typos",
"@test:unit"
]
}
Expand Down
21 changes: 19 additions & 2 deletions src/Console/Commands/DefaultCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,28 @@ protected function execute(InputInterface $input, OutputInterface $output): int
'directory' => $directory = self::inferProjectPath(),
]);

$output->writeln('');

if (count($issues) === 0) {
renderUsing($output);
render(<<<HTML
<div class="mx-2 mb-1">
<div class="space-x-1">
<span class="bg-green text-white px-1 font-bold">PASS</span>
<span>No misspellings found in your project.</span>
</div>
</div>
HTML
);

return Command::SUCCESS;
}

foreach ($issues as $issue) {
$this->renderIssue($output, $issue, $directory);
}

return $issues !== [] ? Command::FAILURE : Command::SUCCESS;
return Command::FAILURE;
}

/**
Expand All @@ -61,7 +78,7 @@ protected function renderIssue(OutputInterface $output, Issue $issue, string $cu
<div class="mx-2 mb-1">
<div class="space-x-1">
<span class="bg-red text-white px-1 font-bold">ISSUE</span>
<span>Misspelling detected in <strong><a href="{$issue->file}">{$file}</a></strong>{$lineInfo}: '<strong>{$issue->misspelling->word}</strong>'</span>
<span>Misspelling in <strong><a href="{$issue->file}">{$file}</a></strong>{$lineInfo}: '<strong>{$issue->misspelling->word}</strong>'</span>
</div>
<div class="space-x-1 text-gray-700">
Expand Down

0 comments on commit 094d323

Please sign in to comment.