Skip to content

Scala Steward update version of unrelated library #3658

@PeuTit

Description

@PeuTit

Description

When multiple dependencies in an SBT project share the same version variable, and a new version for those dependencies is available, Scala Steward creates a commit that correctly updates the shared version variable. However, it then proceeds to create a second commit for another dependency that uses the same variable, but this time it incorrectly updates the version variable of an unrelated dependency which coincidently match the version.

Step to reproduce

Given the following dependencies on a SBT project:

  object version {
    val scalaTestPlus = "3.2.19.0"
    val jackson = "2.19.0"
  }

  val jacksonDatabind =
    "com.fasterxml.jackson.core" % "jackson-databind" % version.jackson
  val jacksonModuleScala =
    "com.fasterxml.jackson.module" %% "jackson-module-scala" % version.jackson

  val scalaTestPlus =
    "org.scalatestplus" %% "scalacheck-1-18" % version.scalaTestPlus
  1. A new version for the com.fasterxml.jackson.core:jackson-databind and com.fasterxml.jackson.module:jackson-module-scala artifacts is released (e.g., 2.19.1).
  2. Scala Steward runs and correctly identifies an update for jackson-databind. It creates a commit that updates the version.jackson variable:

Commit message: Scala Steward: update jackson-databind from 2.19.0 to 2.19.1.

-- val jackson = "2.19.0"
++ val jackson = "2.19.1"
  1. Scala Steward then incorrectly attempts to update jackson-module-scala in another commit, even though the shared jackson variable was already updated.

Expected Behaviour

Scala Steward should recognize that the version.jackson variable, which controls the version for jackson-module-scala, has already been updated in the previous commit. No further action should be taken for this dependency.

Current Behaviour

It somehow replace part of scalaTestPlus variable to jackson-databind version.

Commit message:
Scala Steward: update jackson-module-scala from 2.19.0 to 2.19.1

-- val scalaTestPlus = "3.2.19.0"
++ val scalaTestPlus = "3.2.19.1"

Which is incorrect.

You can find a minimal example here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions