Skip to content
This repository was archived by the owner on Nov 8, 2018. It is now read-only.

Commit a59f3a6

Browse files
nat-hendersonjtarchie
authored andcommitted
Rubocop formatting changes
1 parent 28c1f17 commit a59f3a6

File tree

6 files changed

+14
-15
lines changed

6 files changed

+14
-15
lines changed

assets/lib/filters/approval.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ def initialize(pull_requests:, input: Input.instance)
77

88
def pull_requests
99
if @input.source.require_review_approval
10-
@pull_requests.delete_if {|x| !x.review_approved? }
10+
@pull_requests.delete_if { |x| !x.review_approved? }
1111
end
1212
if @input.source.authorship_restriction
13-
@pull_requests.delete_if {|x| !x.author_associated? }
13+
@pull_requests.delete_if { |x| !x.author_associated? }
1414
end
1515

1616
@pull_requests

assets/lib/filters/mergeable.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
module Filters
2-
class Mergeable
2+
class Mergeable
33
def initialize(pull_requests:, input: Input.instance)
44
@pull_requests = pull_requests
55
@input = input
66
end
77

88
def pull_requests
99
if @input.source.only_mergeable
10-
@memoized ||= @pull_requests.delete_if {|x| !x.mergeable? }
10+
@memoized ||= @pull_requests.delete_if { |x| !x.mergeable? }
1111
else
1212
@pull_requests
1313
end

assets/lib/pull_request.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ def mergeable?
2121
end
2222

2323
def review_approved?
24-
Octokit.pull_request_reviews(base_repo, id).any? {|r| r['state'] == 'APPROVED'}
24+
Octokit.pull_request_reviews(base_repo, id).any? { |r| r['state'] == 'APPROVED' }
2525
end
2626

2727
def author_associated?
2828
# Checks whether the author is associated with the repo that the PR is against:
2929
# either the owner of that repo, someone invited to collaborate, or a member
3030
# of the organization who owns that repository.
31-
%w(OWNER COLLABORATOR MEMBER).include? @pr['author_association']
31+
%w[OWNER COLLABORATOR MEMBER].include? @pr['author_association']
3232
end
3333

3434
def equals?(id:, sha:)

spec/commands/check_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ def stub_prs(uri, body)
8787
context 'when there is more than one open pull request' do
8888
before do
8989
stub_prs('https://api.github.com/repos/jtarchie/test/pulls?direction=asc&per_page=100&sort=updated&state=open', [
90-
{ number: 1, head: { sha: 'abcdef', repo: { full_name: 'jtarchie/test' } }, base: { repo: { full_name: 'jtarchie/test' } } },
91-
{ number: 2, head: { sha: 'zyxwvu', repo: { full_name: 'someotherowner/repo' } }, base: { repo: { full_name: 'jtarchie/test' } } }
92-
])
90+
{ number: 1, head: { sha: 'abcdef', repo: { full_name: 'jtarchie/test' } }, base: { repo: { full_name: 'jtarchie/test' } } },
91+
{ number: 2, head: { sha: 'zyxwvu', repo: { full_name: 'someotherowner/repo' } }, base: { repo: { full_name: 'jtarchie/test' } } }
92+
])
9393
end
9494

9595
it 'returns all PRs oldest to newest last' do

spec/filters/approval_spec.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
describe Filters::Approval do
77
let(:ignore_pr) do
88
PullRequest.new(pr: { 'number' => 1, 'head' => { 'sha' => 'abc' }, 'author_association' => 'NONE',
9-
'base' => { 'repo' => {'full_name' => 'user/repo', 'permissions' => {'push' => true} } } })
9+
'base' => { 'repo' => { 'full_name' => 'user/repo', 'permissions' => { 'push' => true } } } })
1010
end
1111

1212
let(:pr) do
1313
PullRequest.new(pr: { 'number' => 2, 'head' => { 'sha' => 'def' }, 'author_association' => 'OWNER',
14-
'base' => { 'repo' => {'full_name' => 'user/repo', 'permissions' => {'push' => true} } } })
14+
'base' => { 'repo' => { 'full_name' => 'user/repo', 'permissions' => { 'push' => true } } } })
1515
end
1616

1717
let(:pull_requests) { [ignore_pr, pr] }
@@ -36,7 +36,7 @@ def stub_json(uri, body)
3636
expect(filter.pull_requests).to eq pull_requests
3737
end
3838
end
39-
39+
4040
context 'when owner filtering is enabled' do
4141
it 'only returns PRs that are repo-owners' do
4242
payload = { 'source' => { 'repo' => 'user/repo', 'require_manual_approval' => false, 'require_review_approval' => false, 'authorship_restriction' => true } }
@@ -59,5 +59,4 @@ def stub_json(uri, body)
5959
expect(filter.pull_requests).to eq [pr]
6060
end
6161
end
62-
6362
end

spec/filters/mergeable_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55

66
describe Filters::Mergeable do
77
let(:ignore_pr) do
8-
PullRequest.new(pr: { 'number' => 1, 'head' => { 'sha' => 'abc' }, 'mergeable' => false})
8+
PullRequest.new(pr: { 'number' => 1, 'head' => { 'sha' => 'abc' }, 'mergeable' => false })
99
end
1010

1111
let(:pr) do
12-
PullRequest.new(pr: { 'number' => 2, 'head' => { 'sha' => 'def' }, 'mergeable' => true})
12+
PullRequest.new(pr: { 'number' => 2, 'head' => { 'sha' => 'def' }, 'mergeable' => true })
1313
end
1414

1515
let(:pull_requests) { [ignore_pr, pr] }

0 commit comments

Comments
 (0)