Commit 3b6a18fdec

3b6a18fdecb57e75009a7adcbc0c83c5c8d1f214

parent: acd153fd22

Unsigned

Alicia Sykes <alicia@omg.lol> · 2026-02-23 21:53 UTC

Updates contributing and PR checks

Layout: unified · split

.github/CONTRIBUTING.md +5 −8
@@ -19,7 +19,7 @@
1919You can add, edit or remove entries by opening a pull request.
2020
2121All data is stored in [`awesome-privacy.yml`](https://github.com/Lissy93/awesome-privacy/blob/main/awesome-privacy.yml).
22If you're adding, editing or removing a listing - **this is the only file you need to edit**.
22If you're adding, editing or removing a listing - **this is the only file you need to edit**. Don't edit the README directly, as this is auto-generated from the YAML file.
2323
2424### Process
2525
@@ -74,12 +74,11 @@ Usually these entries go within the "Notable Mentions" section instead._
7474
7575Your pull request must follow these requirements. Failure to do so, might result in it being closed.
7676
77- Do not edit the README directly when adding / editing a listing
77- Do not edit the README directly when adding / editing a listing (it's auto-generated!)
7878- Ensure your PR is not a duplicate, search for existing / previous submissions first
79- You must respond to any comments or requests for changes in a timely manner, 48-hours maximum
79- You must respond to any comments or requests for changes in a timely manner, 14 days maximum
8080- Write short but descriptive git commit messages, under 50 characters. This must be in the format of `Adds [software-name] to [section-name]`. Your PR will be rejected if you name it `Updates README.md`
8181- Only include a single addition / amendment / removal, per pull request
82- If your pull request contains multiple commits, you must squash them first
8382- You must complete each of the sections in the pull request template. Do not delete it!
8483- Where applicable, include links to supporting material for your addition: git repo, docs, recent security audits, etc. This will make researching it much easier for reviewers
8584- While adding new software to the list, don't make your entry read like an advert. Be objective, and include drawbacks as well as strengths
@@ -90,8 +89,8 @@ Your pull request must follow these requirements. Failure to do so, might result
9089- You must adhere to the Contributor Covenant Code of Conduct
9190- Don't open a Draft / WIP pull request while you work on the guidelines. A pull request should be 100% ready and should adhere to all the above guidelines when you open it
9291- Your changes must be correctly spelled, and with good grammar
93- Your changes must be correctly formatted, in valid markdown
94- The addition title must be a link the project, and in bold
92- Your changes must be correctly formatted, in valid yaml and markdown
93- The addition title must be a link the project
9594- The addition description must be no less than 50, and no more than 250 characters, keep it clear and to the point
9695
9796---
@@ -103,8 +102,6 @@ This file may look a bit daunting to start with, but don't worry - it's pretty s
103102
104103### Top-Level Structure
105104
106
107
108105```mermaid
109106---
110107title: Class Diagram
lib/checks/check-additions.py +106 −2
@@ -35,6 +35,22 @@ OPENSOURCE_MSG = (
3535 f" [Requirements]({CONTRIBUTING}#requirements)."
3636 " Please ensure that this is justified in your PR body."
3737)
38DUPLICATE_NAME_MSG = (
39 "A service named `{name}` already exists (in {location})."
40 " If this is a different service, please clarify in your PR description"
41)
42DUPLICATE_URL_MSG = (
43 "The URL `{url}` is already associated with `{existing}`."
44 " Please check this isn't a duplicate submission"
45)
46DESC_LENGTH_MSG = (
47 "Description length ({length} chars) is outside the recommended 50\u2013250"
48 f" character range. Please see our [Contributing Guidelines]({CONTRIBUTING}#description)"
49)
50OPENSOURCE_GITHUB_MSG = (
51 "You marked this service as open source but didn't include a `github` field."
52 " Please add the repository link"
53)
3854
3955
4056def load_json(path):
@@ -81,7 +97,7 @@ def check_required_fields(diff, head):
8197 for svc in diff.get("services", {}).get("added", []):
8298 fields = svc.get("fields", {})
8399 for f in REQUIRED_FIELDS:
84 if not fields.get(f):
100 if fields.get(f) is None:
85101 missing.add(f)
86102 for svc in diff.get("services", {}).get("modified", []):
87103 if not head:
@@ -92,7 +108,7 @@ def check_required_fields(diff, head):
92108 )
93109 if fields:
94110 for f in REQUIRED_FIELDS:
95 if f in changed and not fields.get(f):
111 if f in changed and fields.get(f) is None:
96112 missing.add(f)
97113 if missing:
98114 names = ", ".join(f"`{f}`" for f in sorted(missing))
@@ -133,6 +149,75 @@ def check_single_entry(diff):
133149 return None
134150
135151
152def build_name_index(head):
153 """Build {lowercase_name: "category > section"} from all services."""
154 index = {}
155 if not head:
156 return index
157 for cat in head.get("categories", []):
158 cn = cat.get("name", "")
159 for sec in cat.get("sections", []):
160 sn = sec.get("name", "")
161 for svc in sec.get("services", []):
162 name = svc.get("name", "").lower().strip()
163 if name:
164 index[name] = f"{cn} > {sn}"
165 return index
166
167
168def build_url_index(head):
169 """Build {url: service_name} from all services, skipping empty URLs."""
170 index = {}
171 if not head:
172 return index
173 for cat in head.get("categories", []):
174 for sec in cat.get("sections", []):
175 for svc in sec.get("services", []):
176 url = svc.get("url", "")
177 if url:
178 index[url] = svc.get("name", "")
179 return index
180
181
182def check_duplicate_name(diff, name_index):
183 """Return a finding if an added service name already exists in the YAML."""
184 for svc in diff.get("services", {}).get("added", []):
185 name = svc.get("fields", {}).get("name", "").lower().strip()
186 if name and name in name_index:
187 return DUPLICATE_NAME_MSG.format(
188 name=svc["fields"]["name"], location=name_index[name],
189 )
190 return None
191
192
193def check_duplicate_url(diff, url_index):
194 """Return a finding if an added service URL already exists in the YAML."""
195 for svc in diff.get("services", {}).get("added", []):
196 url = svc.get("fields", {}).get("url", "")
197 if url and url in url_index:
198 return DUPLICATE_URL_MSG.format(url=url, existing=url_index[url])
199 return None
200
201
202def check_description_length(diff):
203 """Return a finding if an added service description is outside 50-250 chars."""
204 for svc in diff.get("services", {}).get("added", []):
205 desc = svc.get("fields", {}).get("description", "")
206 length = len(desc)
207 if length < 50 or length > 250:
208 return DESC_LENGTH_MSG.format(length=length)
209 return None
210
211
212def check_opensource_github(diff):
213 """Return a finding if an added service is open source but has no github field."""
214 for svc in diff.get("services", {}).get("added", []):
215 fields = svc.get("fields", {})
216 if fields.get("openSource") is True and not fields.get("github"):
217 return OPENSOURCE_GITHUB_MSG
218 return None
219
220
136221def main():
137222 findings = []
138223 try:
@@ -158,6 +243,25 @@ def main():
158243 finding = check_open_source(diff)
159244 if finding:
160245 findings.append(finding)
246
247 name_index = build_name_index(head)
248 url_index = build_url_index(head)
249
250 finding = check_duplicate_name(diff, name_index)
251 if finding:
252 findings.append(finding)
253
254 finding = check_duplicate_url(diff, url_index)
255 if finding:
256 findings.append(finding)
257
258 finding = check_description_length(diff)
259 if finding:
260 findings.append(finding)
261
262 finding = check_opensource_github(diff)
263 if finding:
264 findings.append(finding)
161265 except Exception:
162266 pass
163267
lib/checks/check-project.py +16 −6
@@ -126,21 +126,31 @@ def get_services(diff, key):
126126
127127
128128def check_links(diff, head):
129 """Return LINK_MSG if any service URL is unreachable."""
129 """Return LINK_MSG if any service URL or icon URL is unreachable."""
130130 for svc in get_services(diff, "added"):
131 url = svc.get("fields", {}).get("url")
131 fields = svc.get("fields", {})
132 url = fields.get("url")
132133 if url and not check_url(url):
133134 return LINK_MSG
135 icon = fields.get("icon")
136 if icon and not check_url(icon):
137 return LINK_MSG
134138 for svc in get_services(diff, "modified"):
135 if "url" not in svc.get("changed_fields", []):
139 changed = svc.get("changed_fields", [])
140 if "url" not in changed and "icon" not in changed:
136141 continue
137142 head_svc = find_service_in_head(
138143 head, svc["category"], svc["section"], svc["service"]
139144 )
140145 if head_svc:
141 url = head_svc.get("url")
142 if url and not check_url(url):
143 return LINK_MSG
146 if "url" in changed:
147 url = head_svc.get("url")
148 if url and not check_url(url):
149 return LINK_MSG
150 if "icon" in changed:
151 icon = head_svc.get("icon")
152 if icon and not check_url(icon):
153 return LINK_MSG
144154 return None
145155
146156
lib/checks/check-yaml-diff.py +8 −6
@@ -187,16 +187,18 @@ def main():
187187 write_github_output("has_service_changes", str(bool(added or removed or modified)).lower())
188188 write_step_summary(diff_result)
189189
190 svc_count = len(added) + len(removed) + len(modified)
191 if svc_count > 1:
192 print(red(f"Single-entry rule violation: {svc_count} service changes found."), file=sys.stderr)
190 added_count = len(added)
191 if added_count > 1:
192 print(red(f"Single-entry rule violation: {added_count} service additions found."), file=sys.stderr)
193193 sys.exit(EXIT_RULE_VIOLATION)
194 if svc_count == 0 and len(sections) > 1:
194 if added_count == 0 and len(sections) > 1:
195195 print(red(f"Single-entry rule violation: {len(sections)} section changes found."), file=sys.stderr)
196196 sys.exit(EXIT_RULE_VIOLATION)
197197
198 print(green(f"Single-entry rule passed. {svc_count} service, "
199 f"{len(sections)} section, {len(categories)} category change(s)."))
198 total = len(added) + len(removed) + len(modified)
199 print(green(f"Single-entry rule passed. {total} service "
200 f"({added_count} added), {len(sections)} section, "
201 f"{len(categories)} category change(s)."))
200202 sys.exit(EXIT_PASS)
201203
202204