Skip to content

Commit 8e43404

Browse files
NGSTACK-938 improve check prettier action output
1 parent 5a28d30 commit 8e43404

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/Action/CheckPrettier.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,17 @@ protected function doExecute(Config $config, IO $io, Repository $repository, Act
3232
$finder->in($directories)->files()->name(preg_filter('/^/', '*.', $extensions));
3333

3434
if ($finder->hasResults()) {
35-
$io->write(sprintf('Running %s on files:', $prettierCommand), true, IO::VERBOSE);
35+
$io->write(sprintf('Running %s on files:', $prettierCommand));
3636

3737
foreach ($finder as $file) {
38-
if ($this->shouldSkipFileCheck($file, $excludedFiles)) {
38+
if ($this->shouldSkipFileCheck($file->getPath(), $excludedFiles)) {
3939
continue;
4040
}
4141

4242
$result = $this->checkPrettier($file->getPath(), $prettierCommand, $formatOptions);
43-
$io->write($result['output']);
43+
44+
$io->write(sprintf('<info>%s: </info>', $file->getPath()));
45+
$result['success'] ? $io->write($result['output']) : $io->writeError(sprintf('<error>%s</error>', $result['error']));
4446

4547
if ($result['success'] !== true) {
4648
$this->throwError($action, $io);
@@ -82,6 +84,7 @@ protected function checkPrettier(string $file, string $prettierCommand, string $
8284
return [
8385
'success' => $result->isSuccessful(),
8486
'output' => $result->getStdOut(),
87+
'error' => $result->getStdErr(),
8588
];
8689
}
8790
}

0 commit comments

Comments
 (0)