Skip to content

Commit

Permalink
Remove analytics check (#1317)
Browse files Browse the repository at this point in the history
Closes #1307

Signed-off-by: Sergio Castaño Arteaga <[email protected]>
  • Loading branch information
tegioz authored Oct 12, 2023
1 parent 7ca5a9a commit db07dc1
Show file tree
Hide file tree
Showing 29 changed files with 20 additions and 502 deletions.
1 change: 0 additions & 1 deletion clomonitor-apiserver/src/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,6 @@ mod tests {
),
},
best_practices: BestPractices {
analytics: Some(CheckOutput::passed()),
artifacthub_badge: Some(CheckOutput::exempt()),
cla: Some(CheckOutput::passed()),
community_meeting: Some(CheckOutput::passed()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@

### Best Practices [100%]

- [x] Analytics ([_docs_](https://clomonitor.io/docs/topics/checks/#analytics))
- [x] Artifact Hub badge ([_docs_](https://clomonitor.io/docs/topics/checks/#artifact-hub-badge)) `EXEMPT`
- [x] Contributor License Agreement ([_docs_](https://clomonitor.io/docs/topics/checks/#contributor-license-agreement))
- [x] Community meeting ([_docs_](https://clomonitor.io/docs/topics/checks/#community-meeting))
Expand Down
1 change: 0 additions & 1 deletion clomonitor-apiserver/templates/repository-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
{%- if let Some(value) = score.best_practices %}
### Best Practices [{{ value.round() }}%]

{% call check("analytics", "Analytics", report.best_practices.analytics) -%}
{% call check("artifact-hub-badge", "Artifact Hub badge", report.best_practices.artifacthub_badge) -%}
{% call check("contributor-license-agreement", "Contributor License Agreement", report.best_practices.cla) -%}
{% call check("community-meeting", "Community meeting", report.best_practices.community_meeting) -%}
Expand Down
96 changes: 0 additions & 96 deletions clomonitor-core/src/linter/checks/analytics.rs

This file was deleted.

2 changes: 0 additions & 2 deletions clomonitor-core/src/linter/checks/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use lazy_static::lazy_static;
use std::collections::HashMap;

pub(crate) mod adopters;
pub(crate) mod analytics;
pub(crate) mod annual_review;
pub(crate) mod artifacthub_badge;
pub(crate) mod binary_artifacts;
Expand Down Expand Up @@ -70,7 +69,6 @@ lazy_static! {
}

register_check!(adopters);
register_check!(analytics);
register_check!(annual_review);
register_check!(artifacthub_badge);
register_check!(binary_artifacts, "Binary-Artifacts");
Expand Down
4 changes: 1 addition & 3 deletions clomonitor-core/src/linter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,7 @@ impl Linter for CoreLinter {
let ci = CheckInput::new(li).await?;

// Run some async checks concurrently
let (analytics, annual_review, contributing, summary_table, trademark_disclaimer) = tokio::join!(
run_async!(analytics, &ci),
let (annual_review, contributing, summary_table, trademark_disclaimer) = tokio::join!(
run_async!(annual_review, &ci),
run_async!(contributing, &ci),
run_async!(summary_table, &ci),
Expand Down Expand Up @@ -144,7 +143,6 @@ impl Linter for CoreLinter {
license_spdx_id: spdx_id,
},
best_practices: BestPractices {
analytics,
artifacthub_badge: run!(artifacthub_badge, &ci),
cla: run!(cla, &ci),
community_meeting: run!(community_meeting, &ci),
Expand Down
2 changes: 0 additions & 2 deletions clomonitor-core/src/linter/report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ section_impl!(
/// BestPractices section of the report.
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
pub struct BestPractices {
pub analytics: Option<CheckOutput<Vec<String>>>,
pub artifacthub_badge: Option<CheckOutput>,
pub cla: Option<CheckOutput>,
pub community_meeting: Option<CheckOutput>,
Expand All @@ -117,7 +116,6 @@ pub struct BestPractices {
#[rustfmt::skip]
section_impl!(
BestPractices,
analytics,
artifacthub_badge,
cla,
community_meeting,
Expand Down
21 changes: 9 additions & 12 deletions clomonitor-core/src/score/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,6 @@ mod tests {
),
},
best_practices: BestPractices {
analytics: Some(CheckOutput::passed()),
artifacthub_badge: Some(CheckOutput::exempt()),
cla: Some(CheckOutput::passed()),
community_meeting: Some(CheckOutput::passed()),
Expand Down Expand Up @@ -303,14 +302,14 @@ mod tests {
},
}),
Score {
global: 99.999_999_999_999_99,
global_weight: 99,
global: 100.0,
global_weight: 98,
documentation: Some(99.999_999_999_999_99),
documentation_weight: Some(30),
license: Some(100.0),
license_weight: Some(20),
best_practices: Some(100.0),
best_practices_weight: Some(20),
best_practices: Some(99.999_999_999_999_99),
best_practices_weight: Some(19),
security: Some(99.999_999_999_999_99),
security_weight: Some(24),
legal: Some(100.0),
Expand Down Expand Up @@ -342,7 +341,6 @@ mod tests {
license_spdx_id: Some(CheckOutput::not_passed()),
},
best_practices: BestPractices {
analytics: Some(CheckOutput::not_passed()),
artifacthub_badge: Some(CheckOutput::not_passed()),
cla: Some(CheckOutput::not_passed()),
community_meeting: Some(CheckOutput::not_passed()),
Expand Down Expand Up @@ -373,13 +371,13 @@ mod tests {
}),
Score {
global: 0.0,
global_weight: 99,
global_weight: 98,
documentation: Some(0.0),
documentation_weight: Some(30),
license: Some(0.0),
license_weight: Some(20),
best_practices: Some(0.0),
best_practices_weight: Some(20),
best_practices_weight: Some(19),
security: Some(0.0),
security_weight: Some(24),
legal: Some(0.0),
Expand Down Expand Up @@ -415,7 +413,6 @@ mod tests {
),
},
best_practices: BestPractices {
analytics: Some(CheckOutput::passed()),
artifacthub_badge: Some(CheckOutput::exempt()),
cla: Some(CheckOutput::passed()),
community_meeting: None,
Expand Down Expand Up @@ -445,14 +442,14 @@ mod tests {
},
}),
Score {
global: 100.0,
global_weight: 78,
global: 99.999_999_999_999_99,
global_weight: 77,
documentation: Some(100.0),
documentation_weight: Some(17),
license: Some(100.0),
license_weight: Some(20),
best_practices: Some(100.0),
best_practices_weight: Some(17),
best_practices_weight: Some(16),
security: Some(99.999_999_999_999_99),
security_weight: Some(24),
legal: None,
Expand Down
18 changes: 0 additions & 18 deletions clomonitor-linter/src/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,21 +133,6 @@ pub(crate) fn display(
cell_entry("License / Scanning"),
cell_check(&report.license.license_scanning),
])
.add_row(vec![
cell_entry("Best practices / Analytics"),
if let Some(value) = report
.best_practices
.analytics
.as_ref()
.and_then(|analytics| analytics.value.as_ref())
{
Cell::new(value.join(" · "))
.set_alignment(CellAlignment::Center)
.add_attribute(Attribute::Bold)
} else {
cell_check(&report.best_practices.analytics)
},
])
.add_row(vec![
cell_entry("Best practices / Artifact Hub badge"),
cell_check(&report.best_practices.artifacthub_badge),
Expand Down Expand Up @@ -354,9 +339,6 @@ mod tests {
license_spdx_id: Some(CheckOutput::passed().value(Some("Apache-2.0".to_string()))),
},
best_practices: BestPractices {
analytics: Some(
CheckOutput::passed().value(Some(vec!["GA3".to_string(), "GA4".to_string()])),
),
artifacthub_badge: Some(CheckOutput::exempt()),
cla: Some(CheckOutput::passed()),
community_meeting: Some(CheckOutput::passed()),
Expand Down
2 changes: 0 additions & 2 deletions clomonitor-linter/src/testdata/display.golden
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ Checks summary
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
│ License / Scanning ┆ ✓ │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
│ Best practices / Analytics ┆ GA3 · GA4 │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
│ Best practices / Artifact Hub badge ┆ Exempt │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
│ Best practices / CLA ┆ ✓ │
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ returns setof text as $$
(rp.data->'license'->'license_approved'->'passed')::boolean as license_approved,
(rp.data->'license'->'license_scanning'->'passed')::boolean as license_scanning,
coalesce((rp.data->'license'->'license_spdx_id'->>'value')::text, 'Not detected') as license_spdx_id,
(
select string_agg(item #>> '{}', ' ')
from jsonb_array_elements(rp.data->'best_practices'->'analytics'->'value') as item
) as analytics,
(rp.data->'best_practices'->'artifacthub_badge'->'passed')::boolean as artifacthub_badge,
(rp.data->'best_practices'->'cla'->'passed')::boolean as cla,
(rp.data->'best_practices'->'community_meeting'->'passed')::boolean as community_meeting,
Expand Down Expand Up @@ -52,7 +48,7 @@ returns setof text as $$
join report rp using (repository_id)
order by p.foundation_id asc, p.name asc
)
select 'Foundation,Project,Repository URL,Check Sets,Adopters,Annual Review,Changelog,Code of Conduct,Contributing,Governance,Maintainers,Readme,Roadmap,Summary Table,Website,License Approved,License Scanning,License SPDX ID,Analytics,ArtifactHub Badge,CLA,Community Meeting,DCO,GitHub discussions,OpenSSF best practices badge,OpenSSF Scorecard badge,Recent Release,Slack Presence,Binary Artifacts,Code Review,Dangerous Workflow,Dependencies Policy,Dependency Update Tool,Maintained,SBOM,Security Insights,Security Policy,Self-Assessment,Signed Releases,Token Permissions,Trademark Disclaimer'
select 'Foundation,Project,Repository URL,Check Sets,Adopters,Annual Review,Changelog,Code of Conduct,Contributing,Governance,Maintainers,Readme,Roadmap,Summary Table,Website,License Approved,License Scanning,License SPDX ID,ArtifactHub Badge,CLA,Community Meeting,DCO,GitHub discussions,OpenSSF best practices badge,OpenSSF Scorecard badge,Recent Release,Slack Presence,Binary Artifacts,Code Review,Dangerous Workflow,Dependencies Policy,Dependency Update Tool,Maintained,SBOM,Security Insights,Security Policy,Self-Assessment,Signed Releases,Token Permissions,Trademark Disclaimer'
union all
select rtrim(ltrim(r.*::text, '('), ')') from repositories r;
$$ language sql;
1 change: 0 additions & 1 deletion database/migrations/functions/stats/get_stats.sql
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ returns json as $$
'license_spdx_id', repositories_passing_check(p_foundation, 'license', 'license_spdx_id')
),
'best_practices', json_build_object(
'analytics', repositories_passing_check(p_foundation, 'best_practices', 'analytics'),
'artifacthub_badge', repositories_passing_check(p_foundation, 'best_practices', 'artifacthub_badge'),
'cla', repositories_passing_check(p_foundation, 'best_practices', 'cla'),
'community_meeting', repositories_passing_check(p_foundation, 'best_practices', 'community_meeting'),
Expand Down
4 changes: 0 additions & 4 deletions database/tests/functions/projects/get_project_checks.sql
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,6 @@ insert into report (
"dco": {
"passed": true
},
"analytics": {
"passed": true
},
"github_discussions": {
"passed": true
},
Expand Down Expand Up @@ -237,7 +234,6 @@ select results_eq(
('00000000-0000-0001-0000-000000000000'::uuid, 'documentation', 'code_of_conduct', true),
('00000000-0000-0001-0000-000000000000'::uuid, 'best_practices', 'cla', true),
('00000000-0000-0001-0000-000000000000'::uuid, 'best_practices', 'dco', true),
('00000000-0000-0001-0000-000000000000'::uuid, 'best_practices', 'analytics', true),
('00000000-0000-0001-0000-000000000000'::uuid, 'best_practices', 'openssf_badge', true),
('00000000-0000-0001-0000-000000000000'::uuid, 'best_practices', 'recent_release', true),
('00000000-0000-0001-0000-000000000000'::uuid, 'best_practices', 'slack_presence', false),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,6 @@ insert into report (
"dco": {
"passed": true
},
"analytics": {
"passed": true
},
"github_discussions": {
"passed": true
},
Expand Down Expand Up @@ -214,7 +211,6 @@ select results_eq(
$$
values ('{
adopters,
analytics,
binary_artifacts,
changelog,
cla,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,6 @@ insert into report (
"dco": {
"passed": true
},
"analytics": {
"passed": true,
"value": ["GA4"]
},
"github_discussions": {
"passed": true
},
Expand Down Expand Up @@ -233,9 +229,9 @@ select results_eq(
$$,
$$
values
('Foundation,Project,Repository URL,Check Sets,Adopters,Annual Review,Changelog,Code of Conduct,Contributing,Governance,Maintainers,Readme,Roadmap,Summary Table,Website,License Approved,License Scanning,License SPDX ID,Analytics,ArtifactHub Badge,CLA,Community Meeting,DCO,GitHub discussions,OpenSSF best practices badge,OpenSSF Scorecard badge,Recent Release,Slack Presence,Binary Artifacts,Code Review,Dangerous Workflow,Dependencies Policy,Dependency Update Tool,Maintained,SBOM,Security Insights,Security Policy,Self-Assessment,Signed Releases,Token Permissions,Trademark Disclaimer'),
('cncf,project1,https://repo1.url,"{code,community}",t,t,t,t,t,t,t,t,f,f,t,t,f,Apache-2.0,GA4,f,t,f,t,t,t,t,t,f,t,t,t,t,f,t,f,t,t,t,f,f,f'),
('cncf,project1,https://repo2.url,{docs},,,,,,,,f,,,,t,,Apache-2.0,,,,,,,,,,,,,,,,,,,,,,,')
('Foundation,Project,Repository URL,Check Sets,Adopters,Annual Review,Changelog,Code of Conduct,Contributing,Governance,Maintainers,Readme,Roadmap,Summary Table,Website,License Approved,License Scanning,License SPDX ID,ArtifactHub Badge,CLA,Community Meeting,DCO,GitHub discussions,OpenSSF best practices badge,OpenSSF Scorecard badge,Recent Release,Slack Presence,Binary Artifacts,Code Review,Dangerous Workflow,Dependencies Policy,Dependency Update Tool,Maintained,SBOM,Security Insights,Security Policy,Self-Assessment,Signed Releases,Token Permissions,Trademark Disclaimer'),
('cncf,project1,https://repo1.url,"{code,community}",t,t,t,t,t,t,t,t,f,f,t,t,f,Apache-2.0,f,t,f,t,t,t,t,t,f,t,t,t,t,f,t,f,t,t,t,f,f,f'),
('cncf,project1,https://repo2.url,{docs},,,,,,,,f,,,,t,,Apache-2.0,,,,,,,,,,,,,,,,,,,,,,')
$$,
'Return all repositories with all checks'
);
Expand Down
Loading

0 comments on commit db07dc1

Please sign in to comment.