This repository has been archived by the owner on Jan 30, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve coverage of the github PR review module. (#316)
- Loading branch information
Showing
12 changed files
with
289 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,4 +74,5 @@ object Patch { | |
} | ||
} | ||
.map(_.fileToPatch) | ||
.filterOrElse(_.nonEmpty, PatchError(patch)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
@@ -43,6 +43,8 @@ final case class ConfigError(error: String) extends Exception | ||
final class GlobalConfig(config: Configuration) { | ||
private[this] val logger = Log(classOf[Scala], "config") | ||
|
||
+ // TODO: test | ||
+ | ||
val baseUrl: ConfigErrorOr[Uri] = | ||
config | ||
.get(CoreProperties.SERVER_BASE_URL) | ||
@@ -58,8 +60,6 @@ final class GlobalConfig(config: Configuration) { | ||
)(Uri.fromString) | ||
.leftMap(f => ConfigError(f.sanitized)) | ||
|
||
- val pullRequest: EitherT[Option, ConfigError, PullRequest] = getPullRequest | ||
- | ||
/** | ||
* Pull request mode which enables PR decoration | ||
* (for both issues and coverage). | ||
@@ -77,7 +77,7 @@ final class GlobalConfig(config: Configuration) { | ||
* Post coverage data as PR comments. | ||
*/ | ||
def coverageDecoration: Boolean = | ||
- pullRequest.exists(!_.disableCoverage).getOrElse(false) | ||
+ false | ||
|
||
private[this] def getPullRequest: EitherT[Option, ConfigError, PullRequest] = | ||
for { |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
@@ -26,8 +26,6 @@ sealed trait ReviewError extends Exception | ||
case object NoFilesInPR extends ReviewError | ||
|
||
sealed trait PrStatus extends Product with Serializable | ||
-case object Pending extends PrStatus | ||
-case object Success extends PrStatus | ||
final case class Error(reviewStatus: ReviewStatus) extends PrStatus | ||
final case class Failure(error: Throwable) extends PrStatus | ||
|
||
@@ -45,13 +43,8 @@ object ReviewStatus { | ||
s"$blockers blocker${form(blockers)}" | ||
case ReviewStatus(_, critical) if critical > 0 => | ||
s"$critical critical issue${form(critical)}" | ||
- case _ => | ||
- "no critical or blocker issues" | ||
} | ||
} | ||
- | ||
- private[pr] def form(i: Int): String = | ||
- if (i > 1) "s" else "" | ||
} | ||
|
||
final case class Markdown(text: String) extends AnyVal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.