@@ -58,17 +58,23 @@ function calculateScore(repo) {
58
58
// initial score is 50 to give active repos with low GitHub KPIs (forks, watchers, stars) a better starting point
59
59
let iScore = 50 ;
60
60
// weighting: forks and watches count most, then stars, add some little score for open issues, too
61
- iScore += repo[" forks_count" ] * 5 + repo[" watchers_count" ] + repo[" stargazers_count" ] / 3 + repo[" open_issues_count" ] / 5 ;
62
- let iDaysSinceLastUpdate = (new Date ().getTime () - new Date (repo .updated_at ).getTime ()) / 1000 / 86400 ;
61
+ iScore += repo .forks_count * 5 ;
62
+ iScore += (repo .subscribers_count ? repo .subscribers_count : 0 );
63
+ iScore += repo .stargazers_count / 3 ;
64
+ iScore += repo .open_issues_count / 5 ;
65
+
63
66
// updated in last 3 months: adds a bonus multiplier between 0..1 to overall score (1 = updated today, 0 = updated more than 100 days ago)
64
- iScore = iScore * (1 + (100 - Math .min (iDaysSinceLastUpdate, 100 )) / 100 );
67
+ let iDaysSinceLastUpdate = (new Date ().getTime () - new Date (repo .updated_at ).getTime ()) / 1000 / 86400 ;
68
+ iScore = iScore * ((1 + (100 - Math .min (iDaysSinceLastUpdate, 100 ))) / 100 );
69
+
65
70
// evaluate participation stats for the previous 3 months
66
71
repo ._InnerSourceMetadata = repo ._InnerSourceMetadata || {};
67
72
if (repo ._InnerSourceMetadata .participation ) {
68
73
// average commits: adds a bonus multiplier between 0..1 to overall score (1 = >10 commits per week, 0 = less than 3 commits per week)
69
- let iAverageCommitsPerWeek = repo ._InnerSourceMetadata .participation .slice (repo ._InnerSourceMetadata .participation - 13 ).reduce ((a , b ) => a + b) / 13 ;
70
- iScore = iScore * (1 + (Math .min (Math .max (iAverageCommitsPerWeek - 3 , 0 ), 7 )) / 7 );
74
+ let iAverageCommitsPerWeek = repo ._InnerSourceMetadata .participation .slice (repo ._InnerSourceMetadata .participation . length - 13 ).reduce ((a , b ) => a + b) / 13 ;
75
+ iScore = iScore * (( 1 + (Math .min (Math .max (iAverageCommitsPerWeek - 3 , 0 ), 7 ) )) / 7 );
71
76
}
77
+
72
78
// boost calculation:
73
79
// all repositories updated in the previous year will receive a boost of maximum 1000 declining by days since last update
74
80
let iBoost = (1000 - Math .min (iDaysSinceLastUpdate, 365 ) * 2.74 );
@@ -78,9 +84,9 @@ function calculateScore(repo) {
78
84
// add boost to score
79
85
iScore += iBoost;
80
86
// give projects with a meaningful description a static boost of 50
81
- iScore += (repo[ " _InnerSourceMetadata " ][ " description" ] .length > 30 || repo[ " _InnerSourceMetadata" ] && repo[ " _InnerSourceMetadata " ][ " motivation" ] .length > 30 ? 50 : 0 );
87
+ iScore += (repo . description ? .length > 30 || repo . _InnerSourceMetadata . motivation ? .length > 30 ? 50 : 0 );
82
88
// give projects with contribution guidelines (CONTRIBUTING.md) file a static boost of 100
83
- iScore += (repo[ " _InnerSourceMetadata" ] && repo[ " _InnerSourceMetadata " ][ " guidelines" ] ? 100 : 0 );
89
+ iScore += (repo . _InnerSourceMetadata . guidelines ? 100 : 0 );
84
90
// build in a logarithmic scale for very active projects (open ended but stabilizing around 5000)
85
91
if (iScore > 3000 ) {
86
92
iScore = 3000 + Math .log (iScore) * 100 ;
@@ -89,6 +95,7 @@ function calculateScore(repo) {
89
95
iScore = Math .round (iScore - 50 );
90
96
// add score to metadata on the fly
91
97
repo ._InnerSourceMetadata .score = iScore;
98
+
92
99
return iScore;
93
100
}
94
101
` ` `
0 commit comments