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
While playing with it, I came across an obscure issue running on Github’s Windows runner: see for example this failing run. Now here’s the puzzling problem… all YAML files in question use \n line-endings, for example the .yamllint.yaml file:
By default, yamllint checks for UNIX-type line-endings (docs, src) which would be ok for these YAML files. Furthermore, YAML files are opened with their native line-endings preserved (docs):
So by all means and purposes, that check should pass — but it doesn’t 🤔
After poking through the code I can’t spot an obvious issue. I’m also unable to reproduce this on Windows because I’m unsure how the GIthub runner executes Python: native Windows or via WSL.
Maybe this issue is related to issue #218 or #347, although I don’t quite see the connection. To aid debugging, I’m tempted to expand the error message
diff --git a/yamllint/rules/new_lines.py b/yamllint/rules/new_lines.py
index 4e3023e..8fb1174 100644
--- a/yamllint/rules/new_lines.py+++ b/yamllint/rules/new_lines.py@@ -53,7 +53,9 @@ def check(conf, line):
newline_char = '\r\n'
if line.start == 0 and len(line.buffer) > line.end:
- if line.buffer[line.end:line.end + len(newline_char)] != newline_char:+ actual_newline_char = line.buffer[line.end:line.end + len(newline_char)]+ if actual_newline_char != newline_char:
c = repr(newline_char).strip('\'')
+ actual_c = repr(actual_newline_char).strip('\'')
yield LintProblem(1, line.end - line.start + 1,
- f'wrong new line character: expected {c}')+ f'wrong new line character: found {actual_c} expected {c}')
to get more details. Would you accept a PR?
The text was updated successfully, but these errors were encountered:
Hello and thanks for your clear and comprehensible message.
Unfortunately, no: we won't accept a PR that changes yamllint output for a specific debugging use-case.
However, you can try building your own customized yamllint and use it or GitHub CI (I guess it's possible somehow).
You should also try to narrow down the problem, for instance by running yamllint directly (instead of make and pre-commit), and see if you find something.
First of all, thank you for a great tool!
While playing with it, I came across an obscure issue running on Github’s Windows runner: see for example this failing run. Now here’s the puzzling problem… all YAML files in question use
\n
line-endings, for example the .yamllint.yaml file:By default,
yamllint
checks for UNIX-type line-endings (docs, src) which would be ok for these YAML files. Furthermore, YAML files are opened with their native line-endings preserved (docs):yamllint/yamllint/cli.py
Lines 222 to 223 in 1d65ab6
After poking through the code I can’t spot an obvious issue. I’m also unable to reproduce this on Windows because I’m unsure how the GIthub runner executes Python: native Windows or via WSL.
Maybe this issue is related to issue #218 or #347, although I don’t quite see the connection. To aid debugging, I’m tempted to expand the error message
to get more details. Would you accept a PR?
The text was updated successfully, but these errors were encountered: