rubocop: check for closed issues in comments
This commit is contained in:
parent
37cc59f206
commit
f7dda488ac
@ -816,6 +816,26 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def audit_github_issue_comment
|
||||||
|
return unless @online
|
||||||
|
|
||||||
|
matches = text.to_s.scan(%r{https://github.com/([-\w_]*)/([-\w_]*)/(pull|issues)/([0-9]*)})
|
||||||
|
return unless matches
|
||||||
|
|
||||||
|
matches.each do |match|
|
||||||
|
owner, repo, type, id = match
|
||||||
|
|
||||||
|
# Do not trigger for self references
|
||||||
|
next if "#{owner}/#{repo}" == formula.tap.remote_repo || owner == "Homebrew"
|
||||||
|
|
||||||
|
issue = GitHub::API.open_rest("https://api.github.com/repos/#{owner}/#{repo}/issues/#{id}")
|
||||||
|
next if issue.blank? || issue["state"] == "open"
|
||||||
|
|
||||||
|
issue_url = "https://github.com/#{owner}/#{repo}/#{type}/#{id}"
|
||||||
|
problem "Formula refers to a GitHub issue or pull request that is closed: #{issue_url}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def audit_reverse_migration
|
def audit_reverse_migration
|
||||||
# Only enforce for new formula being re-added to core
|
# Only enforce for new formula being re-added to core
|
||||||
return unless @strict
|
return unless @strict
|
||||||
|
@ -27,6 +27,10 @@ module Homebrew
|
|||||||
@text.include? s
|
@text.include? s
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_s
|
||||||
|
@text
|
||||||
|
end
|
||||||
|
|
||||||
def line_number(regex, skip = 0)
|
def line_number(regex, skip = 0)
|
||||||
index = @lines.drop(skip).index { |line| line =~ regex }
|
index = @lines.drop(skip).index { |line| line =~ regex }
|
||||||
index ? index + 1 : nil
|
index ? index + 1 : nil
|
||||||
|
Loading…
x
Reference in New Issue
Block a user