]> nos-oignons.net Git - gestion-adh.git/blobdiff - bin/pre-commit-hook
Next step in pre-commit hook implementation
[gestion-adh.git] / bin / pre-commit-hook
index aa60ccbe37c0832d938113d5625fec358131ee06..7d3d0e8f4c8fdbf30c3090afb9944b3191c190fd 100755 (executable)
@@ -16,7 +16,15 @@ else
 end
 
 def is_valid_subscription?(content)
-  content.length != 0 && YAML.load(content)
+  return false if content.length == 0
+  return false unless content.start_with?("---\n")
+  begin
+    YAML.load(content)
+    true
+  rescue ArgumentError
+    # Parse error
+    false
+  end
 end
 
 def is_valid_subscription_file?(file)