diff --git a/src/lib/scoring.test.ts b/src/lib/scoring.test.ts index 42f6348..88324f3 100644 --- a/src/lib/scoring.test.ts +++ b/src/lib/scoring.test.ts @@ -267,3 +267,50 @@ test('"dependencies" returns dependency hell', () => { const repo = buildRepo({ lastCommitMessage: 'update dependencies', lastCommitDate: new Date().toISOString() }) assert.equal(generateLastWords(repo), 'trapped in dependency hell') }) + +// ── language-specific causes ─────────────────────────────────────── + +test('Ruby repo idle >365 days → Gemfile quip', () => { + const repo = buildRepo({ + language: 'Ruby', + lastCommitDate: '2023-01-01T00:00:00.000Z', + isArchived: false, + isFork: false, + openIssuesCount: 2, + stargazersCount: 5, + forksCount: 0, + description: 'a gem that time forgot', + }) + const cause = determineCauseOfDeath(repo) + assert.equal(cause, 'Gemfile.lock never unlocked') +}) + +test('Perl repo returns Perl-specific cause', () => { + const repo = buildRepo({ + language: 'Perl', + lastCommitDate: '2024-01-01T00:00:00.000Z', + isArchived: false, + isFork: false, + openIssuesCount: 2, + stargazersCount: 5, + forksCount: 0, + description: 'a Perl tool', + }) + const cause = determineCauseOfDeath(repo) + assert.equal(cause, 'Nobody could read it, including the author') +}) + +test('Objective-C repo idle >365 days returns Swift quip', () => { + const repo = buildRepo({ + language: 'Objective-C', + lastCommitDate: '2022-01-01T00:00:00.000Z', + isArchived: false, + isFork: false, + openIssuesCount: 2, + stargazersCount: 5, + forksCount: 0, + description: 'an old iOS lib', + }) + const cause = determineCauseOfDeath(repo) + assert.equal(cause, 'Swift happened') +}) diff --git a/src/lib/scoring.ts b/src/lib/scoring.ts index 25cab40..8ef41b5 100644 --- a/src/lib/scoring.ts +++ b/src/lib/scoring.ts @@ -92,6 +92,30 @@ export function determineCauseOfDeath(repo: RepoData): string { score: isJS && daysSince > 365 ? 5 : 0, cause: 'Lost in dependency hell', }, + { + score: repo.language?.toLowerCase() === 'ruby' && daysSince > 365 ? 4 : 0, + cause: 'Gemfile.lock never unlocked', + }, + { + score: repo.language?.toLowerCase() === 'python' && daysSince > 365 ? 4 : 0, + cause: 'Pip froze, then everything else did', + }, + { + score: repo.language?.toLowerCase() === 'php' && daysSince > 365 ? 4 : 0, + cause: 'Died of PHP fatigue', + }, + { + score: repo.language?.toLowerCase() === 'perl' ? 5 : 0, + cause: 'Nobody could read it, including the author', + }, + { + score: repo.language?.toLowerCase() === 'coffeescript' ? 5 : 0, + cause: 'Outlived by the thing it inspired', + }, + { + score: repo.language?.toLowerCase() === 'objective-c' && daysSince > 365 ? 5 : 0, + cause: 'Swift happened', + }, { score: descLower.includes('microservice') || descLower.includes('enterprise') ? 5 : 0, cause: 'Killed by overengineering',