Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add repo licenses to RF4 metrics #1433

Merged
merged 3 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions apps/docs/docs/integrate/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ query GetProjects {
projects(limit: 10) {
project_id
project_name
project_slug
project_display_name
user_namespace
}
}
Expand All @@ -67,7 +67,6 @@ query GetCodeMetrics {
order_by: { star_count: desc_nulls_last }
) {
project_id
project_slug
project_name
artifact_namespace
repository_count
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ with repo_artifact as (
is_fork,
fork_count,
star_count,
--license,
license_spdx_id,
watcher_count,
CAST(id as STRING) as artifact_source_id,
LOWER(owner) as artifact_namespace,
Expand All @@ -17,7 +17,7 @@ repo_snapshot as (
{{ oso_id("a.artifact_source", "a.artifact_source_id") }} as `artifact_id`,
artifact_namespace,
artifact_name,
--license,
license_spdx_id,
is_fork,
fork_count,
star_count,
Expand Down Expand Up @@ -50,6 +50,7 @@ select
repo_snapshot.fork_count,
repo_snapshot.star_count,
repo_snapshot.watcher_count,
repo_snapshot.license_spdx_id,
repo_stats.first_commit_time,
repo_stats.last_commit_time,
repo_stats.days_with_commits_count,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
select
int_repo_metrics_by_project.project_id,
int_repo_metrics_by_project.artifact_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.license_spdx_id,
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', 'NOASSERTION',
'CC0-1.0', 'CC-BY-SA-4.0', 'CC-BY-4.0'
) then 'Restrictive'
else 'Unspecified'
end as license_type
from {{ ref('int_repo_metrics_by_project') }}
left join {{ ref('projects_v1') }}
on int_repo_metrics_by_project.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
where
{# TODO: update with actual collection for RF4 #}
projects_by_collection_v1.collection_name = 'op-onchain'
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ select
repositories.watcher_count,
repositories.fork_count,
repositories.is_fork,
repositories.license_name,
repositories.license_spdx_id,
repositories._cq_sync_time as `sync_time`
from {{ oso_source('ossd', 'repositories') }} as repositories
where _cq_sync_time = (select * from most_recent_sync)
Loading