Commit Graph

19 Commits

Author SHA1 Message Date
Sebastian Poxhofer 1f6546b7a9 fix(versioning/cargo): convert ranges to semver in subset and intersects (#45146)
`cargo2npm` exists because a bare `1.2.3` in Cargo means `^1.2.3` and
`0.4` means `^0.4`, since caret requirements are the default. Every
range-consuming function in this module converts through it: `isValid`,
`matches`, `isLessThanRange`, `getSatisfyingVersion`,
`minSatisfyingVersion` and `getNewValue`.

`subset` and `intersects` did not. The exported `api` is built from a
`...npm` spread and never overrode them, so they received Cargo syntax
and interpreted it as semver syntax. Read that way, `1.70` means
`1.70.x` rather than `^1.70`:

    subset('1.70', '1.63')      was false, is now true
    intersects('1.70', '1.63')  was false, is now true
    intersects('1.63', '1.70')  was false, is now true

`subset` is called by `applyConstraintsFiltering`, so repositories using
`constraintsFiltering: 'strict'` had crate releases dropped whenever the
release constraint differed from the configured one. `intersects` has no
caller in this repository today, but it is part of `VersioningApi` and
was wrong in the same way.

Both are now wrapped the way `composer` does it, including the
`try`/`catch`, because the underlying semver calls throw on ranges they
cannot parse.

The module had no tests for either function, which is why this was not
caught. Both are now covered, including the throwing path.
2026-08-10 11:03:19 +00:00
Sebastian Poxhofer 58771bb183 refactor(linters): enabled oxlints func-style (#44691)
* refactor(oxlint): enable func-style

Enable the built-in func-style rule as ["warn", "declaration"] so that
named functions are written as function declarations instead of arrow or
function expressions assigned to variables, matching the convention in
docs/development/best-practices.md (Functions section). Inline arrow
callbacks are unaffected; prefer-arrow-callback continues to cover the
callback direction.

Severity is "warn" instead of "error" as a fallback: a repo-wide run
found 196 pre-existing violations (70 in spec files, 126 in production
code), exceeding the 80-violation fix threshold for this change, so no
violations were fixed here. Follow-up work can convert the offenders
(largest clusters: lib/modules/versioning/ruby, lib/util/cache/package,
lib/modules/versioning/maven, lib/modules/versioning/gradle) and then
raise the rule to "error". Note oxlint 1.72 also supports an
allowTypeAnnotation option if typed consts should remain arrows.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* ci(linter): enforce func-style at error

* refactor(func-style): convert const-arrow functions to declarations in with-cache spec and ruby versioning

* refactor(func-style): convert const-arrow functions to declarations in maven/gradle modules

* refactor(func-style): convert const-arrow functions to declarations in remaining versioning modules

* refactor(func-style): convert const-arrow functions to declarations in platform modules

Discriminated-union closures (ensureCommentRemoval byTopic/byContent
helpers in github, gitlab, bitbucket, bitbucket-server) needed the
narrowed field passed explicitly as a parameter, since function
declarations are hoisted and lose the outer if-narrowing that inline
arrow-function closures previously relied on.

* refactor(func-style): convert const-arrow functions to declarations across util/manager/datasource modules

One case (logger/renovate-logger.ts logOnceFn) is kept as an arrow
function with a documented oxlint-disable: it is stored on
this.logger.once[level] and relies on lexically-bound this, which a
hoisted function declaration would not preserve.

* refactor(func-style): convert remaining const-arrow test helpers to declarations

get-updated.spec.ts: hoisted expectPipCompilePackageAndLockFile to
module scope (it only closes over the module-level pipCompile mock)
and added a documented oxlint-disable for vitest/expect-expect on its
caller test, since oxlint's expect-expect check does not trace
assertions through an externally-defined helper function.

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-19 11:14:22 +00:00
Nahrin cc32f48c9c docs(versioning): replace bare links with descriptive markdown links in urls (#43951)
* fix(versioning): replace bare links with descriptive markdown links in urls

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor: export markdownLinkRegex from common.ts and import in test

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-15 06:30:54 +00:00
Sebastian Poxhofer 73b90e958b refactor: remove string concetation for production code (#43442)
refactor: prefer templates rather than `+`
2026-05-19 13:31:27 +00:00
Sergei Zharinov 930cf6633c refactor: Rewrite imports with .ts extensions (#40700)
fix: Additional vi.mock path corrections and prettier formatting
2026-01-26 22:48:17 +00:00
Rhys Arkins 0d5d7a8669 refactor!: remove rangeStrategy=pin from versioning modules (#36261)
Refactors `getNewValue` logic to replace it with an optional
`getPinnedValue()` where rangeStrategy=pin. This way each versioning
module doesn't need to add and test extensive "pin" logic.

This should not be breaking, but out of an abundance of caution, we'll
mark it as such.
2025-11-06 08:07:40 +00:00
Sergei Zharinov 7c79c11285 fix: Always use default import from upath and semver-stable (#37325) 2025-08-05 11:01:45 +00:00
Rhys Arkins 67935500d7 feat(versioning): isBreaking (#31859)
Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2025-05-09 08:17:14 +00:00
Sergei Zharinov 6af55c2cfe fix(cargo): Skip "replace" range upgrade if new version still matches (#33773) 2025-01-23 11:27:07 +00:00
Rhys Arkins e11badfe4c fix(versioning/cargo): bump simple versions to newVersion (#28632)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2024-04-25 08:12:06 +00:00
Rhys Arkins 4c77554ebd fix(versioning/cargo): consistent range precision length (#27386) 2024-02-18 10:37:25 +00:00
rami3l f9ae909058 fix(cargo): fix handling of x and x.y versions (#26263) 2023-12-13 15:17:04 +00:00
Sergei Zharinov b69416ce17 refactor(prettier): Force trailing commas (#25631) 2023-11-07 15:50:29 +00:00
Michael Kriese 2431c5a6b6 fix: better branch code coverage (#24274) 2023-09-06 13:35:52 +00:00
RahulGautamSingh 938a36801e refactor: replace test.each with it.each (#21859) 2023-04-28 04:33:15 +00:00
Rhys Arkins 73c8227132 fix(versioning)!: bump short ranges to version (#20494)
When rangeStrategy=bump, and the existing range is "short" (e.g. `^1`), and a bump is required, the new result will be a version range (e.g. `^1.0.7`).

Closes #20488
2023-03-10 09:34:40 +01:00
Tobias Bieniek 36d5b07863 fix(versioning/cargo): Disable support for rangeStrategy: widen (#20357) 2023-02-12 20:25:30 +02:00
Tobias Bieniek 675e569daa fix(cargo): fix pinning for wildcard constraints (#20355) 2023-02-12 08:33:03 +02:00
Rhys Arkins dca3418bbd refactor: lib/modules (#14488)
Moves datasource, manager, platform and versioning code from lib/ into new lib/modules/

BREAKING CHANGE: External tools must update paths to datasource, manager, platform and versioning
2022-03-04 09:04:02 +01:00