Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore updates where currentVersion and newerVersion are identical #559

Merged
merged 2 commits into from
Jun 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,17 @@ object parser {
def msg(part: String) = s"failed to parse $part in '$str'"

for {
groupId <- Either.fromOption(moduleId.headOption, msg("groupId"))
groupId <- Either.fromOption(moduleId.headOption.filter(_.nonEmpty), msg("groupId"))
artifactId <- Either.fromOption(moduleId.lift(1), msg("artifactId"))
configurations = moduleId.lift(2)
currentVersion <- Either.fromOption(versions.headOption, msg("currentVersion"))
newerVersionsList = versions.drop(1).toList.filterNot(_.startsWith("InvalidVersion"))
currentVersion <- Either.fromOption(
versions.headOption.filter(_.nonEmpty),
msg("currentVersion")
)
newerVersionsList = versions
.drop(1)
.filterNot(v => v.startsWith("InvalidVersion") || v === currentVersion)
.toList
newerVersions <- Either.fromOption(Nel.fromList(newerVersionsList), msg("newerVersions"))
} yield Update.Single(groupId, artifactId, currentVersion, newerVersions, configurations)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,23 @@ class parserTest extends FunSuite with Matchers {

test("parseSingleUpdate: no groupId") {
val str = ":sbt-scalajs : 0.6.24 -> 0.6.25"
parseSingleUpdate(str).isLeft
parseSingleUpdate(str) shouldBe Left(s"failed to parse groupId in '$str'")
}

test("parseSingleUpdate: no current version") {
val str = "ch.qos.logback:logback-classic : -> 0.8.1 -> 0.9.30 -> 1.0.13"
parseSingleUpdate(str).isLeft
parseSingleUpdate(str) shouldBe Left(s"failed to parse currentVersion in '$str'")
}

test("parseSingleUpdate: no new versions") {
val str = "ch.qos.logback:logback-classic : 0.8 ->"
parseSingleUpdate(str).isLeft
parseSingleUpdate(str) shouldBe Left(s"failed to parse newerVersions in '$str'")
}

test("parseSingleUpdate: all new versions are invalid") {
val str =
"bigdataoss:gcs-connector : hadoop2-1.9.16 -> InvalidVersion(hadoop3-2.0.0-SNAPSHOT)"
parseSingleUpdate(str).isLeft
parseSingleUpdate(str) shouldBe Left(s"failed to parse newerVersions in '$str'")
}

test("parseSingleUpdate: one new version is invalid") {
Expand All @@ -72,7 +72,12 @@ class parserTest extends FunSuite with Matchers {
)
}

test("parseSingleUpdates 1") {
test("parseSingleUpdate: new version is current version") {
val str = "org.scalacheck:scalacheck:test : 1.14.0 -> 1.14.0"
parseSingleUpdate(str) shouldBe Left(s"failed to parse newerVersions in '$str'")
}

test("parseSingleUpdates: 3 updates") {
val str =
"""[info] Found 3 dependency updates for datapackage
|[info] ai.x:diff:test : 1.2.0 -> 1.2.1
Expand Down