travis-ci / travis-yaml

parses, normalizes, validates and serializes your .travis.yml
http://yaml.travis-ci.org/
MIT License
170 stars 66 forks source link

Error message not pointing to problem #115

Open cdeil opened 7 years ago

cdeil commented 7 years ago

I have this case: https://travis-ci.org/gammapy/gammapy/builds/230082206?utm_source=github_status&utm_medium=notification saying

The log message was: Build config file had a parse error: did not find expected '-' indicator while parsing a block collection at line 158 column 5.

But really there's no problem on that line and it's a SyntaxError further down on line 175, no?

$ python -m yamllint .travis.yml 
.travis.yml
  9:1       warning  missing document start "---"  (document-start)
  18:3      error    wrong indentation: expected 4 but found 2  (indentation)
  19:5      error    wrong indentation: expected 6 but found 4  (indentation)
  20:7      error    wrong indentation: expected 8 but found 6  (indentation)
  30:81     error    line too long (158 > 80 characters)  (line-length)
  31:81     error    line too long (150 > 80 characters)  (line-length)
  32:81     error    line too long (149 > 80 characters)  (line-length)
  33:81     error    line too long (178 > 80 characters)  (line-length)
  34:81     error    line too long (169 > 80 characters)  (line-length)
  35:81     error    line too long (181 > 80 characters)  (line-length)
  36:81     error    line too long (184 > 80 characters)  (line-length)
  92:81     error    line too long (90 > 80 characters)  (line-length)
  107:1     warning  comment not indented like content  (comments-indentation)
  123:10    warning  missing starting space in comment  (comments)
  126:81    error    line too long (99 > 80 characters)  (line-length)
  147:5     warning  comment not indented like content  (comments-indentation)
  147:81    error    line too long (81 > 80 characters)  (line-length)
  151:81    error    line too long (81 > 80 characters)  (line-length)
  162:81    error    line too long (85 > 80 characters)  (line-length)
  174:81    error    line too long (99 > 80 characters)  (line-length)
  175:11    error    syntax error: expected <block end>, but found '<scalar>'

Can you make travis-yaml give a better message here pointing to the actual line with the issue?

Test file is here: https://github.com/bsipocz/gammapy/blob/41e3a3e184ef799346051b7758fee5627f309518/.travis.yml and copy here: https://gist.github.com/cdeil/59ae0750fa1a26378e9ed10271b50162

BanzaiMan commented 7 years ago

The error on the line 175 alters the parser's expectation of the data structure that starts on line 158.

Unfortunately, our YAML parser stops parsing the file upon the first error.

http://yaml-online-parser.appspot.com/, which uses the pyyaml, shows the same error, and also the one on line 175. I am not familiar with yamllint, but https://pypi.python.org/pypi/yamllint says that it is not a validator.

cdeil commented 7 years ago

Thanks for the quick reply! I just thought I'd mention it. Feel free to close if there's nothing you can do here with reasonable effort.