Skip to content

Commit

Permalink
Merge pull request #76 from WardsParadox/main
Browse files Browse the repository at this point in the history
Validate all result tags are closed
  • Loading branch information
homebysix authored Jan 12, 2024
2 parents 5f6f1f0 + 9cb4fbb commit 1ebede1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pre_commit_hooks/check_jamf_extension_attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""Check Jamf extension attributes for common issues."""

import argparse
import os
import re


def build_argument_parser():
Expand All @@ -29,8 +29,12 @@ def main(argv=None):
ea_content = openfile.read()

if "<result>" not in ea_content or "</result>" not in ea_content:
print("{}: missing <result> and/or </result> tags".format(filename))
print(f"{filename}: missing <result> and/or </result> tags")
retval = 1
all_results = len(re.findall("result.*\/result", ea_content))
proper_results = len(re.findall("<result>.*<\/result>", ea_content))
if proper_results < all_results:
print(f"{filename}: has incomplete <result> tags!")

return retval

Expand Down

0 comments on commit 1ebede1

Please sign in to comment.