Skip to content

Commit ccf1629

Browse files
authored
Merge pull request #80 from homebysix/dev
1.16.1 merge to main
2 parents 20ca775 + 476c4ec commit ccf1629

21 files changed

+255
-279
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.5.0
3+
rev: v4.6.0
44
hooks:
55
- id: check-ast
66
- id: check-byte-order-marker
@@ -17,6 +17,6 @@ repos:
1717
- id: trailing-whitespace
1818
args: [--markdown-linebreak-ext=md]
1919
- repo: https://github.com/python/black
20-
rev: 24.1.1
20+
rev: 24.4.2
2121
hooks:
2222
- id: black

.pre-commit-hooks.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,14 @@
125125
files: '\.recipe(\.plist|\.yaml|\.json)?$'
126126
types: [text]
127127

128+
- id: format-xml-plist
129+
name: Auto-format plist [XML]
130+
description: Auto-format a Property List (plist) as XML.
131+
entry: plutil -convert xml1
132+
language: system
133+
files: '\.(mobileconfig|pkginfo|plist|recipe)$'
134+
types: [text]
135+
128136
- id: munki-makecatalogs
129137
name: Run Munki Makecatalogs
130138
description: This hook runs the "makecatalogs" command to ensure all referenced packages are present and catalogs are up to date.

CHANGELOG.md

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,33 @@ All notable changes to this project will be documented in this file. This projec
1414

1515
Nothing yet.
1616

