检查远程存储库中的典型红旗,如CLA和由于开发活动低而引起的风险
项目描述
开源红旗检查器
此项目通过寻找典型的红旗(如CLA(贡献者许可协议))来评估远程存储库,但还包括我们认为良好的治理、活动或许可条件的指标。
目录
功能
搜索数据
检查器在远程存储库中查找以下数据
- 文件和拉取请求中提到的CLA(贡献者许可协议)
- 文件和拉取请求中提到的DCO(开发者来源证书)
- 文件中提到的inbound=outbound
- 存在LICENSE/COPYING文件
- 项目贡献者(基于GitHub统计数据)
- 人类和机器人提交的最后一条提交
基于数据的分析
红旗
- CLA 在
README
或CONTRIBUTING
文件中提到 - CLA 作为拉取请求动作/状态的一部分
- 仓库中没有
LICENSE
/COPYING
文件 - 项目只包含一个人的贡献
- 最后提交超过 1 年
黄色标志
- 项目的主要开发者比接下来 10 个最活跃的贡献者贡献超过 75%
- 最后的人类提交超过 1 年,但机器人(如 dependabot 或 renovate)已提交了新版本
- 最后的人类提交超过 90 天
绿色标志
- DCO 在
README
或CONTRIBUTING
文件中提到 - DCO 作为拉取请求动作/状态的一部分
- 入站 = 出站在
README
或CONTRIBUTING
文件中提到 - 项目有多个活跃开发者可接受的贡献分布
- 最后的人类提交少于 90 天
安装
您必须安装以下依赖项
git
>= 1.7.0python
>= 3.8pip3
您可以使用 pip 安装最新版本: pip3 install oss-red-flag-checker
。
运行程序后的命令将是 ossrfc
。
使用 poetry 安装/开发
您也可以通过 poetry
运行此工具,它会负责在干净的环境中安装正确的依赖项。这也使得开发变得非常简单。我们建议至少使用 poetry 1.1.0。在仓库内部,运行 poetry install
一次,您就可以开始了。如果您更新了仓库,请再次运行此命令以获取新版本和依赖项。
运行程序的命令将是 poetry run ossrfc
。
使用
您可以通过运行 ossrfc --help
找到所有支持的标志。
[!注意] 建议提供 GitHub 个人访问令牌以避免低 API 限制。可以使用
--token
参数或设置GITHUB_TOKEN
环境变量。
基本示例
# Check a remote repository
ossrfc -r https://github.com/hashicorp/terraform
# Cache the cloned repository so subsequent checks are faster
ossrfc -r https://github.com/hashicorp/terraform --cache
# Return the results as JSON
ossrfc -r https://github.com/hashicorp/terraform --json
# Do not check for CLAs and DCOs in pull requests
ossrfc -r https://github.com/hashicorp/terraform -d cla-dco-pulls
# Ignore findings about contribution distribution
ossrfc -r https://github.com/hashicorp/terraform -i contributions
# Provide a list of repositories to be checked
ossrfc -f repos.txt
以下是在 Markdown 视图和 JSON 中的可能输出
# Report for hashicorp/terraform (https://github.com/hashicorp/terraform)
* 🚩 Licensing: A mention of Contributor License Agreements in the following file(s): .github/CONTRIBUTING.md
* 🚩 Licensing: A check for Contributor License Agreements in at least one status in pull request(s): 33656
* ✔ Contributions: The project has multiple contributors with an acceptable contribution distribution
* ✔ Contributions: The last commit made by a human is less than 90 days old (1 days)
{
"json_version": "1.0",
"disabled_checks": [],
"ignored_flags": [],
"debug_mode": false,
"repositories": [
{
"url": "https://github.com/hashicorp/terraform",
"shortname": "hashicorp/terraform",
"red_flags": [
"cla",
"cla"
],
"yellow_flags": [],
"green_flags": [
"distributed-contributions",
"actively-developed"
],
"cla_files": [
{
"file": ".github/CONTRIBUTING.md",
"indicators": [
"- Contributor License Agreement (CLA): If this is your first contribution to Terraform you will be asked to sign the CLA."
]
}
],
"cla_pulls": [
{
"pull_request": 33656,
"type": "status",
"url": "https://api.github.com/repos/hashicorp/terraform/statuses/b53d89a08df10c85f6d4c546d2e54d4fab886d67",
"indicators": [
"Contributor License Agreement is signed.",
"license/cla"
]
}
],
"dco_files": [],
"dco_pulls": [],
"inoutbound_files": [],
"licensefiles": [
"LICENSE"
],
"maintainer_dominance": -2.83,
"days_since_last_human_commit": 1,
"days_since_last_bot_commit": 141,
"analysis": [
{
"category": "Licensing",
"ignored": false,
"severity": "red",
"indicator": "A mention of Contributor License Agreements in the following file(s): .github/CONTRIBUTING.md"
},
{
"category": "Licensing",
"ignored": false,
"severity": "red",
"indicator": "A check for Contributor License Agreements in at least one status in pull request(s): 33656"
},
{
"category": "Contributions",
"ignored": false,
"severity": "green",
"indicator": "The project has multiple contributors with an acceptable contribution distribution"
},
{
"category": "Contributions",
"ignored": false,
"severity": "green",
"indicator": "The last commit made by a human is less than 90 days old (1 days)"
}
]
}
]
}
注意事项
有偏见的分析
对某些指标被认为是红旗、黄旗或绿旗的分析和决策非常主观,并代表了我们对(DB Systel GmbH)当前想法的快照。
您可以使用此工具。如果某些标准与您无关,请考虑使用 --ignore
或 --disable
标志。
从长远来看,可能可以使评级可配置。如果您对此感兴趣,欢迎贡献。
类似方法
有不同倡议旨在评估开源项目的健康或风险。它们都有其特定的重点、优势和劣势。
许可证和版权
此存储库的内容受 Apache 2.0 许可证 保护。
此存储库符合 REUSE。您可以在每个文件的文件头或伴随文件中找到关于许可和版权的信息。
此项目由 DB Systel GmbH 启动。 我们欢迎所有人的贡献。
项目详情
下载文件
下载适用于您平台的文件。如果您不确定选择哪个,请了解有关安装包的更多信息。