Skip to content

Commit

Permalink
Improve error reporting and streamline codebase
Browse files Browse the repository at this point in the history
Updated the error reporting in 'ValidateCsv' file to include the word 'Error' in red for clearer visibility. Also simplified the depth condition in the 'Utils' file and made the 'location' element more concise in 'ValidatorTest'. This makes the code cleaner, more readable and enhances the visibility of errors.
  • Loading branch information
Denis Smet committed Mar 12, 2024
1 parent ac6e5c5 commit 78ec043
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/Commands/ValidateCsv.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ protected function executeAction(): int
$errorCounter += $errorSuite->count();

if ($this->isTextMode()) {
$this->_(Utils::cutPath($csvFilename->getPathname()), OutLvl::ERROR);
$this->_('<red>Error</red>: ' . Utils::cutPath($csvFilename->getPathname()), OutLvl::E);
}
$output = $errorSuite->render($this->getOptString('report'));
if ($output !== null) {
Expand Down
2 changes: 1 addition & 1 deletion src/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public static function findFiles(array $paths): array
if (\strpos($path, '*') !== false) {
$finder = (new Finder())
->in(\dirname($path))
->depth('< ' . self::MAX_DIRECTORY_DEPTH)
// ->depth(self::MAX_DIRECTORY_DEPTH)
->ignoreVCSIgnored(true)
->ignoreDotFiles(true)
->followLinks()
Expand Down
12 changes: 2 additions & 10 deletions tests/Blueprint/ValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -515,22 +515,14 @@ public function testRenderGitlab(): void
[
'description' => "min at column 0:seq\n\"min\" at line 2, " .
'column "0:seq". Value "1" is less than "3".',
// 'fingerprint' => '...',
'severity' => 'major',
'location' => [
'path' => $path,
'lines' => ['begin' => 2],
],
'location' => ['path' => $path, 'lines' => ['begin' => 2]],
],
[
'description' => "min at column 0:seq\n\"min\" at line 3, " .
'column "0:seq". Value "2" is less than "3".',
// 'fingerprint' => '..',
'severity' => 'major',
'location' => [
'path' => $path,
'lines' => ['begin' => 3],
],
'location' => ['path' => $path, 'lines' => ['begin' => 3]],
],
],
$cleanJson,
Expand Down

0 comments on commit 78ec043

Please sign in to comment.