Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
mzuehlke committed Dec 3, 2024
1 parent e6131eb commit 65dfdc8
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 9 deletions.
4 changes: 2 additions & 2 deletions docs/repo-specific-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ updates.pin = [ { groupId = "com.example", artifactId="foo", version = "1.1." }
# Defaults to empty `[]` which mean Scala Steward will not ignore dependencies.
updates.ignore = [ { groupId = "org.acme", artifactId="foo", version = "1.0" } ]

# The dependencies which match the given pattern are retracted: Their existing Pull-Request will be closed.
# The dependencies which match the given pattern are retracted. Their existing pull-request will be closed.
#
# Each entry must have a `reason, a `doc` URL and a list of dependency patterns.
# Each entry must have a `reason`, a `doc` URL and a list of dependency patterns.
updates.retracted = [
{
reason = "Ignore version 3.6.0 as it is abandoned due to broken compatibility",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ final class StewardAlg[F[_]](config: Config)(implicit
dataAndFork <- repoCacheAlg.checkCache(repo)
(data, fork) = dataAndFork
_ <- nurtureAlg.closeRetractedPullRequests(data)
states <- pruningAlg.needsAttention(data)
result <- states.traverse_(states =>
statesO <- pruningAlg.needsAttention(data)
result <- statesO.traverse_(states =>
nurtureAlg.nurture(data, fork, states.map(_.update))
)
} yield result,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ final class PullRequestRepository[F[_]](kvStore: KeyValueStore[F, Repo, Map[Uri,
repo: Repo,
allRetractedArtifacts: List[RetractedArtifact]
): F[List[(PullRequestData[Id], RetractedArtifact)]] =
kvStore.getOrElse(repo, Map.empty).map { pullRequets: Map[Uri, Entry] =>
kvStore.getOrElse(repo, Map.empty).map { pullRequets =>
pullRequets.flatMap {
case (
url,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ final case class RetractedArtifact(
}

def retractionMsg: String =
s"""|Retracted because of: ${reason}.
s"""|PR retracted because of: ${reason}.
|
|Documentation: ${doc}
|""".stripMargin.trim
|""".stripMargin
}

object RetractedArtifact {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,24 @@ class PullRequestRepositoryTest extends FunSuite {
assertEquals(obtained.head._2, retractedPortableScala)
}

test("getRetractedPullRequests with retractions for different version") {
val retractedPortableScala = RetractedArtifact(
"a reason",
"doc URI",
List(
UpdatePattern(
"org.portable-scala".g,
Some("sbt-scalajs-crossproject"),
Some(VersionPattern(exact = Some("2.0.0")))
)
)
)
val (_, obtained) = beforeAndAfterPRCreation(portableScala) { repo =>
pullRequestRepository.getRetractedPullRequests(repo, List(retractedPortableScala))
}
assertEquals(obtained, List.empty[(PullRequestData[Id], RetractedArtifact)])
}

test("findLatestPullRequest ignores grouped updates") {
val (_, result) = beforeAndAfterPRCreation(groupedUpdate(portableScala)) { repo =>
pullRequestRepository.findLatestPullRequest(repo, portableScala.crossDependency, "1.0.0".v)
Expand Down
4 changes: 2 additions & 2 deletions modules/docs/mdoc/repo-specific-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ updates.pin = [ { groupId = "com.example", artifactId="foo", version = "1.1." }
# Defaults to empty `[]` which mean Scala Steward will not ignore dependencies.
updates.ignore = [ { groupId = "org.acme", artifactId="foo", version = "1.0" } ]

# The dependencies which match the given pattern are retracted: Their existing Pull-Request will be closed.
# The dependencies which match the given pattern are retracted. Their existing pull-request will be closed.
#
# Each entry must have a `reason, a `doc` URL and a list of dependency patterns.
# Each entry must have a `reason`, a `doc` URL and a list of dependency patterns.
updates.retracted = [
{
reason = "Ignore version 3.6.0 as it is abandoned due to broken compatibility",
Expand Down

0 comments on commit 65dfdc8

Please sign in to comment.