class Denmark::Plugins::Issues

environments plugin

Public Class Methods

cleanup() click to toggle source
# File lib/denmark/plugins/issues.rb, line 43
def self.cleanup
  # run just after evaluating this plugin
end
description() click to toggle source
# File lib/denmark/plugins/issues.rb, line 5
  def self.description
    # This is a Ruby squiggle heredoc; just a multi-line string with indentation removed
    <<~DESCRIPTION
      This smell test infers trends about the responsiveness of a module's maintainer(s)
      based on patterns in its repository issues.
    DESCRIPTION
  end
run(mod, repo) click to toggle source
# File lib/denmark/plugins/issues.rb, line 16
def self.run(mod, repo)
  # return an array of hashes representing any smells discovered
  response = Array.new

  today = Date.today
  unanswered = repo.issues.percent_of {|i| i.comments == 0 }
  ancient    = repo.issues.percent_of {|i| (today - i.created_at.to_date).to_i > 1095 } # more than 3 years old

  if unanswered > 25
    response << {
      severity: :orange,
      message: "#{unanswered}% of the issues in this module's repository have no responses.",
      explanation: "Sometimes when issues are not responded to, it means that the project is no longer being maintained. You might consider contacting the maintainer to determine the status of the project.",
    }
  end

  if ancient > 50
    response << {
      severity: :yellow,
      message: "#{ancient}% of the issues in this module's repository are more than 3 years old.",
      explanation: "Many very old issues may indicate that the maintainer is not responding to community feedback.",
    }
  end

  response
end
setup() click to toggle source
# File lib/denmark/plugins/issues.rb, line 12
def self.setup
  # run just before evaluating this plugin
end