From 8d25482a1e11785548015a965d001894853e44fa Mon Sep 17 00:00:00 2001 From: Elliot Jordan <> Date: Sat, 9 Apr 2022 19:50:05 -0700 Subject: [PATCH 1/5] Bump version --- README.md | 8 ++++---- setup.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index cc3f5ea..e8ba10f 100644 --- a/README.md +++ b/README.md @@ -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.2 + rev: v1.12.3 hooks: - id: check-plists # - id: ... @@ -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.2 + rev: v1.12.3 hooks: - id: check-munki-pkgsinfo args: ['--catalogs', 'testing', 'stable', '--'] @@ -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.2 + rev: v1.12.3 hooks: - id: check-munki-pkgsinfo args: ['--catalogs', 'testing', 'stable', '--categories', 'Design', 'Engineering', 'Web Browsers', '--'] @@ -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.2 + rev: v1.12.3 hooks: - id: check-munki-pkgsinfo args: [ diff --git a/setup.py b/setup.py index 2e8bc8e..694f217 100755 --- a/setup.py +++ b/setup.py @@ -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.2", + version="1.12.3", author="Elliot Jordan", author_email="elliot@elliotjordan.com", packages=["pre_commit_hooks"], From b0cf6e10a91e3f804f3dcc3c4d04044ba1f81ec4 Mon Sep 17 00:00:00 2001 From: Elliot Jordan <> Date: Sat, 9 Apr 2022 19:50:20 -0700 Subject: [PATCH 2/5] Update files where version is stored --- RELEASING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RELEASING.md b/RELEASING.md index 0cbb1a7..ff70fe1 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -1,6 +1,6 @@ # Releasing new versions of pre-commit-macadmin -1. Update the versions in __README.md__ and __pre_commit_hooks/\_\_init\_\_.py__. +1. Update the versions in __README.md__ and __setup.py__. 1. Update the change log. From 8025ce2b1ac3f8fdee1b27907ae88b56a726e159 Mon Sep 17 00:00:00 2001 From: Elliot Jordan Date: Sat, 9 Apr 2022 19:52:11 -0700 Subject: [PATCH 3/5] Change absence of blocking_applications to WARNING only --- pre_commit_hooks/check_munki_pkgsinfo.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pre_commit_hooks/check_munki_pkgsinfo.py b/pre_commit_hooks/check_munki_pkgsinfo.py index e9d2b8a..3f3dbff 100755 --- a/pre_commit_hooks/check_munki_pkgsinfo.py +++ b/pre_commit_hooks/check_munki_pkgsinfo.py @@ -129,11 +129,10 @@ def main(argv=None): ) ): print( - "{}: contains a pkg installer but has no blocking applications".format( + "WARNING: {}: contains a pkg installer but has no blocking applications".format( filename ) ) - retval = 1 # Ensure an icon exists for the item. if not any( From eea7f941e90576800a863988dead2c41ebea15b8 Mon Sep 17 00:00:00 2001 From: Elliot Jordan Date: Sat, 9 Apr 2022 19:53:20 -0700 Subject: [PATCH 4/5] Make git config check more robust Resolves #58 --- pre_commit_hooks/check_git_config_email.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/pre_commit_hooks/check_git_config_email.py b/pre_commit_hooks/check_git_config_email.py index 823a15b..3ee3e7f 100644 --- a/pre_commit_hooks/check_git_config_email.py +++ b/pre_commit_hooks/check_git_config_email.py @@ -29,9 +29,21 @@ def main(argv=None): retval = 0 if args.domains: - user_email = subprocess.check_output(["git", "config", "--get", "user.email"]) - user_email = user_email.decode().strip() - if not any((user_email.endswith(x) for x in args.domains)): + proc = subprocess.run( + ["git", "config", "--get", "user.email"], + check=False, + capture_output=True, + text=True, + ) + user_email = proc.stdout.strip() + if not user_email: + print("Git config email is not set.") + retval = 1 + elif "@" not in user_email: + print("Git config email does not look like an email address.") + print("Git config email: " + user_email) + retval = 1 + elif not any((user_email.endswith("@" + x) for x in args.domains)): print("Git config email is from an unexpected domain.") print("Git config email: " + user_email) print("Expected domains: " + str(args.domains)) From c4c50c4c91270393fa18f303375d3d912d23ed6e Mon Sep 17 00:00:00 2001 From: Elliot Jordan Date: Sat, 9 Apr 2022 19:53:33 -0700 Subject: [PATCH 5/5] Update change log --- CHANGELOG.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2365907..ec30d84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,16 @@ All notable changes to this project will be documented in this file. This projec Nothing yet. +## [1.12.3] - 2022-04-09 + +### Changed + +- Changed check-munki-pkgsinfo to WARN on the absence of the `blocking_applications` array for installers in pkg format, rather than to fail the pre-commit test. This better aligns with Munki's own design, which does not require `blocking_applications`. + +### Fixed + +- Resolved an uncaught exception if the git config email is unset. (#58) + ## [1.12.2] - 2022-02-27 ### Changed @@ -283,7 +293,8 @@ Nothing yet. - Initial release -[Unreleased]: https://github.com/homebysix/pre-commit-macadmin/compare/v1.12.2...HEAD +[Unreleased]: https://github.com/homebysix/pre-commit-macadmin/compare/v1.12.3...HEAD +[1.12.3]: https://github.com/homebysix/pre-commit-macadmin/compare/v1.12.2...v1.12.3 [1.12.2]: https://github.com/homebysix/pre-commit-macadmin/compare/v1.12.1...v1.12.2 [1.12.1]: https://github.com/homebysix/pre-commit-macadmin/compare/v1.12.0...v1.12.1 [1.12.0]: https://github.com/homebysix/pre-commit-macadmin/compare/v1.11.0...v1.12.0