8000 [YAML][LINT] Add line numbers to JSON output. · symfony/symfony@3f54f07 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3f54f07

Browse files
[YAML][LINT] Add line numbers to JSON output.
| Q | A | ------------- | --- | Branch? | 2.7? | Bug fix? | no? | New feature? | yes? | BC breaks? | no? | Deprecations? | no? | Tests pass? | ? | Fixed tickets | n/a | License | MIT | Doc PR | TODO? - [ ] Run tests? - [ ] Check if it will break BC? - [ ] Update changelog? The JSON output is not very useful for me without the line number. I don't want to have to parse it from the message. Is this the right way of doing it? With PR: ``` [ { "file": "", "line": 13, "valid": false, "message": "Unable to parse at line 13 (near \"sdf \")." } ] ``` Before: ``` [ { "file": "", "valid": false, "message": "Unable to parse at line 13 (near \"sdf \")." } ] ```
1 parent 587b2f7 commit 3f54f07

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ private function validate($content, $file = null)
114114
try {
115115
$this->getParser()->parse($content, Yaml::PARSE_CONSTANT);
116116
} catch (ParseException $e) {
117-
return array('file' => $file, 'valid' => false, 'message' => $e->getMessage());
117+
return array('file' => $file, 'line' => $e->getParsedLine(), 'valid' => false, 'message' => $e->getMessage());
118118
} finally {
119119
restore_error_handler();
120120
}

0 commit comments

Comments
 (0)
0