6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/learn-tool/yaml-linter.rb', line 6
def self.parse_file(file, learn_error)
begin
YAML.load_file(file)
rescue Exception => err
learn_error.valid_yaml = {message: "#{err}", color: :red}
else
learn_error.yaml_error[:valid_yaml] = true
if check_attributes(file)
learn_error.yaml_error[:attributes] = true
learn_error.correct_yaml_content = {message: "valid attribute key names", color: :green}
end
if self.validate_whitespace_for_learn(file)
learn_error.yaml_error[:valid_whitespace] = true
learn_error.valid_yaml = {message: "valid yaml and valid whitespace.", color: :green}
else
learn_error.valid_yaml = {message: "valid yaml but invalid whitespace", color: :red}
end
end
end
|