Commit 22fef8fe69
22fef8fe69c80501f2fdbd1248fecdc8edba5b83
parent: d91840f418
Unsigned
Alicia Sykes <alicia@omg.lol> · 2026-07-20 12:09 UTC
Better handling of null/empty values
Layout: unified · split
lib/checks/check-pr-meta.py
+1 −1
| @@ -50,7 +50,7 @@ MISSING_TYPE_MSG = ( |
| 50 | ) |
50 | ) |
| 51 | |
51 | |
| 52 | _VALID_TYPES = re.compile( |
52 | _VALID_TYPES = re.compile( |
| 53 | r"addition|amendment|removal|spelling|grammar|website|lib|ci|api|misc|other", |
53 | r"addition|amendment|removal|spelling|grammar|website|scripts|lib|ci|api|misc|other", |
| 54 | re.IGNORECASE, |
54 | re.IGNORECASE, |
| 55 | ) |
55 | ) |
| 56 | |
56 | |
lib/checks/check-yaml-diff.py
+3 −3
| @@ -57,12 +57,12 @@ def write_github_output(name, value): |
| 57 | def find_duplicate_names(data): |
57 | def find_duplicate_names(data): |
| 58 | """Find duplicate service names within the same section.""" |
58 | """Find duplicate service names within the same section.""" |
| 59 | duplicates = [] |
59 | duplicates = [] |
| 60 | for cat in data.get("categories", []): |
60 | for cat in data.get("categories") or []: |
| 61 | cn = cat.get("name", "") |
61 | cn = cat.get("name", "") |
| 62 | for sec in cat.get("sections", []): |
62 | for sec in cat.get("sections") or []: |
| 63 | sn = sec.get("name", "") |
63 | sn = sec.get("name", "") |
| 64 | seen = {} |
64 | seen = {} |
| 65 | for svc in sec.get("services", []): |
65 | for svc in sec.get("services") or []: |
| 66 | name = svc.get("name", "") |
66 | name = svc.get("name", "") |
| 67 | if name in seen: |
67 | if name in seen: |
| 68 | duplicates.append((cn, sn, name)) |
68 | duplicates.append((cn, sn, name)) |
lib/checks/make-info-stats.py
+2 −2
| @@ -403,7 +403,7 @@ def grade_website_stats(data, url, has_security_txt): |
| 403 | |
403 | |
| 404 | def fetch_android_data(package_id): |
404 | def fetch_android_data(package_id): |
| 405 | """Fetch Android app privacy data.""" |
405 | """Fetch Android app privacy data.""" |
| 406 | package_id = package_id.split("id=")[-1] if "id=" in package_id else package_id |
406 | package_id = (package_id.split("id=")[-1] if "id=" in package_id else package_id).split("&")[0] |
| 407 | data = _enrich_get(f"android/{package_id}") |
407 | data = _enrich_get(f"android/{package_id}") |
| 408 | return data if data and not data.get("error") else None |
408 | return data if data and not data.get("error") else None |
| 409 | |
409 | |
| @@ -450,7 +450,7 @@ def fetch_ios_data(app_url): |
| 450 | """Fetch iOS app info, extracting the numeric id and country from the store URL.""" |
450 | """Fetch iOS app info, extracting the numeric id and country from the store URL.""" |
| 451 | if not app_url: |
451 | if not app_url: |
| 452 | return None |
452 | return None |
| 453 | id_match = re.search(r"id(\d+)", app_url) |
453 | id_match = re.search(r"/id(\d+)", app_url) |
| 454 | if not id_match: |
454 | if not id_match: |
| 455 | return None |
455 | return None |
| 456 | country_match = re.search(r"apps\.apple\.com/([a-z]{2})/", app_url) |
456 | country_match = re.search(r"apps\.apple\.com/([a-z]{2})/", app_url) |
lib/checks/prepare-comment.py
+2 −2
| @@ -50,7 +50,7 @@ def read_findings_count(new_body): |
| 50 | def _was_already_passing(existing_body): |
50 | def _was_already_passing(existing_body): |
| 51 | """Check if the most recent state in the comment is already all-clear.""" |
51 | """Check if the most recent state in the comment is already all-clear.""" |
| 52 | # If there's a previous "all passing" edit, the last state was passing |
52 | # If there's a previous "all passing" edit, the last state was passing |
| 53 | if re.search(r"^(?:\*\*)?Edit(?: \d+)?(?:\*\*)?: (?:- )?All checks are (now passing|passing now)", existing_body, re.MULTILINE): |
53 | if re.search(r"^(?:\*\*)?Edit(?: \d+)?:(?:\*\*)? (?:- )?All checks are (now passing|passing now)", existing_body, re.MULTILINE): |
| 54 | return True |
54 | return True |
| 55 | # If there are no edits at all, check the original comment body |
55 | # If there are no edits at all, check the original comment body |
| 56 | if not re.search(r"^(?:\*\*)?Edit(?: \d+)?(?:\*\*)?:", existing_body, re.MULTILINE): |
56 | if not re.search(r"^(?:\*\*)?Edit(?: \d+)?(?:\*\*)?:", existing_body, re.MULTILINE): |
| @@ -61,7 +61,7 @@ def _was_already_passing(existing_body): |
| 61 | def _previous_failing_count(existing_body): |
61 | def _previous_failing_count(existing_body): |
| 62 | """Extract the findings count from the most recent state in the comment.""" |
62 | """Extract the findings count from the most recent state in the comment.""" |
| 63 | # Check edit lines first (most recent state) |
63 | # Check edit lines first (most recent state) |
| 64 | matches = re.findall(r"^(?:\*\*)?Edit(?: \d+)?(?:\*\*)?: (?:- )?(\d+) checks? (?:is|are) still failing", existing_body, re.MULTILINE) |
64 | matches = re.findall(r"^(?:\*\*)?Edit(?: \d+)?:(?:\*\*)? (?:- )?(?:\d+ issues? (?:was|were) resolved, but )?(\d+) checks? (?:is|are) still failing", existing_body, re.MULTILINE) |
| 65 | if matches: |
65 | if matches: |
| 66 | return int(matches[-1]) |
66 | return int(matches[-1]) |
| 67 | # No edits — count bullets in the original comment (before <details>) |
67 | # No edits — count bullets in the original comment (before <details>) |
lib/utils/data.py
+1 −1
| @@ -31,6 +31,6 @@ def slugify(title): |
| 31 | if not title: |
31 | if not title: |
| 32 | return "" |
32 | return "" |
| 33 | title = title.lower() |
33 | title = title.lower() |
| 34 | title = re.sub(r"\s", "-", title) |
34 | title = re.sub(r"\s+", "-", title) |
| 35 | title = re.sub(r"[+&]", "and", title) |
35 | title = re.sub(r"[+&]", "and", title) |
| 36 | return title.replace("?", "") |
36 | return title.replace("?", "") |