Skip to content
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
47 changes: 47 additions & 0 deletions src/lib/scoring.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
})
24 changes: 24 additions & 0 deletions src/lib/scoring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Loading