Skip to content

Commit

Permalink
Fixes code formatting issue (#691)
Browse files Browse the repository at this point in the history
* Fixes code formatting issue

* Replaces master references by main

* Fixes PR number (against main branch)

* scalafmtSbt

* Fixes PullRequests IT

* Fixes update branch ticket
  • Loading branch information
juanpedromoreno authored Sep 16, 2021
1 parent 9c121b4 commit b9f6536
Show file tree
Hide file tree
Showing 20 changed files with 79 additions and 77 deletions.
2 changes: 1 addition & 1 deletion github4s/src/main/scala/github4s/Decoders.scala
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ object Decoders {
svn_url <- c.downField("svn_url").as[String]
permissions <- c.downField("permissions").as[Option[RepoPermissions]]
default_branch <- c.downField("default_branch").as[String]
topics <- c.downField("topics").as[Option[List[String]]].map(_.getOrElse(List.empty))
topics <- c.downField("topics").as[Option[List[String]]].map(_.getOrElse(List.empty))
repoUrls <- readRepoUrls(c)
} yield RepositoryBase(
id = id,
Expand Down
6 changes: 3 additions & 3 deletions github4s/src/main/scala/github4s/algebras/GitData.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ trait GitData[F[_]] {
* Get a Reference by name
*
* The ref in the URL must be formatted as `heads/branch`, not just branch.
* For example, the call to get the data for `master` branch will be `heads/master`.
* For example, the call to get the data for `main` branch will be `heads/main`.
*
* If the `ref` doesn't exist in the repository, but existing `refs` start with `ref` they will be
* returned as an array. For example, a call to get the data for a branch named `feature`,
Expand All @@ -51,11 +51,11 @@ trait GitData[F[_]] {
* Create a Reference
*
* The ref in the URL must be formatted as `heads/branch`, not just branch.
* For example, the call to get the data for `master` branch will be `heads/master`.
* For example, the call to get the data for `main` branch will be `heads/main`.
*
* @param owner of the repo
* @param repo name of the repo
* @param ref The name of the fully qualified reference (ie: refs/heads/master).
* @param ref The name of the fully qualified reference (ie: refs/heads/main).
* If it doesn't start with 'refs' and have at least two slashes, it will be rejected.
* @param sha the SHA1 value to set this reference to
* @param headers optional user headers to include in the request
Expand Down
4 changes: 2 additions & 2 deletions github4s/src/main/scala/github4s/algebras/Repositories.scala
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ trait Repositories[F[_]] {
* @param owner of the repo
* @param repo name of the repo
* @param path the content path
* @param ref the name of the commit/branch/tag. Default: the repository’s default branch (usually `master` or `main`)
* @param ref the name of the commit/branch/tag. Default: the repository’s default branch (usually `main` or `main`)
* @param pagination Limit and Offset for pagination
* @param headers optional user headers to include in the request
* @return GHResponse with the content details
Expand Down Expand Up @@ -398,7 +398,7 @@ trait Repositories[F[_]] {
* @param body text describing the contents of the tag.
* @param targetCommitish specifies the commitish value that determines where the Git tag is created from.
* Can be any branch or commit SHA. Unused if the Git tag already exists.
* Default: the repository's default branch (usually `master`).
* Default: the repository's default branch (usually `main`).
* @param draft `true` to create a draft (unpublished) release, `false` to createStatus a published one.
* Default: `false`
* @param prerelease `true` to identify the release as a prerelease.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ trait PullRequestsSpec extends BaseIntegrationSpec {
.getReview(
validRepoOwner,
validRepoName,
validPullRequestNumber,
validPullRequestReview,
validPullRequestReviewNumber,
headers = headerUserAgent
)
Expand Down Expand Up @@ -261,7 +261,7 @@ trait PullRequestsSpec extends BaseIntegrationSpec {
.createReview(
validRepoOwner,
validRepoName,
validPullRequestNumber,
validPullRequestReview,
validCreatePRReviewRequest,
headers = headerUserAgent
)
Expand All @@ -285,7 +285,7 @@ trait PullRequestsSpec extends BaseIntegrationSpec {
.createReview(
validRepoOwner,
validRepoName,
validPullRequestNumber,
validPullRequestReview,
invalidCreatePRReviewRequest,
headers = headerUserAgent
)
Expand Down Expand Up @@ -364,13 +364,13 @@ trait PullRequestsSpec extends BaseIntegrationSpec {
.updateBranch(
validRepoOwner,
validRepoName,
validPullRequestNumber,
692,
headers = headerUserAgent
)
}
.unsafeRunSync()

testIsRight[BranchUpdateResponse](response)
response.statusCode shouldBe okStatusCode
response.statusCode shouldBe acceptedStatusCode
}
}
8 changes: 4 additions & 4 deletions github4s/src/test/scala/github4s/unit/ReposSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class ReposSpec extends BaseSpec {

implicit val httpClientMock: HttpClient[IO] = httpClientMockGet[NonEmptyList[Content]](
url = s"repos/$validRepoOwner/$validRepoName/contents/$validFilePath",
params = Map("ref" -> "master"),
params = Map("ref" -> "main"),
response = IO.pure(NonEmptyList.one(content))
)

Expand All @@ -119,7 +119,7 @@ class ReposSpec extends BaseSpec {
validRepoOwner,
validRepoName,
validFilePath,
Some("master"),
Some("main"),
None,
headerUserAgent
)
Expand Down Expand Up @@ -237,7 +237,7 @@ class ReposSpec extends BaseSpec {
validTagTitle,
validTagTitle,
validNote,
Some("master"),
Some("main"),
Some(false),
Some(true)
)
Expand All @@ -257,7 +257,7 @@ class ReposSpec extends BaseSpec {
validTagTitle,
validTagTitle,
validNote,
Some("master"),
Some("main"),
Some(false),
Some(true),
headerUserAgent
Expand Down
10 changes: 6 additions & 4 deletions github4s/src/test/scala/github4s/utils/TestData.scala
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ trait TestData {

val okStatusCode = 200
val createdStatusCode = 201
val acceptedStatusCode = 202
val noContentStatusCode = 204
val unauthorizedStatusCode = 401
val notFoundStatusCode = 404
Expand Down Expand Up @@ -132,14 +133,15 @@ trait TestData {
val validTagSha = "c3d0be41ecbe669545ee3e94d31ed9a4bc91ee3c"

val validPullRequestFileSha = "f80f79cafbe3f2ba71311b82e1171e73bd37a470"
val validPullRequestNumber = 1
val validPullRequestReview = 1
val validPullRequestNumber = 637
val validPullRequestReviewNumber = 39318789L
val validMergeCommitSha = "e5bd3914e2e596debea16f433f57875b5b90bcd6"

val validHead = "test-pr-issue"
val invalidHead = ""

val validBase = "master"
val validBase = "main"
val invalidBase = ""

val draft = false
Expand Down Expand Up @@ -283,7 +285,7 @@ trait TestData {
val release = Release(
id = 1,
tag_name = validTagTitle,
target_commitish = "master",
target_commitish = "main",
name = validTagTitle,
body = validNote,
draft = false,
Expand Down Expand Up @@ -409,7 +411,7 @@ trait TestData {
"2011-01-26T19:01:12Z",
s"https://github.com/$validRepoOwner/$validRepoName/commit/$validCommitSha"
)
val validBranchName = "master"
val validBranchName = "main"
val protectedBranch = Branch(
name = validBranchName,
commit = BranchCommit(
Expand Down
2 changes: 1 addition & 1 deletion microsite/docs/activity.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,4 @@ As you can see, a few features of the activity endpoint are missing.

As a result, if you'd like to see a feature supported, feel free to create an issue and/or a pull request!

[activity-scala]: https://github.com/47degrees/github4s/blob/master/github4s/src/main/scala/github4s/domain/Activity.scala
[activity-scala]: https://github.com/47degrees/github4s/blob/main/github4s/src/main/scala/github4s/domain/Activity.scala
2 changes: 1 addition & 1 deletion microsite/docs/auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,4 @@ As you can see, a few features of the authorization endpoint are missing.

As a result, if you'd like to see a feature supported, feel free to create an issue and/or a pull request!

[auth-scala]: https://github.com/47degrees/github4s/blob/master/github4s/src/main/scala/github4s/domain/Authorization.scala
[auth-scala]: https://github.com/47degrees/github4s/blob/main/github4s/src/main/scala/github4s/domain/Authorization.scala
24 changes: 12 additions & 12 deletions microsite/docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ You can also list statuses through `listStatuses`; it take as arguments:
To list the statuses for a specific ref:
{triple backtick}scala mdoc:silent
val listStatuses = gh.repos.listStatuses("47degrees", "github4s", "heads/master")
val listStatuses = gh.repos.listStatuses("47degrees", "github4s", "heads/main")
listStatuses.flatMap(_.result match {
case Left(e) => IO.println(s"Something went wrong: ${e.getMessage}")
case Right(r) => IO.println(r)
Expand All @@ -232,14 +232,14 @@ cd docs/target/site/ && jekyll serve
```

[api-doc]: https://developer.github.com/v3/repos/statuses/#list-statuses-for-a-specific-ref
[repos-domain]: https://github.com/47degrees/github4s/blob/master/github4s/src/main/scala/github4s/domain/Repository.scala
[domain-pkg]: https://github.com/47degrees/github4s/blob/master/github4s/src/main/scala/github4s/domain/
[repos-algebra]: https://github.com/47degrees/github4s/blob/master/github4s/src/main/scala/github4s/algebras/Repositories.scala
[algebra-pkg]: https://github.com/47degrees/github4s/blob/master/github4s/src/main/scala/github4s/algebras/
[repos-interpreter]: https://github.com/47degrees/github4s/blob/master/github4s/src/main/scala/github4s/interpreters/RepositoriesInterpreter.scala
[httpclient]: https://github.com/47degrees/github4s/blob/master/github4s/src/main/scala/github4s/http/HttpClient.scala
[integ-pkg]: https://github.com/47degrees/github4s/blob/master/github4s/src/test/scala/github4s/integration/
[repos-integ-spec]: https://github.com/47degrees/github4s/blob/master/github4s/src/test/scala/github4s/integration/GHReposSpec.scala
[unit-pkg]: https://github.com/47degrees/github4s/tree/master/github4s/src/test/scala/github4s/unit
[repos-interpreter-spec]: https://github.com/47degrees/github4s/blob/master/github4s/src/test/scala/github4s/unit/ReposSpec.scala
[repos-md]: https://github.com/47degrees/github4s/blob/master/docs/docs/repository.md
[repos-domain]: https://github.com/47degrees/github4s/blob/main/github4s/src/main/scala/github4s/domain/Repository.scala
[domain-pkg]: https://github.com/47degrees/github4s/blob/main/github4s/src/main/scala/github4s/domain/
[repos-algebra]: https://github.com/47degrees/github4s/blob/main/github4s/src/main/scala/github4s/algebras/Repositories.scala
[algebra-pkg]: https://github.com/47degrees/github4s/blob/main/github4s/src/main/scala/github4s/algebras/
[repos-interpreter]: https://github.com/47degrees/github4s/blob/main/github4s/src/main/scala/github4s/interpreters/RepositoriesInterpreter.scala
[httpclient]: https://github.com/47degrees/github4s/blob/main/github4s/src/main/scala/github4s/http/HttpClient.scala
[integ-pkg]: https://github.com/47degrees/github4s/blob/main/github4s/src/test/scala/github4s/integration/
[repos-integ-spec]: https://github.com/47degrees/github4s/blob/main/github4s/src/test/scala/github4s/integration/GHReposSpec.scala
[unit-pkg]: https://github.com/47degrees/github4s/tree/main/github4s/src/test/scala/github4s/unit
[repos-interpreter-spec]: https://github.com/47degrees/github4s/blob/main/github4s/src/test/scala/github4s/unit/ReposSpec.scala
[repos-md]: https://github.com/47degrees/github4s/blob/main/docs/docs/repository.md
4 changes: 2 additions & 2 deletions microsite/docs/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ added by default.

[access-token]: https://github.com/settings/tokens
[github-app]: https://github.com/settings/apps
[access-token-scala]: https://github.com/47degrees/github4s/blob/master/github4s/src/main/scala/github4s/algebras/AccessToken.scala
[access-token-scala]: https://github.com/47degrees/github4s/blob/master/github4s/src/main/scala/github4s/interpreters/StaticAccessToken.scala
[access-token-scala]: https://github.com/47degrees/github4s/blob/main/github4s/src/main/scala/github4s/algebras/AccessToken.scala
[access-token-scala]: https://github.com/47degrees/github4s/blob/main/github4s/src/main/scala/github4s/interpreters/StaticAccessToken.scala
[cats-sync]: https://typelevel.org/cats-effect/typeclasses/sync.html
[dispatcher]: https://typelevel.org/cats-effect/docs/std/dispatcher
[http4s-client]: https://http4s.org/v0.23/client/
Expand Down
2 changes: 1 addition & 1 deletion microsite/docs/gist.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,4 @@ See [the API doc](https://developer.github.com/v3/gists/#edit-a-gist) for full r
As you can see, a few features of the gist endpoint are missing. As a result, if you'd like to see a
feature supported, feel free to create an issue and/or a pull request!

[gist-scala]: https://github.com/47degrees/github4s/blob/master/github4s/src/main/scala/github4s/domain/Gist.scala
[gist-scala]: https://github.com/47degrees/github4s/blob/main/github4s/src/main/scala/github4s/domain/Gist.scala
14 changes: 7 additions & 7 deletions microsite/docs/git_data.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ val gh = Github[IO](httpClient, accessToken)
### Get a Reference

The ref must be formatted as `heads/branch`, not just `branch`.
For example, the call to get the data, the `master` branch will be `heads/master`.
For example, the call to get the data, the `main` branch will be `heads/main`.

If the `ref` doesn't exist in the repository, but existing `refs` start with `ref` they will be
returned as an array. For example, a call to get the data for a branch named `feature`,
Expand All @@ -56,7 +56,7 @@ You can get a reference using `getReference`, it takes as arguments:
- `pagination`: Limit and Offset for pagination, optional.

```scala mdoc:compile-only
val getReference = gh.gitData.getReference("47degrees", "github4s", "heads/master")
val getReference = gh.gitData.getReference("47degrees", "github4s", "heads/main")
getReference.flatMap(_.result match {
case Left(e) => IO.println(s"Something went wrong: ${e.getMessage}")
case Right(r) => IO.println(r)
Expand All @@ -71,20 +71,20 @@ See [the API doc](https://developer.github.com/v3/git/refs/#get-a-reference) for
### Create a Reference

The ref must be formatted as `heads/branch`, not just `branch`.
For example, the call to get the data, the `master` branch will be `heads/master`.
For example, the call to get the data, the `main` branch will be `heads/main`.

You can create a reference using `createReference`; it takes as arguments:

- the repository coordinates (`owner` and `name` of the repository).
- `ref`: The name of the fully qualified reference (e.g.: `refs/heads/master`).
- `ref`: The name of the fully qualified reference (e.g.: `refs/heads/main`).
If it doesn't start with 'refs' and has at least two slashes, it will be rejected.
- `sha`: the SHA1 value to set this reference.

```scala mdoc:compile-only
val createReference = gh.gitData.createReference(
"47deg",
"github4s",
"refs/heads/master",
"refs/heads/main",
"d3b048c1f500ee5450e5d7b3d1921ed3e7645891")
createReference.flatMap(_.result match {
case Left(e) => IO.println(s"Something went wrong: ${e.getMessage}")
Expand All @@ -111,7 +111,7 @@ Setting it to `false` will make sure you're not overwriting work. Default: `fals
val updateReference = gh.gitData.updateReference(
"47deg",
"github4s",
"heads/master",
"heads/main",
"d3b048c1f500ee5450e5d7b3d1921ed3e7645891",
false)
updateReference.flatMap(_.result match {
Expand Down Expand Up @@ -329,4 +329,4 @@ As you can see, a few features of the git data endpoint are missing.

As a result, if you'd like to see a feature supported, feel free to create an issue and/or a pull request!

[gitdata-scala]: https://github.com/47degrees/github4s/blob/master/github4s/src/main/scala/github4s/domain/GitData.scala
[gitdata-scala]: https://github.com/47degrees/github4s/blob/main/github4s/src/main/scala/github4s/domain/GitData.scala
14 changes: 7 additions & 7 deletions microsite/docs/issue.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ Lastly, you can also search issues all across Github thanks to `searchIssues`; i
arguments:

- a `query` string (the URL encoding is taken care of by Github4s).
- a list of [SearchParam](https://github.com/47degrees/github4s/blob/master/github4s/shared/src/main/scala/github4s/free/domain/SearchParam.scala).
- a list of [SearchParam](https://github.com/47degrees/github4s/blob/main/github4s/shared/src/main/scala/github4s/free/domain/SearchParam.scala).

Let's say we want to search for the Scala bugs (<https://github.com/scala/bug>) which contain
the "existential" keyword in their title:
Expand Down Expand Up @@ -468,8 +468,8 @@ As you can see, a few features of the issue endpoint are missing.

As a result, if you'd like to see a feature supported, feel free to create an issue and/or a pull request!

[issue-scala]: https://github.com/47degrees/github4s/blob/master/github4s/src/main/scala/github4s/domain/Issue.scala
[user-scala]: https://github.com/47degrees/github4s/blob/master/github4s/src/main/scala/github4s/domain/User.scala
[issue-scala]: https://github.com/47degrees/github4s/blob/main/github4s/src/main/scala/github4s/domain/Issue.scala
[user-scala]: https://github.com/47degrees/github4s/blob/main/github4s/src/main/scala/github4s/domain/User.scala

## Milestones

Expand Down Expand Up @@ -499,7 +499,7 @@ The `result` on the right is the corresponding [List[Milestone]][milestone-scala

See [the API doc](https://developer.github.com/v3/issues/milestones/#list-milestones-for-a-repository) for full reference.

[milestone-scala]: https://github.com/47degrees/github4s/blob/master/github4s/src/main/scala/github4s/domain/Milestone.scala
[milestone-scala]: https://github.com/47degrees/github4s/blob/main/github4s/src/main/scala/github4s/domain/Milestone.scala

### Create milestone

Expand Down Expand Up @@ -527,7 +527,7 @@ The `result` on the right is the corresponding [Milestone][milestone-scala]

See [the API doc](https://developer.github.com/v3/issues/milestones/#create-a-milestone) for full reference.

[milestone-scala]: https://github.com/47degrees/github4s/blob/master/github4s/src/main/scala/github4s/domain/Milestone.scala
[milestone-scala]: https://github.com/47degrees/github4s/blob/main/github4s/src/main/scala/github4s/domain/Milestone.scala

### Get a single milestone

Expand All @@ -552,7 +552,7 @@ The `result` on the right is the corresponding [Milestone][milestone-scala]

See [the API doc](https://developer.github.com/v3/issues/milestones/#get-a-single-milestone) for full reference.

[milestone-scala]: https://github.com/47degrees/github4s/blob/master/github4s/src/main/scala/github4s/domain/Milestone.scala
[milestone-scala]: https://github.com/47degrees/github4s/blob/main/github4s/src/main/scala/github4s/domain/Milestone.scala

### Update a milestone

Expand Down Expand Up @@ -581,7 +581,7 @@ The `result` on the right is the corresponding [Milestone][milestone-scala]

See [the API doc](https://developer.github.com/v3/issues/milestones/#update-a-milestone) for full reference.

[milestone-scala]: https://github.com/47degrees/github4s/blob/master/github4s/src/main/scala/github4s/domain/Milestone.scala
[milestone-scala]: https://github.com/47degrees/github4s/blob/main/github4s/src/main/scala/github4s/domain/Milestone.scala

### Delete a milestone

Expand Down
2 changes: 1 addition & 1 deletion microsite/docs/organization.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,4 @@ As you can see, a few features of the organization endpoint are missing.

As a result, if you'd like to see a feature supported, feel free to create an issue and/or a pull request!

[user-scala]: https://github.com/47degrees/github4s/blob/master/github4s/src/main/scala/github4s/domain/User.scala
[user-scala]: https://github.com/47degrees/github4s/blob/main/github4s/src/main/scala/github4s/domain/User.scala
Loading

0 comments on commit b9f6536

Please sign in to comment.