Check for non-breaking spaces in circle.yml

circle.yml
2.0

#1

On some systems, when you press Shift+Spacebar or Option/AltGr+Spacebar, it’ll output a non-breaking space (U+00a0) instead of a normal space character. This usually happens by accident when typing too quickly, and in most editors, this character will look just like a normal space, unless you tell your editor to reveal those characters (e.g. :set list in vim).

The issue here is when CircleCI’s YAML parser encounters one of these non-breaking spaces, it can produce some pretty cryptic error messages, for example:

  • /bin/bash: -c: line 1: syntax error: unexpected end of file caused by a nbsp right after the bar that started a multiline value
  • Error computing cache key: template: cacheKey:1: unrecognized character in action: U+00A0 I probably would never have figured out my issue without this error message
  • In step 2 definition: This type of step does not support compressed syntax
  • /bin/bash: $'name:\302\240Install': command not found when using a run block with multiple sub-keys

It almost seems like when YAML encounters a non-breaking space followed by a newline it merges the current line with the next one

Would it be possible to warn users when their circle.yml contains non-breaking spaces? This would help greatly in identifying these types of errors.


#2