Skip to content

Commit

Permalink
Merge pull request #41 from homebysix/1.8.0
Browse files Browse the repository at this point in the history
v1.8.0 merge to master
  • Loading branch information
homebysix committed Oct 9, 2020
2 parents d6b3af5 + ed20a40 commit 0689f63
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 17 deletions.
11 changes: 9 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).


## [1.8.0] - 2020-10-08

### Changed
- Replaced `plistlib.readPlist()` with `plistlib.load()`


## [1.7.0] - 2020-10-06

### Added
Expand Down Expand Up @@ -188,8 +194,9 @@ All notable changes to this project will be documented in this file. This projec
- Initial release


[Unreleased]: https://github.com/homebysix/pre-commit-macadmin/compare/v1.7.0...HEAD
[1.6.2]: https://github.com/homebysix/pre-commit-macadmin/compare/v1.6.2...v1.7.0
[Unreleased]: https://github.com/homebysix/pre-commit-macadmin/compare/v1.8.0...HEAD
[1.8.0]: https://github.com/homebysix/pre-commit-macadmin/compare/v1.7.0...v1.8.0
[1.7.0]: https://github.com/homebysix/pre-commit-macadmin/compare/v1.6.2...v1.7.0
[1.6.2]: https://github.com/homebysix/pre-commit-macadmin/compare/v1.6.1...v1.6.2
[1.6.1]: https://github.com/homebysix/pre-commit-macadmin/compare/v1.6.0...v1.6.1
[1.6.0]: https://github.com/homebysix/pre-commit-macadmin/compare/v1.5.2...v1.6.0
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,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.7.0
rev: v1.8.0
hooks:
- id: check-plists
# - id: ...
Expand Down Expand Up @@ -119,7 +119,7 @@ When combining arguments that take lists (for example: `--required-keys`, `--cat

```yaml
- repo: https://github.com/homebysix/pre-commit-macadmin
rev: v1.7.0
rev: v1.8.0
hooks:
- id: check-munki-pkgsinfo
args: ['--catalogs', 'testing', 'stable', '--']
Expand All @@ -129,7 +129,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.7.0
rev: v1.8.0
hooks:
- id: check-munki-pkgsinfo
args: ['--catalogs', 'testing', 'stable', '--categories', 'Design', 'Engineering', 'Web Browsers', '--']
Expand All @@ -141,7 +141,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.7.0
rev: v1.8.0
hooks:
- id: check-munki-pkgsinfo
args: [
Expand Down
6 changes: 4 additions & 2 deletions pre_commit_hooks/check_autopkg_recipe_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
"""

import argparse
import json
import plistlib
from xml.parsers.expat import ExpatError
import json

import ruamel.yaml

yaml = ruamel.yaml.YAML(typ="safe")
Expand Down Expand Up @@ -44,7 +45,8 @@ def main(argv=None):
]
elif filename.endswith(".plist"):
try:
recipe_list = plistlib.readPlist(filename)
with open(filename, "rb") as openfile:
recipe_list = plistlib.load(openfile)
except (ExpatError, ValueError) as err:
print("{}: plist parsing error: {}".format(filename, err))
retval = 1
Expand Down
3 changes: 2 additions & 1 deletion pre_commit_hooks/check_autopkg_recipes.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,8 @@ def main(argv=None):
retval = 0
for filename in args.filenames:
try:
recipe = plistlib.readPlist(filename)
with open(filename, "rb") as openfile:
recipe = plistlib.load(openfile)

except (ExpatError, ValueError) as err:
print("{}: plist parsing error: {}".format(filename, err))
Expand Down
3 changes: 2 additions & 1 deletion pre_commit_hooks/check_jamf_profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ def main(argv=None):
retval = 0
for filename in args.filenames:
try:
profile = plistlib.readPlist(filename)
with open(filename, "rb") as openfile:
profile = plistlib.load(openfile)
except (ExpatError, ValueError) as err:
print("{}: plist parsing error: {}".format(filename, err))
retval = 1
Expand Down
5 changes: 3 additions & 2 deletions pre_commit_hooks/check_munki_pkgsinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ def main(argv=None):
retval = 0
for filename in args.filenames:
try:
pkginfo = plistlib.readPlist(filename)
with open(filename, "rb") as openfile:
pkginfo = plistlib.load(openfile)
except (ExpatError, ValueError) as err:
print("{}: plist parsing error: {}".format(filename, err))
retval = 1
Expand Down Expand Up @@ -180,7 +181,7 @@ def main(argv=None):
if script_type in pkginfo:
if all(not pkginfo[script_type].startswith(x + "\n") for x in shebangs):
print(
"{}: has a {} that does not start with a valid shebang.".format(
"{}: Has a {} that does not start with a valid shebang.".format(
filename, script_type
)
)
Expand Down
3 changes: 2 additions & 1 deletion pre_commit_hooks/check_munkipkg_buildinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ def main(argv=None):
for filename in args.filenames:
if filename.endswith(".plist"):
try:
buildinfo = plistlib.readPlist(filename)
with open(filename, "rb") as openfile:
buildinfo = plistlib.load(openfile)
except (ExpatError, ValueError) as err:
print("{}: plist parsing error: {}".format(filename, err))
retval = 1
Expand Down
3 changes: 2 additions & 1 deletion pre_commit_hooks/check_plists.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ def main(argv=None):
retval = 0
for filename in args.filenames:
try:
plist = plistlib.readPlist(filename)
with open(filename, "rb") as openfile:
plist = plistlib.load(openfile)
# Possible future addition, but disabled for now.
# if not isinstance(plist, dict):
# print("{}: top level of plist should be type dict".format(filename))
Expand Down
3 changes: 2 additions & 1 deletion pre_commit_hooks/forbid_autopkg_overrides.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ def main(argv=None):
retval = 0
for filename in args.filenames:
try:
recipe = plistlib.readPlist(filename)
with open(filename, "rb") as openfile:
recipe = plistlib.load(openfile)
for req_key in required_keys:
if req_key not in recipe:
print("{}: possible AutoPkg recipe override".format(filename))
Expand Down
3 changes: 2 additions & 1 deletion pre_commit_hooks/forbid_autopkg_trust_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ def main(argv=None):
retval = 0
for filename in args.filenames:
try:
recipe = plistlib.readPlist(filename)
with open(filename, "rb") as openfile:
recipe = plistlib.load(openfile)
if "ParentRecipeTrustInfo" in recipe:
print("{}: trust info in recipe".format(filename))
retval = 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.7.0",
version="1.8.0",
author="Elliot Jordan",
author_email="elliot@elliotjordan.com",
packages=["pre_commit_hooks"],
Expand Down

0 comments on commit 0689f63

Please sign in to comment.