Skip to content

Commit 273507f

Browse files
authored
Merge pull request #229 from Michadelic/patch-4
Updated reference implementation (initial value, description bonus)
2 parents 23b64a9 + ce3a0e4 commit 273507f

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

patterns/2-structured/repository-activity-score.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,10 @@ Manual adjustments according to soft KPIs (see [Forces](#forces)) can be made on
5555
``` javascript
5656
// calculate a virtual InnerSource score from stars, watches, commits, and issues
5757
function calculateScore(repo) {
58-
// weighting:
59-
// forks and watches count most, then stars, add some little score for open issues, too
60-
let iScore = 1 + repo["forks_count"] * 5 + repo["watchers_count"] + repo["stargazers_count"] / 3 + repo["open_issues_count"] / 5;
58+
// initial score is 50 to give active repos with low GitHub KPIs (forks, watchers, stars) a better starting point
59+
let iScore = 50;
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;
6162
let iDaysSinceLastUpdate = (new Date().getTime() - new Date(repo.updated_at).getTime()) / 1000 / 86400;
6263
// 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)
6364
iScore = iScore * (1 + (100 - Math.min(iDaysSinceLastUpdate, 100)) / 100);
@@ -76,14 +77,16 @@ function calculateScore(repo) {
7677
iBoost *= (365 - Math.min(iDaysSinceCreation, 365)) / 365;
7778
// add boost to score
7879
iScore += iBoost;
80+
// 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);
7982
// give projects with contribution guidelines (CONTRIBUTING.md) file a static boost of 100
8083
iScore += (repo["_InnerSourceMetadata"] && repo["_InnerSourceMetadata"]["guidelines"] ? 100 : 0);
8184
// build in a logarithmic scale for very active projects (open ended but stabilizing around 5000)
8285
if (iScore > 3000) {
8386
iScore = 3000 + Math.log(iScore) * 100;
8487
}
85-
// final score is a rounded value starting from 0
86-
iScore = Math.round(iScore - 1);
88+
// final score is a rounded value starting from 0 (subtract the initial value)
89+
iScore = Math.round(iScore - 50);
8790
// add score to metadata on the fly
8891
repo._InnerSourceMetadata.score = iScore;
8992
return iScore;

0 commit comments

Comments
 (0)