Skip to content

Commit 26bd432

Browse files
authored
Merge pull request #70 from homebysix/1.14.0
1.14.0 merge to main
2 parents 2ad7bf8 + 6df6b49 commit 26bd432

5 files changed

Lines changed: 54 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ All notable changes to this project will be documented in this file. This projec
1414

1515
Nothing yet.
1616

17+
## [1.14.0] - 2023-11-19
18+
19+
### Added
20+
21+
- `check-preference-manifests` hook now outputs more specific error message if `pfm_documentation_url` is empty (#67, thanks to @relgit).
22+
- `check-munki-pkgsinfo` hook now detects path mismatches on case-sensitive filesystems (#66, thanks to @AaronBurchfield).
23+
1724
## [1.13.0] - 2023-11-18
1825

1926
### Changed

README.md

Lines changed: 4 additions & 4 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.13.0
18+
rev: v1.14.0
1919
hooks:
2020
- id: check-plists
2121
# - id: ...
@@ -121,7 +121,7 @@ When combining arguments that take lists (for example: `--required-keys`, `--cat
121121

122122
```yaml
123123
- repo: https://github.com/homebysix/pre-commit-macadmin
124-
rev: v1.13.0
124+
rev: v1.14.0
125125
hooks:
126126
- id: check-munki-pkgsinfo
127127
args: ['--catalogs', 'testing', 'stable', '--']
@@ -131,7 +131,7 @@ But if you also use the `--categories` argument, you would move the trailing `--
131131

132132
```yaml
133133
- repo: https://github.com/homebysix/pre-commit-macadmin
134-
rev: v1.13.0
134+
rev: v1.14.0
135135
hooks:
136136
- id: check-munki-pkgsinfo
137137
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
143143

144144
```yaml
145145
- repo: https://github.com/homebysix/pre-commit-macadmin
146-
rev: v1.13.0
146+
rev: v1.14.0
147147
hooks:
148148
- id: check-munki-pkgsinfo
149149
args: [

pre_commit_hooks/check_munki_pkgsinfo.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import argparse
66
import os
77
import plistlib
8+
from pathlib import Path
89
from xml.parsers.expat import ExpatError
910

1011
from pre_commit_hooks.util import (
@@ -37,6 +38,22 @@ def build_argument_parser():
3738
return parser
3839

3940

41+
def _check_case_sensitive_path(path):
42+
# Return immediately if the file does not exist
43+
if not os.path.exists(path):
44+
return False
45+
46+
p = Path(path)
47+
while True:
48+
# At root, p == p.parent --> break loop and return True
49+
if p == p.parent:
50+
return True
51+
# If string representation of path is not in parent directory, return False
52+
if str(p) not in map(str, p.parent.iterdir()):
53+
return False
54+
p = p.parent
55+
56+
4057
def main(argv=None):
4158
"""Main process."""
4259

@@ -114,6 +131,22 @@ def main(argv=None):
114131
)
115132
retval = 1
116133

134+
# Check for missing installer items
135+
if all(
136+
(
137+
"installer_item_location" in pkginfo,
138+
not _check_case_sensitive_path(
139+
os.path.join("pkgs", pkginfo.get("installer_item_location"))
140+
),
141+
)
142+
):
143+
print(
144+
"{}: installer item does not exist or path is not case sensitive".format(
145+
filename
146+
)
147+
)
148+
retval = 1
149+
117150
# Check for pkg filenames showing signs of duplicate imports.
118151
if pkginfo.get("installer_item_location", "").endswith(tuple(dupe_suffixes)):
119152
print(

pre_commit_hooks/check_preference_manifests.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,15 @@ def validate_urls(subkey, filename):
324324
url_keys = ("pfm_app_url", "pfm_documentation_url")
325325
for url_key in url_keys:
326326
if url_key in subkey:
327-
if not subkey[url_key].startswith("http"):
327+
if len(subkey[url_key]) == 0:
328+
print(
329+
"{}: {} URL value is empty.".format(
330+
filename,
331+
url_key,
332+
)
333+
)
334+
passed = False
335+
elif not subkey[url_key].startswith("http"):
328336
print(
329337
"{}: {} value doesn't look like a URL: {}".format(
330338
filename,

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
name="pre-commit-macadmin",
88
description="Pre-commit hooks for Mac admins, client engineers, and IT consultants.",
99
url="https://github.com/homebysix/pre-commit-macadmin",
10-
version="1.13.0",
10+
version="1.14.0",
1111
author="Elliot Jordan",
1212
author_email="elliot@elliotjordan.com",
1313
packages=["pre_commit_hooks"],

0 commit comments

Comments
 (0)