Commit eaf354113b

eaf354113bf27200636a154d0acd74ddb7ea76c6

parent: 41b885e5f4

Unsigned

Alicia Sykes <alicia@omg.lol> · 2026-10-11 21:34 UTC

Raises warning if mass-change attempted

Layout: unified · split

.github/CONTRIBUTING.md +1
@@ -285,6 +285,7 @@ Below is the full list of checks - it's basically the same as what is listed in
285- **Validating Addition** 285- **Validating Addition**
286 - 🔴 **Schema valid** - YAML must pass schema validation 286 - 🔴 **Schema valid** - YAML must pass schema validation
287 - 🔴 **Required fields** - Must include `name`, `description`, `url`, `icon` 287 - 🔴 **Required fields** - Must include `name`, `description`, `url`, `icon`
288 - 🔴 **No mass changes** - Must not remove more than 5, or modify more than 10, existing listings
288 - 🟡 **Single entry** - Only one service addition per PR 289 - 🟡 **Single entry** - Only one service addition per PR
289 - 🟡 **Position** - New entries must go at the end of their section 290 - 🟡 **Position** - New entries must go at the end of their section
290 - 🟡 **Open source** - Non-open-source submissions need justification 291 - 🟡 **Open source** - Non-open-source submissions need justification
lib/checks/check-additions.py +19
@@ -19,6 +19,8 @@ DIFF_PATH = "/tmp/pr-diff.json"
19FINDINGS_PATH = "/tmp/findings-data.json" 19FINDINGS_PATH = "/tmp/findings-data.json"
20SCHEMA_ERRORS_PATH = "/tmp/schema-errors.json" 20SCHEMA_ERRORS_PATH = "/tmp/schema-errors.json"
21MAX_SCHEMA_ERRORS_SHOWN = 10 21MAX_SCHEMA_ERRORS_SHOWN = 10
22MAX_REMOVED_LISTINGS = 5
23MAX_MODIFIED_LISTINGS = 10
22 24
23REQUIRED_FIELDS = ("name", "description", "url", "icon") 25REQUIRED_FIELDS = ("name", "description", "url", "icon")
24REPO_FIELDS = ("github", "codeberg", "git") 26REPO_FIELDS = ("github", "codeberg", "git")
@@ -31,6 +33,12 @@ SCHEMA_MSG = (
31 " additional and that it is following valid YAML syntax" 33 " additional and that it is following valid YAML syntax"
32) 34)
33MULTIPLE_MSG = "Please make just one addition per pull request" 35MULTIPLE_MSG = "Please make just one addition per pull request"
36MASS_CHANGE_MSG = (
37 "This PR removes {removed} and modifies {modified} existing listings."
38 " Please revert any changes which are unrelated to your submission."
39 " This usually happens when `awesome-privacy.yml` has been accidentally"
40 " truncated or overwritten with an outdated copy"
41)
34MISSING_TPL = ( 42MISSING_TPL = (
35 "Did you include all required fields? Looks like {fields} is missing or" 43 "Did you include all required fields? Looks like {fields} is missing or"
36 f" invalid. Please see the [required fields]({CONTRIBUTING}#service-fields)" 44 f" invalid. Please see the [required fields]({CONTRIBUTING}#service-fields)"
@@ -165,6 +173,16 @@ def check_single_entry(diff):
165 return None 173 return None
166 174
167 175
176def check_mass_changes(diff):
177 """Return a finding if the diff removes or modifies too many existing services."""
178 services = diff.get("services", {})
179 removed = len(services.get("removed", []))
180 modified = len(services.get("modified", []))
181 if removed > MAX_REMOVED_LISTINGS or modified > MAX_MODIFIED_LISTINGS:
182 return MASS_CHANGE_MSG.format(removed=removed, modified=modified)
183 return None
184
185
168def _added_keys(diff): 186def _added_keys(diff):
169 """Build a set of (category, section, lowercase_name) for added services.""" 187 """Build a set of (category, section, lowercase_name) for added services."""
170 keys = set() 188 keys = set()
@@ -297,6 +315,7 @@ def main():
297 315
298 checks = [ 316 checks = [
299 ("single-entry", check_single_entry(diff), False), 317 ("single-entry", check_single_entry(diff), False),
318 ("mass-changes", check_mass_changes(diff), True),
300 ("required-fields", check_required_fields(diff, head), True), 319 ("required-fields", check_required_fields(diff, head), True),
301 ("position", check_position(diff, head), False), 320 ("position", check_position(diff, head), False),
302 ("open-source", check_open_source(diff), False), 321 ("open-source", check_open_source(diff), False),
lib/checks/check-project.py +1 −2
@@ -126,8 +126,7 @@ PRIVACY_GRADE_MSG = (
126 " indicating serious privacy concerns" 126 " indicating serious privacy concerns"
127) 127)
128WEB_TRACKERS_MSG = ( 128WEB_TRACKERS_MSG = (
129 "The website appears to load third-party trackers ({}), according to" 129 "The website appears to load third-party trackers ({})"
130 " DuckDuckGo's tracker list. Please confirm these are justified"
131) 130)
132 131
133 132