mirror of
https://github.com/mustbeperfect/definitive-opensource.git
synced 2026-04-20 15:55:44 +02:00
Ran ruff format
This commit is contained in:
@@ -16,7 +16,7 @@ issues_report = []
|
||||
|
||||
for app in applications:
|
||||
app_issues = []
|
||||
|
||||
|
||||
github_url = app.get("repo_url", "").strip()
|
||||
if not github_url:
|
||||
app_issues.append("Missing GitHub URL")
|
||||
@@ -24,13 +24,13 @@ for app in applications:
|
||||
app_issues.append("Duplicate GitHub URL")
|
||||
else:
|
||||
seen_github.add(github_url)
|
||||
|
||||
|
||||
category = app.get("category", "").lower()
|
||||
if not category:
|
||||
app_issues.append("Missing category")
|
||||
elif category not in valid_categories:
|
||||
app_issues.append(f"Invalid category '{category}'")
|
||||
|
||||
|
||||
platforms = [p.lower() for p in app.get("platforms", [])]
|
||||
if not platforms:
|
||||
app_issues.append("Missing platform")
|
||||
@@ -38,12 +38,11 @@ for app in applications:
|
||||
invalid_platforms = [p for p in platforms if p not in valid_platforms]
|
||||
if invalid_platforms:
|
||||
app_issues.append(f"Invalid platforms: {', '.join(invalid_platforms)}")
|
||||
|
||||
|
||||
if app_issues:
|
||||
issues_report.append({
|
||||
"name": app.get("name", "Unnamed Project"),
|
||||
"issues": app_issues
|
||||
})
|
||||
issues_report.append(
|
||||
{"name": app.get("name", "Unnamed Project"), "issues": app_issues}
|
||||
)
|
||||
|
||||
with open("resources/maintenance/format_maintenance.md", "w") as f:
|
||||
f.write("# Format Maintenance Report\n\n")
|
||||
|
||||
@@ -3,60 +3,63 @@ import requests
|
||||
import json
|
||||
from datetime import datetime
|
||||
|
||||
with open('core/data/dynamic/applications.json', 'r') as f:
|
||||
with open("core/data/dynamic/applications.json", "r") as f:
|
||||
data = json.load(f)
|
||||
|
||||
GITHUB_TOKEN = os.getenv('GITHUB_TOKEN')
|
||||
GITHUB_TOKEN = os.getenv("GITHUB_TOKEN")
|
||||
|
||||
headers = {
|
||||
'Authorization': f'token {GITHUB_TOKEN}',
|
||||
'Accept': 'application/vnd.github.v3+json'
|
||||
"Authorization": f"token {GITHUB_TOKEN}",
|
||||
"Accept": "application/vnd.github.v3+json",
|
||||
}
|
||||
|
||||
|
||||
def update_application_data(app):
|
||||
|
||||
repo_name = app["repo_url"].split("github.com/")[1]
|
||||
|
||||
|
||||
repo_url = f'https://api.github.com/repos/{repo_name}'
|
||||
repo_url = f"https://api.github.com/repos/{repo_name}"
|
||||
|
||||
print(f"Updating: {repo_name}")
|
||||
print(f"API URL: {repo_url}")
|
||||
|
||||
|
||||
response = requests.get(repo_url, headers=headers)
|
||||
|
||||
if response.status_code == 200:
|
||||
repo_data = response.json()
|
||||
|
||||
app['stars'] = repo_data.get('stargazers_count', app['stars'])
|
||||
app['language'] = repo_data.get('language', app['language'])
|
||||
app["stars"] = repo_data.get("stargazers_count", app["stars"])
|
||||
app["language"] = repo_data.get("language", app["language"])
|
||||
|
||||
if 'custom-homepage' not in app.get('flags', []):
|
||||
app['homepage_url'] = repo_data.get('homepage', app['homepage_url'])
|
||||
if "custom-homepage" not in app.get("flags", []):
|
||||
app["homepage_url"] = repo_data.get("homepage", app["homepage_url"])
|
||||
|
||||
if 'custom-description' not in app.get('flags', []):
|
||||
app['description'] = repo_data.get('description', app.get('description'))
|
||||
|
||||
if 'custom-license' not in app.get('flags', []):
|
||||
license_data = repo_data.get('license')
|
||||
if "custom-description" not in app.get("flags", []):
|
||||
app["description"] = repo_data.get("description", app.get("description"))
|
||||
|
||||
if "custom-license" not in app.get("flags", []):
|
||||
license_data = repo_data.get("license")
|
||||
if license_data is not None:
|
||||
app['license'] = license_data.get('spdx_id', app['license'])
|
||||
app["license"] = license_data.get("spdx_id", app["license"])
|
||||
else:
|
||||
app['license'] = app['license']
|
||||
|
||||
app['last_commit'] = datetime.strptime(repo_data['pushed_at'], '%Y-%m-%dT%H:%M:%SZ').strftime('%m/%d/%Y')
|
||||
app["license"] = app["license"]
|
||||
|
||||
app["last_commit"] = datetime.strptime(
|
||||
repo_data["pushed_at"], "%Y-%m-%dT%H:%M:%SZ"
|
||||
).strftime("%m/%d/%Y")
|
||||
|
||||
return app
|
||||
else:
|
||||
print(f"Error: Unable to fetch data for {repo_name}. Status Code: {response.status_code}")
|
||||
print(
|
||||
f"Error: Unable to fetch data for {repo_name}. Status Code: {response.status_code}"
|
||||
)
|
||||
print(f"Response: {response.text}")
|
||||
return app
|
||||
|
||||
for app in data['applications']:
|
||||
|
||||
for app in data["applications"]:
|
||||
app = update_application_data(app)
|
||||
|
||||
with open('core/data/dynamic/applications.json', 'w') as f:
|
||||
with open("core/data/dynamic/applications.json", "w") as f:
|
||||
json.dump(data, f, indent=4)
|
||||
|
||||
print("Updated application data successfully!")
|
||||
|
||||
Reference in New Issue
Block a user