Skip to content

Commit

Permalink
fix handling of description=None
Browse files Browse the repository at this point in the history
  • Loading branch information
bendichter committed Nov 24, 2024
1 parent ca0a41c commit 5fd89ba
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/nwbinspector/checks/_general.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,15 @@ def check_description(neurodata_object: object) -> Optional[InspectorMessage]:
Best Practice: :ref:`best_practice_placeholders`
"""
if not hasattr(neurodata_object, "description") or type(neurodata_object.description) is not str:
if not hasattr(neurodata_object, "description"):
return None
if neurodata_object.description is None or neurodata_object.description.strip(" ") == "":

description = neurodata_object.description
if type(description) not in (str, None):
return None
if description is None or description.strip(" ") == "":
return InspectorMessage(message="Description is missing.")
if neurodata_object.description.lower().strip(".") in COMMON_DESCRIPTION_PLACEHOLDERS:
return InspectorMessage(message=f"Description ('{neurodata_object.description}') is a placeholder.")
if description.lower().strip(".") in COMMON_DESCRIPTION_PLACEHOLDERS:
return InspectorMessage(message=f"Description ('{description}') is a placeholder.")

return None

0 comments on commit 5fd89ba

Please sign in to comment.