Fix linting errors in AUTHORS.md

This commit is contained in:
Roland Geider
2025-04-26 09:21:12 +02:00
parent 7970afd2bf
commit e42dacdc41
3 changed files with 19 additions and 11 deletions

2
.gitignore vendored
View File

@@ -83,7 +83,7 @@ venv-wger
/extras/docker/open-food-facts/dump/*.tar.gz
/extras/docker/open-food-facts/dump/off/*
/extras/authors/commits_cache/
/extras/authors/*.md
/extras/authors/*-AUTHORS.md
/extras/scripts/*.json
# macOS

View File

@@ -24,7 +24,7 @@ Thank you all for contributing to the project, you are true heroes! 🫶
- JLaField - [https://github.com/JLaField](https://github.com/JLaField)
- bbk - [https://github.com/bbkz](https://github.com/bbkz)
- Maniues - [https://github.com/Maniues](https://github.com/Maniues)
- ebwinters@comcast.net - [https://github.com/ebwinters](https://github.com/ebwinters)
- <ebwinters [at] comcast.net> - [https://github.com/ebwinters](https://github.com/ebwinters)
- Roelof Rietbroek - [https://github.com/strawpants](https://github.com/strawpants)
- bbkz - [https://github.com/bbkz](https://github.com/bbkz)
- Jayanth Bontha - [https://github.com/JayanthBontha](https://github.com/JayanthBontha)
@@ -81,7 +81,7 @@ Thank you all for contributing to the project, you are true heroes! 🫶
- Noah Pinter - [https://github.com/nopinter](https://github.com/nopinter)
- Harlene Samra - [https://github.com/harlenesamra](https://github.com/harlenesamra)
- Noah Pinter - [https://github.com/nopinter](https://github.com/nopinter)
- justinec@unix.andrew.cmu.edu - [https://github.com/jcho17](https://github.com/jcho17)
- <justinec [at] unix.andrew.cmu.edu> - [https://github.com/jcho17](https://github.com/jcho17)
- derekli - [https://github.com/derekli17](https://github.com/derekli17)
- Austin Leung - [https://github.com/austin-leung](https://github.com/austin-leung)
- ryowright - [https://github.com/ryowright](https://github.com/ryowright)

View File

@@ -112,6 +112,9 @@ def extract_contributors(repo_name, github_token):
if 'github-actions' in author_name:
continue
if '@' in author_name:
author_name = f"<{author_name.replace('@', ' [at] ')}>"
if 'Translated using Weblate' in commit_message:
language_match = re.search(r'Translated using Weblate \((.+)\)', commit_message)
if language_match:
@@ -133,11 +136,15 @@ def extract_contributors(repo_name, github_token):
return contributors, translators
def generate_markdown(data: dict) -> str:
def generate_markdown(data: dict) -> str | None:
"""Generate the markdown for a single contributor or translator."""
profile = f'https://github.com/{data.get("username", "")}'
entry = f'{data["name"]} - [{profile}]({profile})' if data['username'] else data['name']
if entry == '':
return None
return f'- {entry}\n'
@@ -151,25 +158,26 @@ def generate_authors_file(
f.write('# Contributors and translators to this repository\n\n')
f.write('Thank you all for contributing to the project, you are true heroes! 🫶\n\n')
f.write('> [!NOTE] \n')
f.write('> This file is automatically generated do not edit by hand.\n\n')
f.write('## Contributors\n\n')
if contributors:
for author_email, data in contributors.items():
f.write(generate_markdown(data))
entry = generate_markdown(data)
if entry:
f.write(entry)
else:
f.write('No contributors found.\n')
f.write('\n## Translators\n\n')
f.write('\n## Translators\n')
if translators:
for language, translator_data in translators.items():
f.write('\n')
f.write(f'### {language}\n\n')
for author_email, data in translator_data.items():
f.write(generate_markdown(data))
entry = generate_markdown(data)
if entry:
f.write(entry)
else:
f.write('No translators found.\n')
f.write('\nNo translators found.\n')
print(f'{filename} generated successfully.')