in modules/core/src/main/scala/org/scalasteward/core/edit/update/Selector.scala [171:224]
private def alternation[F[_]: Foldable](strings: F[String]): String =
strings.mkString_("(", "|", ")")
private def isCommonWord(s: String): Boolean =
s === "scala"
private def millVersionPositions(
update: Update.Single,
versionPositions: List[VersionPosition]
): List[VersionPosition] =
if (MillAlg.isMillMainUpdate(update))
versionPositions.filter(_.version.path.endsWith(MillAlg.millVersionName))
else List.empty
private def sbtVersionPositions(
update: Update.Single,
versionPositions: List[VersionPosition]
): List[VersionPosition] =
if (isSbtUpdate(update))
matchingSearchTerms(List("sbt.version"), versionPositions)
.filter(_.version.path.endsWith(buildPropertiesName))
else List.empty
private def scalafmtVersionPositions(
update: Update.Single,
versionPositions: List[VersionPosition]
): List[VersionPosition] =
if (isScalafmtCoreUpdate(update))
matchingSearchTerms(List("version"), versionPositions)
.filter(_.version.path.endsWith(scalafmtConfName))
else List.empty
private def moduleReplacements(
update: Update.Single,
modulePositions: List[ModulePosition]
): List[Substring.Replacement] =
update.forArtifactIds.toList.flatMap { forArtifactId =>
val newerGroupId = forArtifactId.newerGroupId
val newerArtifactId = forArtifactId.newerArtifactId
if (newerGroupId.isEmpty && newerArtifactId.isEmpty) List.empty
else {
val currentGroupId = forArtifactId.groupId
val currentArtifactId = forArtifactId.artifactIds.head
modulePositions
.filter { p =>
p.groupId.value === currentGroupId.value &&
currentArtifactId.names.contains_(p.artifactId.value)
}
.flatMap { p =>
newerGroupId.map(g => p.groupId.replaceWith(g.value)).toList ++
newerArtifactId.map(a => p.artifactId.replaceWith(a)).toList
}
}
}