Skip to content

Rename the AnUpdate hierarchy #2748

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

Merged
merged 2 commits into from
Nov 19, 2022
Merged

Rename the AnUpdate hierarchy #2748

merged 2 commits into from
Nov 19, 2022

Conversation

alejandrohdezma
Copy link
Member

This new ADT was introduced in #2714 for enabling supporting grouping updates, but the naming was not very good. This PR fixes the hierarchy names.

Renames in this PR

  • Update.Single => Update.ForArtifactId
  • Update.Group => Update.ForGroupId
  • Update => Update.Single
  • GroupedUpdate => Update.Grouped
  • AnUpdate => Update

Functional changes in this PR

Instead of deriving circe's Codec for the whole Update ADT, individual Decoder are created to ensure JSON created using older versions of Scala Steward will still be decoded.

implicit val ForGroupIdDecoder: Decoder[ForGroupId] = {
  val derived = deriveDecoder[ForGroupId]
  derived
    .prepare(_.downField("ForGroupId"))
    .or(derived.prepare(_.downField("Group")))
}

implicit val UpdateEncoder: Encoder[Update] = deriveEncoder

implicit val UpdateDecoder: Decoder[Update] =
    ForArtifactIdDecoder
      .widen[Update]
      .or(ForGroupIdDecoder.widen[Update])
      .or(Decoder[Grouped].widen[Update])

vs

implicit val UpdateCodec: Codec[Update] = deriveCodec

Changes:
- `Update.Single` => `Update.ForArtifactId`
- `Update.Group` => `Update.ForGroupId`
- `Update` => `Update.Single`
- `GroupedUpdate` => `Update.Grouped`
- `AnUpdate` => `Update`
@codecov
Copy link

codecov bot commented Oct 23, 2022

Codecov Report

Base: 80.51% // Head: 80.50% // Decreases project coverage by -0.00% ⚠️

Coverage data is based on head (e599e8b) compared to base (e185a73).
Patch coverage: 87.75% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2748      +/-   ##
==========================================
- Coverage   80.51%   80.50%   -0.01%     
==========================================
  Files         149      149              
  Lines        2853     2863      +10     
  Branches      191      189       -2     
==========================================
+ Hits         2297     2305       +8     
- Misses        556      558       +2     
Impacted Files Coverage Δ
...org/scalasteward/core/buildtool/mill/MillAlg.scala 75.00% <ø> (ø)
.../scala/org/scalasteward/core/data/UpdateData.scala 50.00% <ø> (ø)
...ain/scala/org/scalasteward/core/edit/EditAlg.scala 94.59% <ø> (ø)
...scala/org/scalasteward/core/edit/EditAttempt.scala 100.00% <ø> (ø)
...rg/scalasteward/core/edit/hooks/HookExecutor.scala 94.36% <ø> (ø)
.../scalasteward/core/edit/hooks/PostUpdateHook.scala 100.00% <ø> (ø)
.../core/edit/scalafix/ScalafixMigrationsFinder.scala 100.00% <ø> (ø)
...in/scala/org/scalasteward/core/git/CommitMsg.scala 100.00% <ø> (ø)
.../main/scala/org/scalasteward/core/io/package.scala 100.00% <ø> (ø)
...ala/org/scalasteward/core/nurture/NurtureAlg.scala 0.00% <0.00%> (ø)
... and 18 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@alejandrohdezma alejandrohdezma requested review from exoego and removed request for a team November 1, 2022 09:07
@alejandrohdezma alejandrohdezma requested review from a team and removed request for exoego November 10, 2022 07:36
@alejandrohdezma
Copy link
Member Author

@fthomas can we instruct Codacy here to ignore the _1/_2 usages on tuples? I don't think I have permission in Codacy to do so

Copy link
Contributor

@exoego exoego left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for late response.
I was trying to find better naming/hierarchy for those Update-classes, but ended in smoke.

For this PR, findings by CodeCov and Codacy are trivial and negligible, I think.

@alejandrohdezma alejandrohdezma merged commit d47311e into main Nov 19, 2022
@alejandrohdezma alejandrohdezma deleted the rename/an-update branch November 19, 2022 07:06
@exoego exoego added this to the 0.16.0 milestone Dec 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants