Skip to content

Commit 8ceff43

Browse files
committed
Well, not every rule requires VersionWithFirstSeen
1 parent 4b71ab5 commit 8ceff43

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

modules/core/src/main/scala/org/scalasteward/core/data/Update.scala

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ case class ArtifactForUpdate(
3535
def currentVersion: Version = headDependency.version
3636
}
3737

38-
trait ArtifactUpdateVersions {
38+
trait ArtifactUpdateVersions[V] {
3939
val artifactForUpdate: ArtifactForUpdate
4040

4141
val refersToUpdateVersions: Nel[Version]
@@ -51,14 +51,16 @@ trait ArtifactUpdateVersions {
5151
case class ArtifactUpdateCandidates(
5252
artifactForUpdate: ArtifactForUpdate,
5353
newerVersionsWithFirstSeen: Nel[VersionWithFirstSeen]
54-
) extends ArtifactUpdateVersions {
55-
override val refersToUpdateVersions: Nel[Version] = newerVersionsWithFirstSeen.map(_.version)
54+
) extends ArtifactUpdateVersions[VersionWithFirstSeen] {
55+
val newerVersions: Nel[Version] = newerVersionsWithFirstSeen.map(_.version)
56+
57+
override val refersToUpdateVersions: Nel[Version] = newerVersions
5658

5759
def asSpecificUpdate(nextVersion: Version): Update.ForArtifactId =
5860
Update.ForArtifactId(artifactForUpdate, nextVersion)
5961

6062
override def show: String =
61-
s"${artifactForUpdate.groupId}:${artifactForUpdate.crossDependency.showArtifactNames} : ${Version.show((artifactForUpdate.currentVersion +: refersToUpdateVersions.toList)*)}"
63+
s"${artifactForUpdate.groupId}:${artifactForUpdate.crossDependency.showArtifactNames} : ${Version.show((artifactForUpdate.currentVersion +: newerVersionsWithFirstSeen.map(_.version).toList)*)}"
6264
}
6365

6466
sealed trait Update {
@@ -125,7 +127,7 @@ object Update {
125127
artifactForUpdate: ArtifactForUpdate,
126128
nextVersion: Version
127129
) extends Single
128-
with ArtifactUpdateVersions {
130+
with ArtifactUpdateVersions[Version] {
129131
val crossDependency: CrossDependency = artifactForUpdate.crossDependency
130132

131133
override val refersToUpdateVersions: Nel[Version] = Nel.one(nextVersion)

modules/core/src/main/scala/org/scalasteward/core/repoconfig/UpdatePattern.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ object UpdatePattern {
3636
filteredVersions: List[VersionWithFirstSeen]
3737
)
3838

39-
def findMatch(
39+
def findMatch[V](
4040
patterns: List[UpdatePattern],
41-
update: ArtifactUpdateVersions,
41+
update: ArtifactUpdateVersions[V],
4242
include: Boolean,
43-
versionPredicate: VersionWithFirstSeen => Boolean = _ => true
43+
versionPredicate: V => Boolean = _ => true
4444
): MatchResult = {
4545
val artifactForUpdate = update.artifactForUpdate
4646
val byGroupId = patterns.filter(_.groupId === artifactForUpdate.groupId)

modules/core/src/main/scala/org/scalasteward/core/update/FilterAlg.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ object FilterAlg {
4343
type FilterResult = Either[RejectionReason, ArtifactUpdateCandidates]
4444

4545
sealed trait RejectionReason {
46-
def update: ArtifactUpdateVersions
46+
def update: ArtifactUpdateVersions[?]
4747
def show: String =
4848
this match {
4949
case IgnoredByConfig(_) => "ignored by config"

0 commit comments

Comments
 (0)