From 7acc6c2a22cc5adf62a6d2cf36940499f68c5318 Mon Sep 17 00:00:00 2001 From: Henning Timm Date: Wed, 27 Mar 2024 15:09:54 +0100 Subject: [PATCH] Added skeleton for suggested fixes in TSV parsing --- yml2block/suggestions.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/yml2block/suggestions.py b/yml2block/suggestions.py index 92d5e8d..af08bad 100644 --- a/yml2block/suggestions.py +++ b/yml2block/suggestions.py @@ -58,3 +58,24 @@ def fix_required_keys_present(missing_keys, list_item, tsv_keyword): """Return list of missing keys.""" name = identify_entry(list_item, tsv_keyword) return f"Missing keys '{missing_keys}' for '{name}' in block '{tsv_keyword}'." + + +def fix_identify_breaking_points(full_file, break_points): + """Suggest fixes for too little or too many detected blocks.""" + match len(break_points): + case 0: + # No line starts with # + # are you passing the right file? + ... + case 1: + # Only one line starts with # + # At least two blocks are required for a reasonable metadata schema + ... + case 2 | 3: + # This case should never be reached, those files are fine + # Raise an exception if I get here in error handling + ... + case _: + # More than the required number of blocks is present. + # Identify what is going on. + ...