You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem seems to be in yamllint.rules.quoted_strings._quotes_are_needed() . My hunch is that the already-decoded string is being passed, which yaml.reader.check_printable() interprets as unprintable.
Traceback:
Traceback (most recent call last):
File "/Users/jmknoble/.local/bin/yamllint", line 8, in <module>
sys.exit(run())
^^^^^
File "/Users/jmknoble/.local/share/uv/tools/yamllint/lib/python3.12/site-packages/yamllint/cli.py", line 227, in run
prob_level = show_problems(problems, file, args_format=args.format,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jmknoble/.local/share/uv/tools/yamllint/lib/python3.12/site-packages/yamllint/cli.py", line 102, in show_problems
for problem in problems:
^^^^^^^^
File "/Users/jmknoble/.local/share/uv/tools/yamllint/lib/python3.12/site-packages/yamllint/linter.py", line 199, in _run
for problem in get_cosmetic_problems(buffer, conf, filepath):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jmknoble/.local/share/uv/tools/yamllint/lib/python3.12/site-packages/yamllint/linter.py", line 136, in get_cosmetic_problems
for problem in rule.check(rule_conf,
^^^^^^^^^^^^^^^^^^^^^
File "/Users/jmknoble/.local/share/uv/tools/yamllint/lib/python3.12/site-packages/yamllint/rules/quoted_strings.py", line 301, in check
not _quotes_are_needed(token.value,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jmknoble/.local/share/uv/tools/yamllint/lib/python3.12/site-packages/yamllint/rules/quoted_strings.py", line 212, in _quotes_are_needed
loader = yaml.BaseLoader('key: ' + string)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jmknoble/.local/share/uv/tools/yamllint/lib/python3.12/site-packages/yaml/loader.py", line 14, in __init__
Reader.__init__(self, stream)
File "/Users/jmknoble/.local/share/uv/tools/yamllint/lib/python3.12/site-packages/yaml/reader.py", line 74, in __init__
self.check_printable(stream)
File "/Users/jmknoble/.local/share/uv/tools/yamllint/lib/python3.12/site-packages/yaml/reader.py", line 143, in check_printable
raise ReaderError(self.name, position, ord(character),
yaml.reader.ReaderError: unacceptable character #x001b: special characters are not allowed
in "<unicode string>", position 5
The text was updated successfully, but these errors were encountered:
$ yamllint -d 'rules: {quoted-strings: {required: only-when-needed}}' - <<<'key: "\u001b"'
…
yaml.reader.ReaderError: unacceptable character #x001b: special characters are not allowedin"<unicode string>", position 5
A contribution to fix this would be welcome 👍
jmknoble
added a commit
to jmknoble/adrienverge_yamllint
that referenced
this issue
Dec 3, 2024
The following line of YAML:
with the following .yamllint config:
Throws an exception (shown below).
Yamllint version: yamllint 1.35.1
Python version: Python 3.12.7
Dependency versions:
Reproducible problem documented at https://github.com/jmknoble/yamllint-quoted-escaped-nonprintable-char-problem .
The problem seems to be in
yamllint.rules.quoted_strings._quotes_are_needed()
. My hunch is that the already-decoded string is being passed, whichyaml.reader.check_printable()
interprets as unprintable.Traceback:
The text was updated successfully, but these errors were encountered: