]> 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 713cb6fa33c1b98a7e615f6aa6e71b4eebec9c18..7d3d0e8f4c8fdbf30c3090afb9944b3191c190fd 100755 (executable)
@@ -16,9 +16,15 @@ else
 end
 
 def is_valid_subscription?(content)
-  content.length != 0 &&
-    content.start_with?("---\n") &&
+  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)