Skip to content

Commit

Permalink
Fix rule parser logic (#26393)
Browse files Browse the repository at this point in the history
Co-authored-by: Andrei Litvin <andreilitvin@google.com>
  • Loading branch information
2 people authored and pull[bot] committed Nov 23, 2023
1 parent 08a5ac1 commit 191df0a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions scripts/py_matter_idl/matter_idl/lint/lint_rules_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,9 @@ def DecodeClusterFromXml(element: xml.etree.ElementTree.Element):
# - name (general name for this cluster)
# - code (unique identifier, may be hex or numeric)
# - attribute with side, code and optional attributes

try:
name = element.find('name')
if not name or not name.text:
if name is None or not name.text:
raise ElementNotFoundError('name')

name = name.text.replace(' ', '')
Expand Down Expand Up @@ -105,7 +104,7 @@ def DecodeClusterFromXml(element: xml.etree.ElementTree.Element):
name=cmd.attrib["name"], code=parseNumberString(cmd.attrib['code'])))

code = element.find('code')
if not code:
if code is None:
raise Exception("Failed to find cluster code")

return DecodedCluster(
Expand Down

0 comments on commit 191df0a

Please sign in to comment.