Skip to content

Commit

Permalink
Merge pull request #52 from homebysix/2021-12-22
Browse files Browse the repository at this point in the history
v1.12.1 merge to main
  • Loading branch information
homebysix authored Dec 23, 2021
2 parents 485a0ca + 2699ef2 commit 1132dcd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ For any hook in this repo you wish to use, add the following to your pre-commit

```yaml
- repo: https://github.com/homebysix/pre-commit-macadmin
rev: v1.12.0
rev: v1.12.1
hooks:
- id: check-plists
# - id: ...
Expand Down Expand Up @@ -121,7 +121,7 @@ When combining arguments that take lists (for example: `--required-keys`, `--cat

```yaml
- repo: https://github.com/homebysix/pre-commit-macadmin
rev: v1.12.0
rev: v1.12.1
hooks:
- id: check-munki-pkgsinfo
args: ['--catalogs', 'testing', 'stable', '--']
Expand All @@ -131,7 +131,7 @@ But if you also use the `--categories` argument, you would move the trailing `--

```yaml
- repo: https://github.com/homebysix/pre-commit-macadmin
rev: v1.12.0
rev: v1.12.1
hooks:
- id: check-munki-pkgsinfo
args: ['--catalogs', 'testing', 'stable', '--categories', 'Design', 'Engineering', 'Web Browsers', '--']
Expand All @@ -143,7 +143,7 @@ If it looks better to your eye, feel free to use a multi-line list for long argu

```yaml
- repo: https://github.com/homebysix/pre-commit-macadmin
rev: v1.12.0
rev: v1.12.1
hooks:
- id: check-munki-pkgsinfo
args: [
Expand Down
17 changes: 9 additions & 8 deletions pre_commit_hooks/check_preference_manifests.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def validate_required_keys(input_dict, required_keys, dict_name, filename):
"""Verifies that required_keys are present in dictionary."""
passed = True
for req_key in required_keys:
if not input_dict.get(req_key):
if input_dict.get(req_key, "") == "":
print("{}: {} missing required key {}".format(filename, dict_name, req_key))
passed = False
return passed
Expand Down Expand Up @@ -338,12 +338,12 @@ def validate_subkeys(subkeys, filename):
if not validate_pfm_type_strings(subkey, filename):
passed = False

# Check that list items are of the expected type
if "pfm_type" not in subkey:
print(
"WARNING: Recommend adding a pfm_title to %s"
% subkey.get("pfm_name", "<unnamed key>")
)
# TODO: Suggest adding a title if one is missing
# if "pfm_title" not in subkey:
# print(
# "WARNING: Recommend adding a pfm_title to %s"
# % subkey.get("pfm_name", "<unnamed key>")
# )

# Check that list items are of the expected type
if not validate_list_item_types(subkey, filename):
Expand Down Expand Up @@ -393,12 +393,13 @@ def main(argv=None):
except (ExpatError, ValueError) as err:
print("{}: plist parsing error: {}".format(filename, err))
retval = 1
continue # No need to continue checking this file

# Check for presence of required keys.
required_keys = ("pfm_title", "pfm_domain", "pfm_description")
if not validate_required_keys(manifest, required_keys, "<root dict>", filename):
retval = 1
break # No need to continue checking this file
continue # No need to continue checking this file

# Ensure pfm_format_version has expected value
if manifest.get("pfm_format_version", 1) != 1:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
name="pre-commit-macadmin",
description="Pre-commit hooks for Mac admins, client engineers, and IT consultants.",
url="https://github.com/homebysix/pre-commit-macadmin",
version="1.12.0",
version="1.12.1",
author="Elliot Jordan",
author_email="[email protected]",
packages=["pre_commit_hooks"],
Expand Down

0 comments on commit 1132dcd

Please sign in to comment.