Class: Denmark::Plugins::Issues

Inherits:
Object
  • Object
show all
Defined in:
lib/denmark/plugins/issues.rb

Overview

environments plugin

Class Method Summary collapse

Class Method Details

.cleanupObject



43
44
45
# File 'lib/denmark/plugins/issues.rb', line 43

def self.cleanup
  # run just after evaluating this plugin
end

.descriptionObject



5
6
7
8
9
10
11
# 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) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# 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

.setupObject



12
13
14
# File 'lib/denmark/plugins/issues.rb', line 12

def self.setup
  # run just before evaluating this plugin
end