Skip to content

Commit 0b843b0

Browse files
committed
Rename Sync.PullRequest -> Sync.GithubPullRequest to follow conventions
1 parent a32240e commit 0b843b0

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

lib/code_corps/github/sync/pull_request/body_parser.ex renamed to lib/code_corps/github/sync/github_pull_request/body_parser.ex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
defmodule CodeCorps.GitHub.Sync.PullRequest.BodyParser do
1+
defmodule CodeCorps.GitHub.Sync.GithubPullRequest.BodyParser do
22
@moduledoc ~S"""
33
In charge of extracting ids from markdown content, paired to a predefined list
44
of keywords.
55
"""
66

77
@doc ~S"""
8-
Searchs for GitHub closing keyword format inside a content string. Returns all
9-
unique ids matched, as integers.
8+
Searches for GitHub closing keyword format inside a content string.
9+
Returns all unique ids matched, as integers.
1010
"""
1111
@spec extract_closing_ids(String.t) :: list(integer)
1212
def extract_closing_ids(content) when is_binary(content) do

lib/code_corps/github/sync/pull_request/pull_request.ex renamed to lib/code_corps/github/sync/github_pull_request/gitub_pull_request.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
defmodule CodeCorps.GitHub.Sync.PullRequest do
1+
defmodule CodeCorps.GitHub.Sync.GithubPullRequest do
22
@moduledoc ~S"""
33
In charge of finding a pull request to link with a `GithubPullRequest` record
44
when processing a GitHub Pull Request payload.
@@ -56,7 +56,7 @@ defmodule CodeCorps.GitHub.Sync.PullRequest do
5656
defp create_pull_request(params) do
5757
%GithubPullRequest{}
5858
|> GithubPullRequest.create_changeset(params)
59-
|> Repo.insert
59+
|> Repo.insert()
6060
end
6161

6262
@spec update_pull_request(GithubPullRequest.t(), map) :: linking_result

lib/code_corps/github/sync/sync.ex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ defmodule CodeCorps.GitHub.Sync do
139139
end)
140140
|> Multi.run(:github_pull_request, fn %{repo: github_repo, fetch_pull_request: pr_payload} ->
141141
pr_payload
142-
|> Sync.PullRequest.create_or_update_pull_request(github_repo)
142+
|> Sync.GithubPullRequest.create_or_update_pull_request(github_repo)
143143
end)
144144
|> Multi.run(:github_issue, fn %{repo: github_repo, github_pull_request: github_pull_request} ->
145145
issue_payload
@@ -394,7 +394,7 @@ defmodule CodeCorps.GitHub.Sync do
394394
end)
395395
|> Multi.run(:github_pull_request, fn %{repo: github_repo} ->
396396
pr_payload
397-
|> Sync.PullRequest.create_or_update_pull_request(github_repo)
397+
|> Sync.GithubPullRequest.create_or_update_pull_request(github_repo)
398398
end)
399399
|> Multi.run(:github_issue, fn %{fetch_issue: issue_payload, repo: github_repo, github_pull_request: github_pull_request} ->
400400
issue_payload
@@ -465,7 +465,7 @@ defmodule CodeCorps.GitHub.Sync do
465465
with {:ok, repo} <- repo |> mark_repo("fetching_pull_requests"),
466466
{:ok, pr_payloads} <- repo |> API.Repository.pulls |> sync_step(:fetch_pull_requests),
467467
{:ok, repo} <- repo |> mark_repo("syncing_github_pull_requests", %{syncing_pull_requests_count: pr_payloads |> Enum.count}),
468-
{:ok, pull_requests} <- pr_payloads |> Enum.map(&Sync.PullRequest.create_or_update_pull_request(&1, repo)) |> ResultAggregator.aggregate |> sync_step(:sync_pull_requests),
468+
{:ok, pull_requests} <- pr_payloads |> Enum.map(&Sync.GithubPullRequest.create_or_update_pull_request(&1, repo)) |> ResultAggregator.aggregate |> sync_step(:sync_pull_requests),
469469
{:ok, repo} <- repo |> mark_repo("fetching_issues"),
470470
{:ok, issue_payloads} <- repo |> API.Repository.issues |> sync_step(:fetch_issues),
471471
{:ok, repo} <- repo |> mark_repo("syncing_github_issues", %{syncing_issues_count: issue_payloads |> Enum.count}),

test/lib/code_corps/github/sync/pull_request/body_parser_test.exs renamed to test/lib/code_corps/github/sync/github_pull_request/body_parser_test.exs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
defmodule CodeCorps.GitHub.Sync.PullRequest.BodyParserTest do
1+
defmodule CodeCorps.GitHub.Sync.GithubPullRequest.BodyParserTest do
22
@moduledoc false
33

44
use ExUnit.Case, async: true
55

66
alias CodeCorps.{
7-
GitHub.Sync.PullRequest.BodyParser
7+
GitHub.Sync.GithubPullRequest.BodyParser
88
}
99

1010
describe "extract_closing_ids/1" do

test/lib/code_corps/github/sync/pull_request/pull_request_test.exs renamed to test/lib/code_corps/github/sync/github_pull_request/github_pull_request_test.exs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
defmodule CodeCorps.GitHub.Sync.PullRequestTest do
1+
defmodule CodeCorps.GitHub.Sync.GithubPullRequestTest do
22
@moduledoc false
33

44
use CodeCorps.DbAccessCase
@@ -18,7 +18,7 @@ defmodule CodeCorps.GitHub.Sync.PullRequestTest do
1818
%{"pull_request" => attrs} = @payload
1919
github_repo = insert(:github_repo)
2020
{:ok, %GithubPullRequest{} = created_pull_request} =
21-
Sync.PullRequest.create_or_update_pull_request(attrs, github_repo)
21+
Sync.GithubPullRequest.create_or_update_pull_request(attrs, github_repo)
2222

2323
assert Repo.one(GithubPullRequest)
2424

@@ -40,7 +40,7 @@ defmodule CodeCorps.GitHub.Sync.PullRequestTest do
4040
pull_request = insert(:github_pull_request, github_id: pull_request_id, github_repo: github_repo)
4141

4242
{:ok, %GithubPullRequest{} = updated_pull_request} =
43-
Sync.PullRequest.create_or_update_pull_request(attrs, github_repo)
43+
Sync.GithubPullRequest.create_or_update_pull_request(attrs, github_repo)
4444

4545
assert updated_pull_request.id == pull_request.id
4646
assert updated_pull_request.github_repo_id == github_repo.id
@@ -52,7 +52,7 @@ defmodule CodeCorps.GitHub.Sync.PullRequestTest do
5252
github_repo = insert(:github_repo)
5353

5454
{:error, changeset} =
55-
Sync.PullRequest.create_or_update_pull_request(attrs, github_repo)
55+
Sync.GithubPullRequest.create_or_update_pull_request(attrs, github_repo)
5656
refute changeset.valid?
5757
end
5858
end

0 commit comments

Comments
 (0)