17+
## [1.16.1] - 2024-06-08
18+
19+
### Added
20+
21+
- New `format-xml-plist` hook to auto-format XML property list (plist) files to use tabs instead of spaces, and will alphabetically sort keys. (#79, thanks to n8felton)
22+
- New `--valid-shebangs` parameter to specify additional custom shebangs in use for your environment. Works with the `check-munki-pkgsinfo`, `check-jamf-scripts`, `check-jamf-extension-attributes`, `check-outset-scripts`, and `check-munkiadmin-scripts` hooks. (#75, thanks to @kbrewersq)
23+
- Checks to ensure the MinimumVersion key in AutoPkg recipes is a string. (If quotes are omitted in yaml-formatted recipes, this key could be interpreted as a float.)
24+
25+
### Removed
26+
27+
- No longer warn when using AutoPkg MinimumVersion greater than 2.0.
28+
- Python 2 support deprecated and will be removed in the future.
29+
30+
### Changed
31+
32+
- Hook output rewritten to use f-strings instead of `.format()`.
33+
1734
## [1.15.0] - 2024-02-11
1835

1936
### Added
2037

21-
- Now validates that all XML `<result>` tags are closed in Jamf extension attributes (#76, thanks to @WardsParadox).
38+
- Now validates that all XML `<result>` tags are closed in Jamf extension attributes. (#76, thanks to @WardsParadox)
2239

2340
### Fixed
2441

2542
- Fixed a bug in the `munki-makecatalogs` hook (#72, thanks to @kbrewersq).
26-
- Added optional `--munki-repo` parameter to `check-munki-pkgsinfo` and `munki-makecatalogs` hooks, in order to specify a path to your Munki repo. Useful for situations where the Munki repo is a subdirectory of the Git repo itself. (#73 and #74, thanks to @kbrewersq).
43+
- Added optional `--munki-repo` parameter to `check-munki-pkgsinfo` and `munki-makecatalogs` hooks, in order to specify a path to your Munki repo. Useful for situations where the Munki repo is a subdirectory of the Git repo itself. (#73 and #74, thanks to @kbrewersq)
2744

2845
## [1.14.1] - 2023-11-20
2946

@@ -35,8 +52,8 @@ Nothing yet.
3552

3653
### Added
3754

38-
- `check-preference-manifests` hook now outputs more specific error message if `pfm_documentation_url` is empty (#67, thanks to @relgit).
39-
- `check-munki-pkgsinfo` hook now detects path mismatches on case-sensitive filesystems (#66, thanks to @AaronBurchfield).
55+
- `check-preference-manifests` hook now outputs more specific error message if `pfm_documentation_url` is empty. (#67, thanks to @relgit)
56+
- `check-munki-pkgsinfo` hook now detects path mismatches on case-sensitive filesystems. (#66, thanks to @AaronBurchfield)
4057

4158
## [1.13.0] - 2023-11-18
4259

@@ -335,7 +352,8 @@ Nothing yet.
335352

336353
- Initial release
337354

338-
[Unreleased]: https://github.com/homebysix/pre-commit-macadmin/compare/v1.15.0...HEAD
355+
[Unreleased]: https://github.com/homebysix/pre-commit-macadmin/compare/v1.16.1...HEAD
356+
[1.16.1]: https://github.com/homebysix/pre-commit-macadmin/compare/v1.15.0...v1.16.1
339357
[1.15.0]: https://github.com/homebysix/pre-commit-macadmin/compare/v1.14.1...v1.15.0
340358
[1.14.1]: https://github.com/homebysix/pre-commit-macadmin/compare/v1.14.0...v1.14.1
341359
[1.14.0]: https://github.com/homebysix/pre-commit-macadmin/compare/v1.13.0...v1.14.0

README.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ For any hook in this repo you wish to use, add the following to your pre-commit
1515

1616
```yaml
1717
- repo: https://github.com/homebysix/pre-commit-macadmin
18-
rev: v1.15.0
18+
rev: v1.16.1
1919
hooks:
2020
- id: check-plists
2121
# - id: ...
@@ -32,10 +32,6 @@ After adding a hook to your pre-commit config, it's not a bad idea to run `pre-c
3232
This hook checks to ensure the Git config email matches one of the specified domains:
3333
`args: ['--domains', 'pretendco.com', 'contoso.com', '--']`
3434

35-
- __check-plists__
36-
37-
This hook checks XML property list (plist) files for basic syntax errors.
38-
3935
- __check-munkipkg-buildinfo__
4036

4137
This hook checks [MunkiPkg](https://github.com/munki/munki-pkg) build-info files to ensure they are valid.
@@ -44,6 +40,16 @@ After adding a hook to your pre-commit config, it's not a bad idea to run `pre-c
4440

4541
This hook checks [Outset](https://github.com/chilcote/outset) scripts to ensure they're executable.
4642

43+
- __check-plists__
44+
45+
This hook checks XML property list (plist) files for basic syntax errors. Does not modify or autoformat these files; see the `format-xml-plist` hook below if you want autoformatting.
46+
47+
- __format-xml-plist__
48+
49+
This hook will auto-format XML property list (plist) files to use tabs instead of spaces, and will alphabetically sort keys.
50+
51+
__NOTE__: This will remove any HTML-style comments `<!--like this-->` in your plist files, so convert those to `<key>Comment</key>` format first.
52+
4753
### [AutoPkg](https://github.com/autopkg/autopkg)
4854

4955
- __check-autopkg-recipe-list__
@@ -135,7 +141,7 @@ When combining arguments that take lists (for example: `--required-keys`, `--cat
135141

136142
```yaml
137143
- repo: https://github.com/homebysix/pre-commit-macadmin
138-
rev: v1.15.0
144+
rev: v1.16.1
139145
hooks:
140146
- id: check-munki-pkgsinfo
141147
args: ['--catalogs', 'testing', 'stable', '--']
@@ -145,7 +151,7 @@ But if you also use the `--categories` argument, you would move the trailing `--
145151

146152
```yaml
147153
- repo: https://github.com/homebysix/pre-commit-macadmin
148-
rev: v1.15.0
154+
rev: v1.16.1
149155
hooks:
150156
- id: check-munki-pkgsinfo
151157
args: ['--catalogs', 'testing', 'stable', '--categories', 'Design', 'Engineering', 'Web Browsers', '--']
@@ -157,7 +163,7 @@ If it looks better to your eye, feel free to use a multi-line list for long argu
157163

158164
```yaml
159165
- repo: https://github.com/homebysix/pre-commit-macadmin
160-
rev: v1.15.0
166+
rev: v1.16.1
161167
hooks:
162168
- id: check-munki-pkgsinfo
163169
args: [

pre_commit_hooks/check_autopkg_recipe_list.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def main(argv=None):
4848
with open(filename, "rb") as openfile:
4949
recipe_list = plistlib.load(openfile).get("recipes")
5050
except (ExpatError, ValueError) as err:
51-
print("{}: plist parsing error: {}".format(filename, err))
51+
print(f"{filename}: plist parsing error: {err}")
5252
retval = 1
5353
elif filename.endswith((".yaml", ".yml")):
5454
# AutoPkg does not support YAML recipe lists, but AutoPkg users
@@ -57,7 +57,7 @@ def main(argv=None):
5757
with open(filename, "r", encoding="utf-8") as openfile:
5858
recipe_list = yaml.load(openfile)
5959
except Exception as err:
60-
print("{}: yaml parsing error: {}".format(filename, err))
60+
print(f"{filename}: yaml parsing error: {err}")
6161
retval = 1
6262
elif filename.endswith(".json"):
6363
# AutoPkg does not support JSON recipe lists, but AutoPkg users
@@ -66,11 +66,11 @@ def main(argv=None):
6666
with open(filename, "r", encoding="utf-8") as openfile:
6767
recipe_list = json.load(openfile)
6868
except Exception as err:
69-
print("{}: json parsing error: {}".format(filename, err))
69+
print(f"{filename}: json parsing error: {err}")
7070
retval = 1
7171

7272
if not recipe_list or not isinstance(recipe_list, list):
73-
print("{}: invalid recipe list".format(filename))
73+
print(f"{filename}: invalid recipe list")
7474
retval = 1
7575
else:
7676
if any((".munki" in recipe for recipe in recipe_list)):

0 commit comments

Comments
 (0)