Skip to content
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

Filter out unwanted versions by regex #1560

Closed
ryanb93 opened this issue Aug 2, 2020 · 7 comments · Fixed by #2365
Closed

Filter out unwanted versions by regex #1560

ryanb93 opened this issue Aug 2, 2020 · 7 comments · Fixed by #2365
Labels
enhancement New feature or request

Comments

@ryanb93
Copy link
Contributor

ryanb93 commented Aug 2, 2020

Sometimes a library (usually internal company libraries) will publish snapshots, branch builds, or some other prefix/suffix to indicate a non-release build. For example something like:

1.0.1 to 1.0.2.feature/test
1.0.1 to 1.0.2.dev1234

Currently scala-steward will create a PR using this later version which is not ideal. It would be good to provide users of the service with a way of configuring dependencies to ignore these sort of versions. There is already support for ignoring SNAPSHOT, ALPHA, BETA, MILESTONE and RC - this could be extended to provide a negative order for a user defined list of string values, configured via .scala-steward.conf. Or it might be something that could be added to individual dependencies rather than a global setting.

@fthomas
Copy link
Member

fthomas commented Aug 14, 2020

There is already the updates.ignore setting in .scala-steward.conf which can be used to ignore updates that match a given pattern. It currently requires a groupId and can only match a prefix, or suffix of the version but maybe we can tweak that so that the groupId is optional and versions match if they contain a given string. I think I would prefer that to a new way to ignore updates.

@fthomas fthomas added the enhancement New feature or request label Aug 14, 2020
@esamson
Copy link
Contributor

esamson commented Oct 8, 2021

Just adding a specific use case of a library I'd like to ignore: early-access releases of javafx-web.

@fthomas
Copy link
Member

fthomas commented Oct 8, 2021

@esamson I think we can easily achieve this by adding ea to this list of pre-release identifiers:

case "SNAP" | "SNAPSHOT" | "NIGHTLY" => -5
case "ALPHA" | "PREVIEW" => -4
case "BETA" | "B" => -3
case "M" | "MILESTONE" | "AM" => -2
case "RC" => -1
case _ => 0

@fthomas
Copy link
Member

fthomas commented Nov 18, 2021

I propose to fix this by adding a new contains: Option[String] field to VersionPattern that matches substrings in the version. So for example, to prevent updates to versions like 1.0.2.feature/test, one would add this to .scala-steward.conf:

updates.ignore = [ { groupId = "org.example", version = { contains = "feature" } } ]

This entry would work for all dependencies with the org.example groupId. Would this work for you @ryanb93?

@ryanb93
Copy link
Contributor Author

ryanb93 commented Nov 18, 2021

I propose to fix this by adding a new contains: Option[String] field to VersionPattern that matches substrings in the version. So for example, to prevent updates to versions like 1.0.2.feature/test, one would add this to .scala-steward.conf:


updates.ignore = [ { groupId = "org.example", version = { contains = "feature" } } ]

This entry would work for all dependencies with the org.example groupId. Would this work for you @ryanb93?

That would work nicely for my use case.

@mzuehlke
Copy link
Member

What about the more generic version to give a regex instead of contains ?

@fthomas
Copy link
Member

fthomas commented Nov 19, 2021

I don't want to support regular expressions in .scala-steward.conf because of the possibility of DoS attacks: https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants