Skip to content
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

Parsing exception in multiline literal with long line (Jinja template, only with relaxed config) #21

Closed
danielkza opened this issue Sep 25, 2016 · 1 comment

Comments

@danielkza
Copy link

@danielkza danielkza commented Sep 25, 2016

The exception happened in an Ansible YAML file, but I managed to reproduce it with the following simplified case.

- test:
    - test: test
      block:
        - name: test
          content: |
            {% this line is really really really really really really really long %}
$ yamllint --version
yamllint 1.4.0

$ yamllint test.yml
test.yml
  1:1       warning  missing document start "---"  (document-start)
  6:81      error    line too long (84 > 80 characters)  (line-length)

$ yamllint -d relaxed test.yml
Traceback (most recent call last):
  File "/home/danielkza/cobli/herbie/deploy/venv/bin/yamllint", line 11, in <module>
    sys.exit(run())
  File "/home/danielkza/cobli/herbie/deploy/venv/lib/python2.7/site-packages/yamllint/cli.py", line 130, in run
    for problem in linter.run(f, conf):
  File "/home/danielkza/cobli/herbie/deploy/venv/lib/python2.7/site-packages/yamllint/linter.py", line 186, in _run
    for problem in get_costemic_problems(buffer, conf):
  File "/home/danielkza/cobli/herbie/deploy/venv/lib/python2.7/site-packages/yamllint/linter.py", line 150, in get_costemic_problems
    for problem in rule.check(rule_conf, elem):
  File "/home/danielkza/cobli/herbie/deploy/venv/lib/python2.7/site-packages/yamllint/rules/line_length.py", line 132, in check
    check_inline_mapping(line)):
  File "/home/danielkza/cobli/herbie/deploy/venv/lib/python2.7/site-packages/yamllint/rules/line_length.py", line 105, in check_inline_mapping
    while loader.peek_token():
  File "/home/danielkza/cobli/herbie/deploy/venv/lib/python2.7/site-packages/yaml/scanner.py", line 128, in peek_token
    self.fetch_more_tokens()
  File "/home/danielkza/cobli/herbie/deploy/venv/lib/python2.7/site-packages/yaml/scanner.py", line 257, in fetch_more_tokens
    % ch.encode('utf-8'), self.get_mark())
yaml.scanner.ScannerError: while scanning for the next token
found character '%' that cannot start any token
  in "<string>", line 1, column 14:
                {% this line is really really rea ...
@danielkza danielkza changed the title Parsing exception for multiline literal in Jinja template with long line (only with relaxed config) Parsing exception in multiline literal with long line (Jinja template, only with relaxed config) Sep 25, 2016
@adrienverge

This comment has been minimized.

Copy link
Owner

@adrienverge adrienverge commented Sep 27, 2016

Thanks @danielkza.

This bug was introduced last week by pull request #17.

I'll write a fix and publish a new version!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.