Skip to content
Snippets Groups Projects
Commit 6c9f8017 authored by Arsenij Solovjev's avatar Arsenij Solovjev
Browse files

[BUILD] name project title in review message

Extends the review message by the title of the project.
When a commit which affects multiple projects is reviewed
it will receive multiple reviews from Sonarqube (one for each
project). The review messages looked identical. Now they
should adress each project by name.
parent ae11f523
Branches master
No related tags found
No related merge requests found
...@@ -58,10 +58,12 @@ class IssuesParser(repo: GitRepo, config: Config) extends LazyLogging { ...@@ -58,10 +58,12 @@ class IssuesParser(repo: GitRepo, config: Config) extends LazyLogging {
val comments = merged(resourceReports.get map commentsPerResource) val comments = merged(resourceReports.get map commentsPerResource)
val projectTitle = config.getString(s"projects.$project.projectTitle")
if (comments == JNothing) if (comments == JNothing)
("message" -> s"Congratulations, QA found no issues whatsoever!") ("message" -> s"Congratulations, QA found no issues whatsoever in $projectTitle!")
else else
("message" -> s"Please review your QA analysis results") ~ ("message" -> s"Please review your QA analysis results for $projectTitle") ~
("comments" -> comments) ("comments" -> comments)
} }
......
...@@ -35,6 +35,7 @@ object ParserTest extends Specification with Mockito { ...@@ -35,6 +35,7 @@ object ParserTest extends Specification with Mockito {
val mockConfig = mock[Config] val mockConfig = mock[Config]
mockConfig.getString(s"projects.$project.issueReports") returns pathToReports mockConfig.getString(s"projects.$project.issueReports") returns pathToReports
mockConfig.getString(s"projects.$project.projectTitle") returns "Saros Core"
val issuesParser = new IssuesParser(mockRepo, mockConfig) val issuesParser = new IssuesParser(mockRepo, mockConfig)
...@@ -46,12 +47,12 @@ object ParserTest extends Specification with Mockito { ...@@ -46,12 +47,12 @@ object ParserTest extends Specification with Mockito {
"produce a confirmatory review message when no issues are found" in { "produce a confirmatory review message when no issues are found" in {
val review = issuesParser.parse(changeId, project) val review = issuesParser.parse(changeId, project)
compact(render(parse(review) \ "message")) mustEqual "\"Congratulations, QA found no issues whatsoever!\"" compact(render(parse(review) \ "message")) mustEqual "\"Congratulations, QA found no issues whatsoever in Saros Core!\""
} }
"produce a review message that prompts to review the issues found" in { "produce a review message that prompts to review the issues found" in {
val review = issuesParser.parse(changeId, project) val review = issuesParser.parse(changeId, project)
compact(render(parse(review) \ "message")) mustEqual "\"Please review your QA analysis results\"" compact(render(parse(review) \ "message")) mustEqual "\"Please review your QA analysis results for Saros Core\""
} }
"produce a comment for each line with an issue" in { "produce a comment for each line with an issue" in {
...@@ -62,7 +63,7 @@ object ParserTest extends Specification with Mockito { ...@@ -62,7 +63,7 @@ object ParserTest extends Specification with Mockito {
} }
"produce comments when issues are found" in { "produce comments when issues are found" in {
val lengthOfReview = 1942 val lengthOfReview = 1957
val review = issuesParser.parse(changeId, project) val review = issuesParser.parse(changeId, project)
compact(render(parse(review))).length mustEqual lengthOfReview compact(render(parse(review))).length mustEqual lengthOfReview
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment