Skip to content

Commit

Permalink
Added skeleton for suggested fixes in TSV parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
HenningTimm committed Mar 27, 2024
1 parent 7362fbe commit 7acc6c2
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions yml2block/suggestions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
...

0 comments on commit 7acc6c2

Please sign in to comment.