From 9169b43a8f7c01d09c683d9e6e81f4b3bd25ccdf Mon Sep 17 00:00:00 2001 From: Rishi Verma Date: Thu, 8 Feb 2024 11:52:42 -0800 Subject: [PATCH 1/2] Migrated leaderboard code and leaderboard over to nasa-ammos/slim-leaderboard --- README.md | 17 +++--- standards-compliance/README.md | 87 ----------------------------- standards-compliance/leaderboard.md | 80 -------------------------- standards-compliance/leaderboard.py | 73 ------------------------ 4 files changed, 10 insertions(+), 247 deletions(-) delete mode 100644 standards-compliance/README.md delete mode 100644 standards-compliance/leaderboard.md delete mode 100644 standards-compliance/leaderboard.py diff --git a/README.md b/README.md index f06d63d..0ed009c 100644 --- a/README.md +++ b/README.md @@ -26,23 +26,26 @@ This repository contains largely tickets and small scripts useful for project ma ## Features * Reports for project management +* Status of infusion of best practices * Project management issues / tickets * Scripts to aid in management ## Contents -* [Quick Start](#quick-start) -* [Changelog](#changelog) -* [FAQ](#frequently-asked-questions-faq) -* [Contributing Guide](#contributing) -* [License](#license) -* [Support](#support) +- [Features](#features) +- [Contents](#contents) +- [Quick Start](#quick-start) +- [Changelog](#changelog) +- [Frequently Asked Questions (FAQ)](#frequently-asked-questions-faq) +- [Contributing](#contributing) +- [License](#license) +- [Support](#support) ## Quick Start Try the following actions: - See our issue tickets -- View our standards-compliance statuses +- View our [leaderboard](https://github.com/NASA-AMMOS/slim-leaderboard/blob/main/examples/slim-unity-leaderboard.md) showing statuses of [SLIM best practices](https://nasa-ammos.github.io/slim/) infusion - View zenhub reports [DEPRECATED] ## Changelog diff --git a/standards-compliance/README.md b/standards-compliance/README.md deleted file mode 100644 index b5dc940..0000000 --- a/standards-compliance/README.md +++ /dev/null @@ -1,87 +0,0 @@ - -
- -
- -![logo](https://user-images.githubusercontent.com/3129134/163255685-857aa780-880f-4c09-b08c-4b53bf4af54d.png) - -

Standards Compliance Leaderboard

- - -
- -
Tool to generate a Markdown table of SLIM standards compliance.
- - - - -[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](code_of_conduct.md) [![SLIM](https://img.shields.io/badge/Best%20Practices%20from-SLIM-blue)](https://nasa-ammos.github.io/slim/) - - -This repository serves to create a leaderboard table for the Unity project, representing the compliance status of [SLIM best practices](https://nasa-ammos.github.io/slim/) and standards across Unity repositories. - -## Features - -* Script to query Unity repositories and create a markdown table showcasing SLIM standards compliance, sorted by leader, printed to standard out. -* Actual, generated compliance leaderboard table. -* API jittering to prevent too many fast requests to GitHub at once -* Logging to share the status of repository compliance as the script runs - -## Contents - -- [Features](#features) -- [Contents](#contents) -- [Quick Start](#quick-start) - - [Run Instructions](#run-instructions) -- [Changelog](#changelog) -- [Frequently Asked Questions (FAQ)](#frequently-asked-questions-faq) -- [Contributing](#contributing) -- [License](#license) -- [Support](#support) - -## Quick Start - -Use this quick start guide to generate a fresh leaderboard table. - -### Run Instructions - -Requirements: -* Python 3 -* `requests` module - -Setup: -- Generate a GitHub personal access token and replace the string `TOKEN_GOES_HERE` with the value of your token. NOTE: make sure the "repo" group permission is enabled for your token within GitHub.com's personal access token setup. - -To generate a fresh leaderboard markdown table (printed to `stdout`), run the following command: - -``` -python leaderboard.py -``` - -You'll see an output similar to the contents of [leaderboard.md](leaderboard.md) - -How to interpret the leaderboard contents: -- A ✅ indicates successful compliance, where as a ❌ indicates not fully compliant -- Most checks verify whether files within your repository that should exist, do in fact exist. Some checks are more specialized, such as: - - "README" - checks if your README conforms to the [SLIM standard README](https://nasa-ammos.github.io/slim/docs/guides/documentation/readme/) - - "Dev/User Documentation" check for links to be present in your README that point to specific Dev or User docs - this is part of the SLIM standard README - -## Changelog - -See our root [CHANGELOG.md](../CHANGELOG.md) for a history of our changes. - -## Frequently Asked Questions (FAQ) - -None. Please post a PR to ask a question. - -## Contributing - -Interested in contributing to our project? Please see our: [CONTRIBUTING.md](../CONTRIBUTING.md) - -## License - -See our: [LICENSE](../LICENSE) - -## Support - -Key points of contact are: [@riverma](https://github.com/riverma) diff --git a/standards-compliance/leaderboard.md b/standards-compliance/leaderboard.md deleted file mode 100644 index 6d50d30..0000000 --- a/standards-compliance/leaderboard.md +++ /dev/null @@ -1,80 +0,0 @@ -## Table of Contents -- [Leaderboard Table](#leaderboard-table) - a ranked listing of Unity repositories in order of how many best practice / compliance checks have been met. -- [Repository Check Explanation](#repository-check-explanation) - detailed explanations for the logic used to generate an ✅, ☑️, or ❌ for each check. - - -## Leaderboard Table - -| Project | Repository | [Issue Templates](https://github.com/unity-sds/unity-repo-template/tree/main/.github/ISSUE_TEMPLATE) | [PR Templates](https://github.com/unity-sds/unity-repo-template/blob/main/.github/PULL_REQUEST_TEMPLATE.md) | [Code of Conduct](https://github.com/unity-sds/unity-repo-template/blob/main/CODE_OF_CONDUCT.md) | [Contributing Guide](https://github.com/unity-sds/unity-repo-template/blob/main/CONTRIBUTING.md) | [LICENSE](https://github.com/unity-sds/unity-repo-template/blob/main/LICENSE) | [README](https://github.com/unity-sds/unity-repo-template/blob/main/README.md) | [Change Log](https://github.com/unity-sds/unity-repo-template/blob/main/CHANGELOG.md) | [Link to Docs in README](https://github.com/unity-sds/unity-repo-template/blame/main/README.md#L29) | -|---|---|---|---|---|---|---|---|---|---| -| [unity-sds](https://github.com/unity-sds) | [unity-sps-workflows](https://github.com/unity-sds/unity-sps-workflows) | ✅ | ✅ | ✅ | ✅ | ✅ | ☑️ | ✅ | ✅ | -| [unity-sds](https://github.com/unity-sds) | [unity-sps-prototype](https://github.com/unity-sds/unity-sps-prototype) | ✅ | ✅ | ✅ | ✅ | ✅ | ☑️ | ✅ | ✅ | -| [unity-sds](https://github.com/unity-sds) | [unity-project-management](https://github.com/unity-sds/unity-project-management) | ✅ | ✅ | ✅ | ✅ | ✅ | ☑️ | ✅ | ✅ | -| [unity-sds](https://github.com/unity-sds) | [unity-data-services](https://github.com/unity-sds/unity-data-services) | ✅ | ✅ | ✅ | ✅ | ✅ | ☑️ | ✅ | ✅ | -| [unity-sds](https://github.com/unity-sds) | [unity-cs](https://github.com/unity-sds/unity-cs) | ✅ | ✅ | ✅ | ✅ | ✅ | ☑️ | ✅ | ✅ | -| [unity-sds](https://github.com/unity-sds) | [unity-cs-manager](https://github.com/unity-sds/unity-cs-manager) | ✅ | ✅ | ✅ | ✅ | ✅ | ☑️ | ✅ | ✅ | -| [unity-sds](https://github.com/unity-sds) | [unity-cs-infra](https://github.com/unity-sds/unity-cs-infra) | ✅ | ✅ | ✅ | ✅ | ✅ | ☑️ | ✅ | ✅ | -| [unity-sds](https://github.com/unity-sds) | [unity-architecture](https://github.com/unity-sds/unity-architecture) | ✅ | ✅ | ✅ | ✅ | ✅ | ☑️ | ✅ | ✅ | -| [unity-sds](https://github.com/unity-sds) | [unity-analytics](https://github.com/unity-sds/unity-analytics) | ✅ | ✅ | ✅ | ✅ | ✅ | ☑️ | ✅ | ✅ | -| [unity-sds](https://github.com/unity-sds) | [unity-analytics-bcdp](https://github.com/unity-sds/unity-analytics-bcdp) | ✅ | ✅ | ✅ | ✅ | ✅ | ☑️ | ✅ | ✅ | -| [unity-sds](https://github.com/unity-sds) | [unity-ads-deployment](https://github.com/unity-sds/unity-ads-deployment) | ✅ | ✅ | ✅ | ✅ | ✅ | ☑️ | ✅ | ✅ | -| [unity-sds](https://github.com/unity-sds) | [sounder-sips-tutorial](https://github.com/unity-sds/sounder-sips-tutorial) | ✅ | ✅ | ✅ | ✅ | ✅ | ☑️ | ✅ | ✅ | -| [unity-sds](https://github.com/unity-sds) | [ades_wpst](https://github.com/unity-sds/ades_wpst) | ✅ | ✅ | ✅ | ✅ | ✅ | ☑️ | ✅ | ✅ | -| [unity-sds](https://github.com/unity-sds) | [unity-py](https://github.com/unity-sds/unity-py) | ✅ | ✅ | ✅ | ✅ | ✅ | ☑️ | ✅ | ❌ | -| [unity-sds](https://github.com/unity-sds) | [unity-docs](https://github.com/unity-sds/unity-docs) | ❌ | ❌ | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | -| [unity-sds](https://github.com/unity-sds) | [unity-cs-sps-demo](https://github.com/unity-sds/unity-cs-sps-demo) | ❌ | ❌ | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | -| [unity-sds](https://github.com/unity-sds) | [unity-analytics-sdap](https://github.com/unity-sds/unity-analytics-sdap) | ❌ | ❌ | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | -| [unity-sds](https://github.com/unity-sds) | [unity-system-test](https://github.com/unity-sds/unity-system-test) | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ | ✅ | ❌ | -| [unity-sds](https://github.com/unity-sds) | [unity-cs-deployment-catalog](https://github.com/unity-sds/unity-cs-deployment-catalog) | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ | ✅ | ❌ | -| [unity-sds](https://github.com/unity-sds) | [unity-sps-register_job](https://github.com/unity-sds/unity-sps-register_job) | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | -| [unity-sds](https://github.com/unity-sds) | [unity-docker-stacks](https://github.com/unity-sds/unity-docker-stacks) | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | -| [unity-sds](https://github.com/unity-sds) | [unity-cs-security](https://github.com/unity-sds/unity-cs-security) | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | -| [unity-sds](https://github.com/unity-sds) | [sounder-sips-test-data](https://github.com/unity-sds/sounder-sips-test-data) | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | -| [unity-sds](https://github.com/unity-sds) | [sounder-sips-application](https://github.com/unity-sds/sounder-sips-application) | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | -| [unity-sds](https://github.com/unity-sds) | [hysds_ui_with_auth](https://github.com/unity-sds/hysds_ui_with_auth) | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | -| [unity-sds](https://github.com/unity-sds) | [.github](https://github.com/unity-sds/.github) | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | - -## Repository Check Explanation - -### 1. Issue Templates: -- The repository must have the following issue templates: - - `bug_report.md`: Template for bug reports. - - `feature_request.md`: Template for feature requests. -- ✅ The check will pass with a green check mark if both templates are present. - -### 2. PR Templates: -- The repository must have a pull request (PR) template. -- ✅ The check will pass with a green check mark if the PR template is present. - -### 3. Code of Conduct: -- The repository must contain a file named `CODE_OF_CONDUCT.md`. -- ✅ The check will pass with a green check mark if this file is present. - -### 4. Contributing Guide: -- The repository must contain a file named `CONTRIBUTING.md`. -- ✅ The check will pass with a green check mark if this file is present. - -### 5. License: -- The repository must contain a file named either `LICENSE` or `LICENSE.txt`. -- ✅ The check will pass with a green check mark if either of these files is present. - -### 6. Change Log: -- The repository must contain a file named `CHANGELOG.md`. -- ✅ The check will pass with a green check mark if this file is present. - -### 7. README Sections: -- The README must contain sections with the following titles: - - "Features" - - "Contents" - - "Quick Start" - - "Changelog" - - "Frequently Asked Questions (FAQ)" - - "Contributing" - - "License" - - "Support" -- ✅ If all these sections are present, the check will pass with a green check mark. -- ☑️ If only the sections "Contributing", "License", and "Support" are present, the check will pass with a different check mark. - -### 8. Docs Link in README: -- The README must contain a link with a label containing either "Docs" or "Documentation". Ex: "Unity-SPS Docs", "docs", or "Unity Documentation" -- ✅ The check will pass with a green check mark if this link is present. diff --git a/standards-compliance/leaderboard.py b/standards-compliance/leaderboard.py deleted file mode 100644 index 9a75ed8..0000000 --- a/standards-compliance/leaderboard.py +++ /dev/null @@ -1,73 +0,0 @@ -import requests -import time -import random -import logging -import base64 -import re - -logging.basicConfig(level=logging.INFO) - -org_name = "unity-sds" -org_url = f"https://api.github.com/orgs/{org_name}/repos" -headers = {'Authorization': 'token TOKEN_GOES_HERE'} -org_repos = requests.get(org_url, headers=headers).json() - -table_header = "| Project | Repository | [Issue Templates](https://github.com/unity-sds/unity-repo-template/tree/main/.github/ISSUE_TEMPLATE) | [PR Templates](https://github.com/unity-sds/unity-repo-template/blob/main/.github/PULL_REQUEST_TEMPLATE.md) | [Code of Conduct](https://github.com/unity-sds/unity-repo-template/blob/main/CODE_OF_CONDUCT.md) | [Contributing Guide](https://github.com/unity-sds/unity-repo-template/blob/main/CONTRIBUTING.md) | [LICENSE](https://github.com/unity-sds/unity-repo-template/blob/main/LICENSE) | [README](https://github.com/unity-sds/unity-repo-template/blob/main/README.md) | [Change Log](https://github.com/unity-sds/unity-repo-template/blob/main/CHANGELOG.md) | [Link to Docs in README](https://github.com/unity-sds/unity-repo-template/blame/main/README.md#L29) |\n" -table_header += "|---|---|---|---|---|---|---|---|---|---|\n" - -rows = [] - -for index, repo in enumerate(org_repos): - repo_name = repo['name'] - repo_url = repo['html_url'] - - if (repo['archived'] or repo['disabled']): # ignore archived and disabled repositories - logging.warning(f"Ignoring archived or disabled repository [{ repo_name }]({ repo_url })") - continue - - issue_template_url = f"https://api.github.com/repos/{org_name}/{repo_name}/contents/.github/ISSUE_TEMPLATE" - pr_template_url = f"https://api.github.com/repos/{org_name}/{repo_name}/contents/.github/PULL_REQUEST_TEMPLATE.md" - contents_url = f"https://api.github.com/repos/{org_name}/{repo_name}/contents" - readme_url = f"https://api.github.com/repos/{org_name}/{repo_name}/contents/README.md" - - jitter = random.uniform(0.5, 1.5) - time.sleep(jitter) # jittering - - issue_templates_response = requests.get(issue_template_url, headers=headers) - pr_template_response = requests.get(pr_template_url, headers=headers) - contents_response = requests.get(contents_url, headers=headers) - readme_response = requests.get(readme_url, headers=headers) - - issue_templates = issue_templates_response.json() if issue_templates_response.status_code == 200 else [] - pr_templates = '✅' if pr_template_response.status_code == 200 else '❌' - contents = contents_response.json() if contents_response.status_code == 200 else [] - readme = base64.b64decode(readme_response.json()['content']).decode() if readme_response.status_code == 200 else "" - - issue_template_files = [file['name'] for file in issue_templates] - files = [file['name'] for file in contents] - - issue_templates = '✅' if 'bug_report.md' in issue_template_files and 'feature_request.md' in issue_template_files else '❌' - code_of_conduct = '✅' if 'CODE_OF_CONDUCT.md' in files else '❌' - contributing_guide = '✅' if 'CONTRIBUTING.md' in files else '❌' - license = '✅' if 'LICENSE' or 'LICENSE.txt' in files else '❌' - change_log = '✅' if 'CHANGELOG.md' in files else '❌' - - required_sections = ["Features", "Contents", "Quick Start", "Changelog", "Frequently Asked Questions (FAQ)", "Contributing", "License", "Support"] - minimum_required_sections = [ "Contributing", "License", "Support" ] - readme_sections = re.findall(r'^#+\s*(.*)$', readme, re.MULTILINE) - readme_check = '✅' if all(section in readme_sections for section in required_sections) else '❌' - readme_check = '☑️' if all(section in readme_sections for section in minimum_required_sections) else '❌' - - docs_link = '✅' if re.search(r'\[.*?\b(?:Docs|Documentation)\b.*?\]\(.*\)', readme, re.IGNORECASE) else '❌' - - row = f"| [{org_name}](https://github.com/{org_name}) | [{repo_name}]({repo_url}) | {issue_templates} | {pr_templates} | {code_of_conduct} | {contributing_guide} | {license} | {readme_check} | {change_log} | {docs_link} |" - rows.append((row.count('✅') + row.count('☑️'), row)) - - logging.info(row) # print the markdown rendering of the row - -# Sort rows by the number of '✅' values and add them to the table -rows.sort(reverse=True) -table = table_header + '\n'.join(row for _, row in rows) - -print("\n") -print(table) From f9ac45c832fe3efbdb39c144dba7a8b3d7864550 Mon Sep 17 00:00:00 2001 From: Rishi Verma Date: Thu, 8 Feb 2024 11:55:33 -0800 Subject: [PATCH 2/2] Removed old zh reference --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 0ed009c..81409f3 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,6 @@ This repository contains largely tickets and small scripts useful for project ma Try the following actions: - See our issue tickets - View our [leaderboard](https://github.com/NASA-AMMOS/slim-leaderboard/blob/main/examples/slim-unity-leaderboard.md) showing statuses of [SLIM best practices](https://nasa-ammos.github.io/slim/) infusion -- View zenhub reports [DEPRECATED] ## Changelog