10000 minor #33651 [Yaml] hint to the --parse-tags when parsing tags fails … · symfony/symfony@ca10874 · GitHub
[go: up one dir, main page]

Skip to content

Commit ca10874

Browse files
committed
minor #33651 [Yaml] hint to the --parse-tags when parsing tags fails (xabbuh)
This PR was merged into the 4.4 branch. Discussion ---------- [Yaml] hint to the --parse-tags when parsing tags fails | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | Fix #28465 (comment) | License | MIT | Doc PR | Commits ------- 0121115 hint to the --parse-tags when parsing tags fails
2 parents 9e44f58 + 0121115 commit ca10874

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/Symfony/Component/Yaml/Command/LintCommand.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ private function displayTxt(SymfonyStyle $io, array $filesInfo)
153153
{
154154
$countFiles = \count($filesInfo);
155155
$erroredFiles = 0;
156+
$suggestTagOption = false;
156157

157158
foreach ($filesInfo as $info) {
158159
if ($info['valid'] && $this->displayCorrectFiles) {
@@ -161,13 +162,17 @@ private function displayTxt(SymfonyStyle $io, array $filesInfo)
161162
++$erroredFiles;
162163
$io->text('<error> ERROR </error>'.($info['file'] ? sprintf(' in %s', $info['file']) : ''));
163164
$io->text(sprintf('<error> >> %s</error>', $info['message']));
165+
166+
if (false !== strpos($info['message'], 'PARSE_CUSTOM_TAGS')) {
167+
$suggestTagOption = true;
168+
}
164169
}
165170
}
166171

167172
if (0 === $erroredFiles) {
168173
$io->success(sprintf('All %d YAML files contain valid syntax.', $countFiles));
169174
} else {
170-
$io->warning(sprintf('%d YAML files have valid syntax and %d contain errors.', $countFiles - $erroredFiles, $erroredFiles));
175+
$io->warning(sprintf('%d YAML files have valid syntax and %d contain errors.%s', $countFiles - $erroredFiles, $erroredFiles, $suggestTagOption ? ' Use the --parse-tags option if you want parse custom tags.' : ''));
171176
}
172177

173178
return min($erroredFiles, 1);
@@ -182,6 +187,10 @@ private function displayJson(SymfonyStyle $io, array $filesInfo)
182187
if (!$v['valid']) {
183188
++$errors;
184189
}
190+
191+
if (isset($v['message']) && false !== strpos($v['message'], 'PARSE_CUSTOM_TAGS')) {
192+
$v['message'] .= ' Use the --parse-tags option if you want parse custom tags.';
193+
}
185194
});
186195

187196
$io->writeln(json_encode($filesInfo, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));

0 commit comments

Comments
 (0)
0