Class: Denmark::Plugins::PullRequests
- Inherits:
-
Object
- Object
- Denmark::Plugins::PullRequests
- Defined in:
- lib/denmark/plugins/pull_requests.rb
Overview
environments plugin
Class Method Summary collapse
Class Method Details
.cleanup ⇒ Object
43 44 45 |
# File 'lib/denmark/plugins/pull_requests.rb', line 43 def self.cleanup # run just after evaluating this plugin end |
.description ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/denmark/plugins/pull_requests.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 pull requests. 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/pull_requests.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.pull_requests.percent_of {|i| i.comments == 0 } ancient = repo.pull_requests.percent_of {|i| (today - i.created_at.to_date).to_i > 1095 } # more than 3 years old if unanswered > 10 response << { severity: :orange, message: "#{unanswered}% of the pull requests in this module's repository have not been reviewed.", explanation: "Sometimes when pull requests are not reviewed, 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 pull requests in this module's repository are more than 3 years old.", explanation: "Many very old pull requests may indicate that the maintainer is not merging community contributions.", } end response end |
.setup ⇒ Object
12 13 14 |
# File 'lib/denmark/plugins/pull_requests.rb', line 12 def self.setup # run just before evaluating this plugin end |