lib/travis/cli/lint.rb in travis-1.8.14.travis.1160.9 vs lib/travis/cli/lint.rb in travis-1.8.14.travis.1162.9
- old
+ new
@@ -1,6 +1,7 @@
require 'travis/cli'
+require 'yaml'
module Travis
module CLI
class Lint < ApiCommand
description 'display warnings for a .travis.yml'
@@ -17,9 +18,15 @@
content = File.read(file)
else
debug "reading stdin"
file = 'STDIN'
content = $stdin.read
+ end
+
+ begin
+ YAML.load(content)
+ rescue Psych::SyntaxError => e
+ error "#{file} is not valid YAML: #{e.message}"
end
lint = session.lint(content)
unless quiet?