_plugins/crate_gen.rb
# The aim here is to calculate a score that combines popularity and active maintenance
# As this function evolves, consider how it rewards/punishes:
# - stable core crates that require minimal maintenance
# - crates that are downloaded as a transitive dependency to a popular project
# - crates not on crates.io, github, etc...
# - and the many ways that scoring can inevitably be gamed
The aim here is to calculate a score that combines popularity and active maintenance
As this function evolves, consider how it rewards/punishes:
stable core crates that require minimal maintenance
crates that are downloaded as a transitive dependency to a popular project
crates not on crates.io, github, etc
and the many ways that scoring can inevitably be gamed
The aim here is to calculate a score that combines popularity and active maintenance As this function evolves consider how it rewards / punishes : stable core crates that require minimal maintenance crates that are downloaded as a transitive dependency to a popular project crates not on crates . io github etc and the many ways that scoring can inevitably be gamed
def score(crate)
      unless crate['updated_at']
        return 0
      end
      recent_downloads = crate['recent_downloads'] || 0
      last_activity = crate['updated_at']
      if crate['last_commit'] && (crate['last_commit'] > last_activity)
        last_activity = crate['last_commit']
      end
      inactive_days = (Date.today - last_activity.to_date).to_i
      if inactive_days <= 180
        coefficient = 1
      elsif inactive_days <= 365
        coefficient = 0.5
      else
        coefficient = 0.1
      end
      (coefficient * recent_downloads).to_i
    end
def score ( crate ) unless crate [ 'updated_at' ] return 0 end recent_downloads = crate [ 'recent_downloads' ] || 0 last_activity = crate [ 'updated_at' ] if crate [ 'last_commit' ] && ( crate [ 'last_commit' ] > last_activity ) last_activity = crate [ 'last_commit' ] end inactive_days = ( Date . today - last_activity . to_date ) . to_i if inactive_days <= 180 coefficient = 1 elsif inactive_days <= 365 coefficient = 0.5 else coefficient = 0.1 end ( coefficient * recent_downloads ) . to_i end
The aim here is to calculate a score that combines popularity and active maintenance
As this function evolves, consider how it rewards/punishes:
 stable core crates that require minimal maintenance
 crates that are downloaded as a transitive dependency to a popular project
 crates not on crates.io, github, etc...
 and the many ways that scoring can inevitably be gamed
The aim here is to calculate a score that combines popularity and active maintenance As this function evolves consider how it rewards / punishes : stable core crates that require minimal maintenance crates that are downloaded as a transitive dependency to a popular project crates not on crates . io github etc ... and the many ways that scoring can inevitably be gamed
# crate is not published to crates.io # In calculating last_activity, we only scrape last_commit for github-based crates # so this is unfair to projects that host source elsewhere. # This is slightly mitigated by falling back to the last crate publish date # This is really simple, but basically calls any crate with activity in 6 months as maintained # trying to recognize that some crates may actually be stable enough to require infrequent changes # From 6-12 months, it's maintenance state is less certain, and after a year without activity, it's likely unmaintained
crate