lib/yaml-validator.rb in yaml-validator-0.1.8 vs lib/yaml-validator.rb in yaml-validator-0.1.9
- old
+ new
@@ -181,12 +181,20 @@
else
return ["#{full_key} doesn't exist in en.yml"]
end
end
+ syntax_error = /(^|[^%]){[^}]+}%?/.match(value)
+ unless syntax_error.nil?
+ return [
+ "#{full_key}: invalid syntax '#{syntax_error}'"
+ ]
+ end
+
used_vars = identify_variables(value)
errors = []
+
used_vars.each do |var|
unless real_vars.include? var
errors << "#{full_key}: missing variable '#{var}' (available options: #{real_vars.join(', ')})"
end
end