-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: additional rf4 repo eligibility checks (#1535)
* feat: additional rf4 repo eligibility checks * chore: add repo checks to overall project checks * fix: clean up todos * fix: handling empty arrays
- Loading branch information
Showing
5 changed files
with
115 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 61 additions & 35 deletions
96
warehouse/dbt/models/marts/superchain/rf4_repo_stats_by_project.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,68 @@ | ||
{# TODO: Review licenses https://spdx.org/licenses/ for OSI Approved #} | ||
{# TODO: update with actual collection for RF4 #} | ||
with repo_snapshot as ( | ||
select | ||
project_id, | ||
artifact_namespace, | ||
artifact_name, | ||
is_fork, | ||
fork_count, | ||
star_count, | ||
first_commit_time, | ||
last_commit_time, | ||
days_with_commits_count, | ||
commit_count, | ||
language, | ||
license_spdx_id, | ||
case | ||
when license_spdx_id in ( | ||
'MIT', 'MIT-0', 'Apache-2.0', 'Unlicense', | ||
'BSD-2-Clause', 'BSD-3-Clause', 'BSD-3-Clause-Clear', | ||
'AGPL-3.0', 'GPL-3.0', 'LGPL-3.0', 'GPL-2.0', 'MPL-2.0', 'LGPL-2.1', | ||
'OFL-1.1', 'EPL-1.0', 'EPL-2.0', 'OFL-1.1', 'EUPL-1.2', 'OSL-3.0', | ||
'ISC', '0BSD', 'NCSA', 'Zlib' | ||
) then 'Permissive' | ||
when license_spdx_id in ( | ||
'BSD-4-Clause', 'WTFPL', | ||
'CC0-1.0', 'CC-BY-SA-4.0', 'CC-BY-4.0' | ||
) then 'Restrictive' | ||
when license_spdx_id = 'NOASSERTION' | ||
then 'Custom' | ||
else 'Unspecified' | ||
end as license_type | ||
from {{ ref('int_repo_metrics_by_project') }} | ||
) | ||
|
||
select | ||
int_repo_metrics_by_project.project_id, | ||
int_repo_metrics_by_project.artifact_id, | ||
repo_snapshot.project_id, | ||
projects_v1.project_name, | ||
int_repo_metrics_by_project.artifact_namespace, | ||
int_repo_metrics_by_project.artifact_name, | ||
int_repo_metrics_by_project.is_fork, | ||
int_repo_metrics_by_project.fork_count, | ||
int_repo_metrics_by_project.star_count, | ||
--int_repo_metrics_by_project.first_commit_time, | ||
--int_repo_metrics_by_project.last_commit_time, | ||
--int_repo_metrics_by_project.days_with_commits_count, | ||
--int_repo_metrics_by_project.contributors_to_repo_count, | ||
int_repo_metrics_by_project.language, | ||
int_repo_metrics_by_project.license_spdx_id, | ||
repo_snapshot.artifact_namespace, | ||
repo_snapshot.artifact_name, | ||
repo_snapshot.is_fork, | ||
repo_snapshot.fork_count, | ||
repo_snapshot.star_count, | ||
repo_snapshot.first_commit_time, | ||
repo_snapshot.last_commit_time, | ||
repo_snapshot.days_with_commits_count, | ||
repo_snapshot.commit_count, | ||
repo_snapshot.language, | ||
repo_snapshot.license_spdx_id, | ||
repo_snapshot.license_type, | ||
case | ||
{# TODO: Review licenses https://spdx.org/licenses/ for OSI Approved #} | ||
when int_repo_metrics_by_project.license_spdx_id in ( | ||
'MIT', 'MIT-0', 'Apache-2.0', 'Unlicense', | ||
'BSD-2-Clause', 'BSD-3-Clause', 'BSD-3-Clause-Clear', | ||
'AGPL-3.0', 'GPL-3.0', 'LGPL-3.0', 'GPL-2.0', 'MPL-2.0', 'LGPL-2.1', | ||
'OFL-1.1', 'EPL-1.0', 'EPL-2.0', 'OFL-1.1', 'EUPL-1.2', 'OSL-3.0', | ||
'ISC', '0BSD', 'NCSA', 'Zlib' | ||
) then 'Permissive' | ||
when int_repo_metrics_by_project.license_spdx_id in ( | ||
'BSD-4-Clause', 'WTFPL', | ||
'CC0-1.0', 'CC-BY-SA-4.0', 'CC-BY-4.0' | ||
) then 'Restrictive' | ||
when int_repo_metrics_by_project.license_spdx_id = 'NOASSERTION' | ||
then 'Custom' | ||
else 'Unspecified' | ||
end as license_type | ||
from {{ ref('int_repo_metrics_by_project') }} | ||
when ( | ||
repo_snapshot.commit_count >= 10 | ||
and repo_snapshot.days_with_commits_count >= 3 | ||
and repo_snapshot.first_commit_time < '2024-05-01' | ||
and repo_snapshot.star_count >= 10 | ||
and repo_snapshot.language in ('Solidity', 'JavaScript', 'TypeScript') | ||
) then 'approved' | ||
else 'review' | ||
end as approval_status | ||
from repo_snapshot | ||
left join {{ ref('projects_v1') }} | ||
on int_repo_metrics_by_project.project_id = projects_v1.project_id | ||
on repo_snapshot.project_id = projects_v1.project_id | ||
left join {{ ref('projects_by_collection_v1') }} | ||
on | ||
int_repo_metrics_by_project.project_id | ||
= projects_by_collection_v1.project_id | ||
on repo_snapshot.project_id = projects_by_collection_v1.project_id | ||
where | ||
{# TODO: update with actual collection for RF4 #} | ||
projects_by_collection_v1.collection_name = 'op-onchain' | ||
and repo_snapshot.license_type != 'Unspecified' |