Skip to content

Commit 43120e9

Browse files
(Re)Adding service_name to CoverallsPayload (#315)
* (Re)Adding service_name to CoverallsPayload. * (Re)Adding service_name to CoverallsPayload. * Make test(s) pass (again).
1 parent 6901069 commit 43120e9

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

src/main/scala/org/scoverage/coveralls/CoverallPayloadWriter.scala

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class CoverallPayloadWriter(
2525
factory.createGenerator(file, JsonEncoding.UTF8)
2626
}
2727

28-
def start() {
28+
def start() = {
2929
gen.writeStartObject()
3030

3131
def writeOpt(fieldName: String, holder: Option[String]) =
@@ -36,11 +36,10 @@ class CoverallPayloadWriter(
3636
gen.writeStringField("repo_token", token)
3737
case CIServiceToken(token) =>
3838
gen.writeStringField("repo_token", token)
39-
writeOpt("service_name", service.map(_.name))
4039
case NoTokenNeeded =>
41-
writeOpt("service_name", service.map(_.name))
4240
}
4341

42+
writeOpt("service_name", service.map(_.name))
4443
writeOpt("service_job_id", service.flatMap(_.jobId))
4544
writeOpt("service_pull_request", service.flatMap(_.pullRequest))
4645
writeOpt("flag_name", sys.env.get("COVERALLS_FLAG_NAME"))
@@ -53,7 +52,7 @@ class CoverallPayloadWriter(
5352
gen.writeStartArray()
5453
}
5554

56-
private def addGitInfo() {
55+
private def addGitInfo() = {
5756
gen.writeFieldName("git")
5857
gen.writeStartObject()
5958

@@ -86,7 +85,7 @@ class CoverallPayloadWriter(
8685
gen.writeEndObject()
8786
}
8887

89-
private def addGitRemotes(remotes: Seq[String]) {
88+
private def addGitRemotes(remotes: Seq[String]) = {
9089
remotes.foreach(remote => {
9190
gen.writeStartObject()
9291
gen.writeStringField("name", remote)
@@ -95,7 +94,7 @@ class CoverallPayloadWriter(
9594
})
9695
}
9796

98-
def addSourceFile(report: SourceFileReport) {
97+
def addSourceFile(report: SourceFileReport) = {
9998
val repoRootDirStr =
10099
repoRootDir.getCanonicalPath.replace(File.separator, "/") + "/"
101100

src/main/scala/org/scoverage/coveralls/CoverallsAuth.scala

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,18 @@ import io.circe.generic.auto._
99
*/
1010
sealed trait CoverallsAuth
1111

12-
/** Auth strategy where a Coveralls-specific token is used. Works with every CI
13-
* service.
12+
/** Auth strategy where a Coveralls-specific token is used. Works
13+
* with every CI service.
1414
*/
1515
case class CoverallsRepoToken(token: String) extends CoverallsAuth
1616

17-
/** Auth strategy where a token specific to the CI service is used, such as a
18-
* GitHub token. Works on selected CI services supported by Coveralls.
17+
/** Auth strategy where a token specific to the CI service is used,
18+
* such as a GitHub token. Works on selected CI services supported
19+
* by Coveralls.
1920
*/
2021
case class CIServiceToken(token: String) extends CoverallsAuth
2122

22-
/** Auth strategy where no token is passed. This seems to work for Travis.
23+
/** Auth strategy where no token is passed. This seems to work
24+
* for Travis.
2325
*/
2426
case object NoTokenNeeded extends CoverallsAuth

src/test/scala/org/scoverage/coveralls/CoverallPayloadWriterTest.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,10 @@ class CoverallPayloadWriterTest
7575
payloadWriter.start
7676
payloadWriter.flush()
7777

78+
println(writer.toString())
79+
7880
writer.toString should equal(
79-
"""{"repo_token":"testRepoToken","service_job_id":"testServiceJob","parallel":false,""" +
81+
"""{"repo_token":"testRepoToken","service_name":"my-service","service_job_id":"testServiceJob","parallel":false,""" +
8082
expectedGit +
8183
""","source_files":["""
8284
)

0 commit comments

Comments
 (0)