Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3f54f07

Browse filesBrowse 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
Copy full SHA for 3f54f07

File tree

1 file changed

+1
-1
lines changed
Filter options

1 file changed

+1
-1
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Yaml/Command/LintCommand.php
+1-1Lines 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)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.