Skip to content

Commit 216f9d4

Browse files
committed
abandoned -> inactive
1 parent e18681b commit 216f9d4

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

modules/core/src/main/scala/org/scalasteward/core/repocache/RepoCacheAlg.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ final class RepoCacheAlg[F[_]](config: Config)(implicit
5353
data <- maybeCache
5454
.filter(_.sha1 === latestSha1)
5555
.fold(cloneAndRefreshCache(repo, repoOut))(supplementCache(repo, _).pure[F])
56-
_ <- throwIfAbandoned(data)
56+
_ <- throwIfInactive(data)
5757
} yield (data, repoOut)
5858

5959
private def supplementCache(repo: Repo, cache: RepoCache): RepoData =
@@ -88,12 +88,12 @@ final class RepoCacheAlg[F[_]](config: Config)(implicit
8888
private def gatherDependencyInfo(repo: Repo, dependency: Dependency): F[DependencyInfo] =
8989
gitAlg.findFilesContaining(repo, dependency.version.value).map(DependencyInfo(dependency, _))
9090

91-
private[repocache] def throwIfAbandoned(data: RepoData): F[Unit] =
91+
private[repocache] def throwIfInactive(data: RepoData): F[Unit] =
9292
data.config.lastCommitMaxAge.traverse_ { maxAge =>
9393
dateTimeAlg.currentTimestamp.flatMap { now =>
9494
val sinceLastCommit = data.cache.commitDate.until(now)
95-
val isAbandoned = sinceLastCommit > maxAge
96-
F.raiseWhen(isAbandoned) {
95+
val isInactive = sinceLastCommit > maxAge
96+
F.raiseWhen(isInactive) {
9797
val msg = s"Skipping because last commit is older than ${dateTime.showDuration(maxAge)}"
9898
new Throwable(msg) with NoStackTrace
9999
}

modules/core/src/test/scala/org/scalasteward/core/repocache/RepoCacheAlgTest.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,32 +60,32 @@ class RepoCacheAlgTest extends CatsEffectSuite with Http4sDsl[MockEff] {
6060
assertIO(obtained, expected)
6161
}
6262

63-
test("throwIfAbandoned: no maxAge") {
63+
test("throwIfInactive: no maxAge") {
6464
val repo = Repo("repo-cache-alg", "test-1")
6565
val cache = RepoCache(dummySha1, Timestamp(0L), Nil, None, None)
6666
val config = RepoConfig.empty
6767
val data = RepoData(repo, cache, config)
68-
val obtained = repoCacheAlg.throwIfAbandoned(data).runA(MockState.empty).attempt
68+
val obtained = repoCacheAlg.throwIfInactive(data).runA(MockState.empty).attempt
6969
assertIO(obtained, Right(()))
7070
}
7171

72-
test("throwIfAbandoned: lastCommit < maxAge") {
72+
test("throwIfInactive: lastCommit < maxAge") {
7373
val repo = Repo("repo-cache-alg", "test-2")
7474
val commitDate = Timestamp.fromLocalDateTime(LocalDateTime.now())
7575
val cache = RepoCache(dummySha1, commitDate, Nil, None, None)
7676
val config = RepoConfig(lastCommitMaxAge = Some(1.day))
7777
val data = RepoData(repo, cache, config)
78-
val obtained = repoCacheAlg.throwIfAbandoned(data).runA(MockState.empty).attempt
78+
val obtained = repoCacheAlg.throwIfInactive(data).runA(MockState.empty).attempt
7979
assertIO(obtained, Right(()))
8080
}
8181

82-
test("throwIfAbandoned: lastCommit > maxAge") {
82+
test("throwIfInactive: lastCommit > maxAge") {
8383
val repo = Repo("repo-cache-alg", "test-3")
8484
val cache = RepoCache(dummySha1, Timestamp(0L), Nil, None, None)
8585
val config = RepoConfig(lastCommitMaxAge = Some(1.day))
8686
val data = RepoData(repo, cache, config)
8787
val obtained =
88-
repoCacheAlg.throwIfAbandoned(data).runA(MockState.empty).attempt.map(_.leftMap(_.getMessage))
88+
repoCacheAlg.throwIfInactive(data).runA(MockState.empty).attempt.map(_.leftMap(_.getMessage))
8989
assertIO(obtained, Left("Skipping because last commit is older than 1d"))
9090
}
9191
}

0 commit comments

Comments
 (0)