Skip to content

Commit b9f6536

Browse files
Fixes code formatting issue (#691)
* Fixes code formatting issue * Replaces master references by main * Fixes PR number (against main branch) * scalafmtSbt * Fixes PullRequests IT * Fixes update branch ticket
1 parent 9c121b4 commit b9f6536

20 files changed

Lines changed: 79 additions & 77 deletions

File tree

github4s/src/main/scala/github4s/Decoders.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ object Decoders {
146146
svn_url <- c.downField("svn_url").as[String]
147147
permissions <- c.downField("permissions").as[Option[RepoPermissions]]
148148
default_branch <- c.downField("default_branch").as[String]
149-
topics <- c.downField("topics").as[Option[List[String]]].map(_.getOrElse(List.empty))
149+
topics <- c.downField("topics").as[Option[List[String]]].map(_.getOrElse(List.empty))
150150
repoUrls <- readRepoUrls(c)
151151
} yield RepositoryBase(
152152
id = id,

github4s/src/main/scala/github4s/algebras/GitData.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ trait GitData[F[_]] {
2626
* Get a Reference by name
2727
*
2828
* The ref in the URL must be formatted as `heads/branch`, not just branch.
29-
* For example, the call to get the data for `master` branch will be `heads/master`.
29+
* For example, the call to get the data for `main` branch will be `heads/main`.
3030
*
3131
* If the `ref` doesn't exist in the repository, but existing `refs` start with `ref` they will be
3232
* returned as an array. For example, a call to get the data for a branch named `feature`,
@@ -51,11 +51,11 @@ trait GitData[F[_]] {
5151
* Create a Reference
5252
*
5353
* The ref in the URL must be formatted as `heads/branch`, not just branch.
54-
* For example, the call to get the data for `master` branch will be `heads/master`.
54+
* For example, the call to get the data for `main` branch will be `heads/main`.
5555
*
5656
* @param owner of the repo
5757
* @param repo name of the repo
58-
* @param ref The name of the fully qualified reference (ie: refs/heads/master).
58+
* @param ref The name of the fully qualified reference (ie: refs/heads/main).
5959
* If it doesn't start with 'refs' and have at least two slashes, it will be rejected.
6060
* @param sha the SHA1 value to set this reference to
6161
* @param headers optional user headers to include in the request

github4s/src/main/scala/github4s/algebras/Repositories.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ trait Repositories[F[_]] {
109109
* @param owner of the repo
110110
* @param repo name of the repo
111111
* @param path the content path
112-
* @param ref the name of the commit/branch/tag. Default: the repository’s default branch (usually `master` or `main`)
112+
* @param ref the name of the commit/branch/tag. Default: the repository’s default branch (usually `main` or `main`)
113113
* @param pagination Limit and Offset for pagination
114114
* @param headers optional user headers to include in the request
115115
* @return GHResponse with the content details
@@ -398,7 +398,7 @@ trait Repositories[F[_]] {
398398
* @param body text describing the contents of the tag.
399399
* @param targetCommitish specifies the commitish value that determines where the Git tag is created from.
400400
* Can be any branch or commit SHA. Unused if the Git tag already exists.
401-
* Default: the repository's default branch (usually `master`).
401+
* Default: the repository's default branch (usually `main`).
402402
* @param draft `true` to create a draft (unpublished) release, `false` to createStatus a published one.
403403
* Default: `false`
404404
* @param prerelease `true` to identify the release as a prerelease.

github4s/src/test/scala/github4s/integration/PullRequestsSpec.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ trait PullRequestsSpec extends BaseIntegrationSpec {
225225
.getReview(
226226
validRepoOwner,
227227
validRepoName,
228-
validPullRequestNumber,
228+
validPullRequestReview,
229229
validPullRequestReviewNumber,
230230
headers = headerUserAgent
231231
)
@@ -261,7 +261,7 @@ trait PullRequestsSpec extends BaseIntegrationSpec {
261261
.createReview(
262262
validRepoOwner,
263263
validRepoName,
264-
validPullRequestNumber,
264+
validPullRequestReview,
265265
validCreatePRReviewRequest,
266266
headers = headerUserAgent
267267
)
@@ -285,7 +285,7 @@ trait PullRequestsSpec extends BaseIntegrationSpec {
285285
.createReview(
286286
validRepoOwner,
287287
validRepoName,
288-
validPullRequestNumber,
288+
validPullRequestReview,
289289
invalidCreatePRReviewRequest,
290290
headers = headerUserAgent
291291
)
@@ -364,13 +364,13 @@ trait PullRequestsSpec extends BaseIntegrationSpec {
364364
.updateBranch(
365365
validRepoOwner,
366366
validRepoName,
367-
validPullRequestNumber,
367+
692,
368368
headers = headerUserAgent
369369
)
370370
}
371371
.unsafeRunSync()
372372

373373
testIsRight[BranchUpdateResponse](response)
374-
response.statusCode shouldBe okStatusCode
374+
response.statusCode shouldBe acceptedStatusCode
375375
}
376376
}

github4s/src/test/scala/github4s/unit/ReposSpec.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ class ReposSpec extends BaseSpec {
108108

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

@@ -119,7 +119,7 @@ class ReposSpec extends BaseSpec {
119119
validRepoOwner,
120120
validRepoName,
121121
validFilePath,
122-
Some("master"),
122+
Some("main"),
123123
None,
124124
headerUserAgent
125125
)
@@ -237,7 +237,7 @@ class ReposSpec extends BaseSpec {
237237
validTagTitle,
238238
validTagTitle,
239239
validNote,
240-
Some("master"),
240+
Some("main"),
241241
Some(false),
242242
Some(true)
243243
)
@@ -257,7 +257,7 @@ class ReposSpec extends BaseSpec {
257257
validTagTitle,
258258
validTagTitle,
259259
validNote,
260-
Some("master"),
260+
Some("main"),
261261
Some(false),
262262
Some(true),
263263
headerUserAgent

github4s/src/test/scala/github4s/utils/TestData.scala

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ trait TestData {
7272

7373
val okStatusCode = 200
7474
val createdStatusCode = 201
75+
val acceptedStatusCode = 202
7576
val noContentStatusCode = 204
7677
val unauthorizedStatusCode = 401
7778
val notFoundStatusCode = 404
@@ -132,14 +133,15 @@ trait TestData {
132133
val validTagSha = "c3d0be41ecbe669545ee3e94d31ed9a4bc91ee3c"
133134

134135
val validPullRequestFileSha = "f80f79cafbe3f2ba71311b82e1171e73bd37a470"
135-
val validPullRequestNumber = 1
136+
val validPullRequestReview = 1
137+
val validPullRequestNumber = 637
136138
val validPullRequestReviewNumber = 39318789L
137139
val validMergeCommitSha = "e5bd3914e2e596debea16f433f57875b5b90bcd6"
138140

139141
val validHead = "test-pr-issue"
140142
val invalidHead = ""
141143

142-
val validBase = "master"
144+
val validBase = "main"
143145
val invalidBase = ""
144146

145147
val draft = false
@@ -283,7 +285,7 @@ trait TestData {
283285
val release = Release(
284286
id = 1,
285287
tag_name = validTagTitle,
286-
target_commitish = "master",
288+
target_commitish = "main",
287289
name = validTagTitle,
288290
body = validNote,
289291
draft = false,
@@ -409,7 +411,7 @@ trait TestData {
409411
"2011-01-26T19:01:12Z",
410412
s"https://github.com/$validRepoOwner/$validRepoName/commit/$validCommitSha"
411413
)
412-
val validBranchName = "master"
414+
val validBranchName = "main"
413415
val protectedBranch = Branch(
414416
name = validBranchName,
415417
commit = BranchCommit(

microsite/docs/activity.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,4 +110,4 @@ As you can see, a few features of the activity endpoint are missing.
110110

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

113-
[activity-scala]: https://github.com/47degrees/github4s/blob/master/github4s/src/main/scala/github4s/domain/Activity.scala
113+
[activity-scala]: https://github.com/47degrees/github4s/blob/main/github4s/src/main/scala/github4s/domain/Activity.scala

microsite/docs/auth.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,4 @@ As you can see, a few features of the authorization endpoint are missing.
9191

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

94-
[auth-scala]: https://github.com/47degrees/github4s/blob/master/github4s/src/main/scala/github4s/domain/Authorization.scala
94+
[auth-scala]: https://github.com/47degrees/github4s/blob/main/github4s/src/main/scala/github4s/domain/Authorization.scala

microsite/docs/contributing.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ You can also list statuses through `listStatuses`; it take as arguments:
211211
To list the statuses for a specific ref:
212212
213213
{triple backtick}scala mdoc:silent
214-
val listStatuses = gh.repos.listStatuses("47degrees", "github4s", "heads/master")
214+
val listStatuses = gh.repos.listStatuses("47degrees", "github4s", "heads/main")
215215
listStatuses.flatMap(_.result match {
216216
case Left(e) => IO.println(s"Something went wrong: ${e.getMessage}")
217217
case Right(r) => IO.println(r)
@@ -232,14 +232,14 @@ cd docs/target/site/ && jekyll serve
232232
```
233233

234234
[api-doc]: https://developer.github.com/v3/repos/statuses/#list-statuses-for-a-specific-ref
235-
[repos-domain]: https://github.com/47degrees/github4s/blob/master/github4s/src/main/scala/github4s/domain/Repository.scala
236-
[domain-pkg]: https://github.com/47degrees/github4s/blob/master/github4s/src/main/scala/github4s/domain/
237-
[repos-algebra]: https://github.com/47degrees/github4s/blob/master/github4s/src/main/scala/github4s/algebras/Repositories.scala
238-
[algebra-pkg]: https://github.com/47degrees/github4s/blob/master/github4s/src/main/scala/github4s/algebras/
239-
[repos-interpreter]: https://github.com/47degrees/github4s/blob/master/github4s/src/main/scala/github4s/interpreters/RepositoriesInterpreter.scala
240-
[httpclient]: https://github.com/47degrees/github4s/blob/master/github4s/src/main/scala/github4s/http/HttpClient.scala
241-
[integ-pkg]: https://github.com/47degrees/github4s/blob/master/github4s/src/test/scala/github4s/integration/
242-
[repos-integ-spec]: https://github.com/47degrees/github4s/blob/master/github4s/src/test/scala/github4s/integration/GHReposSpec.scala
243-
[unit-pkg]: https://github.com/47degrees/github4s/tree/master/github4s/src/test/scala/github4s/unit
244-
[repos-interpreter-spec]: https://github.com/47degrees/github4s/blob/master/github4s/src/test/scala/github4s/unit/ReposSpec.scala
245-
[repos-md]: https://github.com/47degrees/github4s/blob/master/docs/docs/repository.md
235+
[repos-domain]: https://github.com/47degrees/github4s/blob/main/github4s/src/main/scala/github4s/domain/Repository.scala
236+
[domain-pkg]: https://github.com/47degrees/github4s/blob/main/github4s/src/main/scala/github4s/domain/
237+
[repos-algebra]: https://github.com/47degrees/github4s/blob/main/github4s/src/main/scala/github4s/algebras/Repositories.scala
238+
[algebra-pkg]: https://github.com/47degrees/github4s/blob/main/github4s/src/main/scala/github4s/algebras/
239+
[repos-interpreter]: https://github.com/47degrees/github4s/blob/main/github4s/src/main/scala/github4s/interpreters/RepositoriesInterpreter.scala
240+
[httpclient]: https://github.com/47degrees/github4s/blob/main/github4s/src/main/scala/github4s/http/HttpClient.scala
241+
[integ-pkg]: https://github.com/47degrees/github4s/blob/main/github4s/src/test/scala/github4s/integration/
242+
[repos-integ-spec]: https://github.com/47degrees/github4s/blob/main/github4s/src/test/scala/github4s/integration/GHReposSpec.scala
243+
[unit-pkg]: https://github.com/47degrees/github4s/tree/main/github4s/src/test/scala/github4s/unit
244+
[repos-interpreter-spec]: https://github.com/47degrees/github4s/blob/main/github4s/src/test/scala/github4s/unit/ReposSpec.scala
245+
[repos-md]: https://github.com/47degrees/github4s/blob/main/docs/docs/repository.md

microsite/docs/docs.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ added by default.
189189

190190
[access-token]: https://github.com/settings/tokens
191191
[github-app]: https://github.com/settings/apps
192-
[access-token-scala]: https://github.com/47degrees/github4s/blob/master/github4s/src/main/scala/github4s/algebras/AccessToken.scala
193-
[access-token-scala]: https://github.com/47degrees/github4s/blob/master/github4s/src/main/scala/github4s/interpreters/StaticAccessToken.scala
192+
[access-token-scala]: https://github.com/47degrees/github4s/blob/main/github4s/src/main/scala/github4s/algebras/AccessToken.scala
193+
[access-token-scala]: https://github.com/47degrees/github4s/blob/main/github4s/src/main/scala/github4s/interpreters/StaticAccessToken.scala
194194
[cats-sync]: https://typelevel.org/cats-effect/typeclasses/sync.html
195195
[dispatcher]: https://typelevel.org/cats-effect/docs/std/dispatcher
196196
[http4s-client]: https://http4s.org/v0.23/client/

0 commit comments

Comments
 (0)