Skip to content

Commit a685087

Browse files
committed
Merge branch 'main' of ssh://github.com/homebysix/pre-commit-macadmin into dev
2 parents 6add896 + f2de47f commit a685087

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ After adding a hook to your pre-commit config, it's not a bad idea to run `pre-c
120120
- Choose to just warn if icons referenced in pkginfo files are missing (this will allow pre-commit checks to pass if no other issues exist):
121121
`args: ['--warn-on-missing-icons]`
122122

123+
- Choose to just warn if installer items (`installer_item_location`) referenced in pkginfo files are missing (this will allow pre-commit checks to pass if no other issues exist):
124+
`args: ['--warn-on-missing-installer-items]`
125+
123126
- Choose to just warn if pkg/pkginfo files with __1 (or similar) suffixes are detected (this will allow pre-commit checks to pass if no other issues exist):
124127
`args: ['--warn-on-duplicate-imports]`
125128

pre_commit_hooks/check_munki_pkgsinfo.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ def build_argument_parser():
4848
action="store_true",
4949
default=False,
5050
)
51+
parser.add_argument(
52+
"--warn-on-missing-installer-items",
53+
help="If added, this will only warn on missing installer items.",
54+
action="store_true",
55+
default=False,
56+
)
5157
parser.add_argument(
5258
"--warn-on-duplicate-imports",
5359
help="If added, this will only warn if pkginfo/pkg files end with a __1 suffix.",
@@ -150,10 +156,12 @@ def main(argv=None):
150156
args.munki_repo, "pkgs", pkginfo.get("installer_item_location", "")
151157
)
152158
):
153-
print(
154-
f"{filename}: installer item does not exist or path is not case sensitive"
155-
)
156-
retval = 1
159+
msg = "installer item does not exist or path is not case sensitive"
160+
if args.warn_on_missing_installer_items:
161+
print(f"{filename}: WARNING: {msg}")
162+
else:
163+
print(f"{filename}: {msg}")
164+
retval = 1
157165

158166
# Check for pkg filenames showing signs of duplicate imports.
159167
if pkginfo.get("installer_item_location", "").endswith(tuple(dupe_suffixes)):

0 commit comments

Comments
 (0)