-
Notifications
You must be signed in to change notification settings - Fork 276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Symfony routing-file validation #30
Comments
Hi @bobvandevijver, Thanks, I wasn't aware of that limitation. The problem comes from pyyaml, the Python YAML library (on which yamllint relies). It can be reproduced using:
I've looked into the official spec, to check that your YAML code is valid. It is. The spec states that plain scalars cannot contain
So I suggest you report this bug at pyyaml, so this gets fixed upstream. Feel free to link this issue for reference. In the meantime, you could use this equivalent notation (that does not break pyyaml): blog_list:
path: /blog
defaults:
_controller: AppBundle:Blog:list |
By digging further I found this open pull request at pyyaml: yaml/pyyaml#45 Hopefully it will get merged and your problem will disappear! |
If you want to keep the single-line format, you can quote the controller name: # app/config/routing.yml
blog_list:
path: /blog
defaults: { _controller: "AppBundle:Blog:list" }
blog_show:
path: /blog/{slug}
defaults: { _controller: "AppBundle:Blog:show" } |
@adrienverge Thank you for the information, lets hope that it will be merged soon 😃 @freddrake I know, but with the quotes the autocomplete in my IDE no longer works. Besides, I would have to change quite a lot of route names... |
@bobvandevijver: I agree getting the fix landed would be best. |
As a temporary solution I'm using the following command/regex in order to replace the "errors" in the yaml files (might anyone be interested):
|
yaml/pyyaml#45 has been merged and released, and the bug doesn't appear anymore on my side. |
Hi,
First of all, great project!
I want to use this project to lint Symfony routing files. Below is an example of such a file:
However, apparently the
:
in the controller name is not considered as valid syntax. The output below is from the linter with default configuration on the snippet above:A solution for the linter would be to place the value in
"
's, but that breaks stuff in other parts.Do you have any suggestion on how to fix this problem? I would really like to use this linter, but as long as it generates the syntax errors it is useless for my project...
The text was updated successfully, but these errors were encountered: