Skip to content

Commit

Permalink
refactor: add error handling when getting filter_type from class
Browse files Browse the repository at this point in the history
  • Loading branch information
mariajgrimaldi committed Jan 22, 2025
1 parent b0c3aec commit 7455a5e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion edx_lint/pylint/filters_docstring/filters_docstring_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,11 @@ def _check_filter_type_missing_or_incorrect(self, node, docstring):
If the filter type is missing or incorrect, return the error message. Otherwise, return.
"""
filter_type = node.locals["filter_type"][0].statement().value.value
filter_type = node.locals.get("filter_type")
if not filter_type:
return self.DOCSTRING_MISSING_OR_INCORRECT_TYPE

filter_type = filter_type[0].statement().value.value if filter_type else ""
if not re.search(r"Filter Type:\s*%s" % filter_type, docstring):
return self.DOCSTRING_MISSING_OR_INCORRECT_TYPE
return None
Expand Down

0 comments on commit 7455a5e

Please sign in to comment.