Commit Graph

43 Commits

Author SHA1 Message Date
Sebastian Poxhofer 97327c3d28 refactor(linters): add prefer-coerce-array rule (#45492)
* refactor(linters): add prefer-coerce-array rule

Refs #45217

`x ?? []` and `coerceArray(x)` say the same thing, but only the second
one is searchable and consistent. The rule flags a `??` whose default is
a bare `[]` literal; a non-empty default or an asserted `([] as Foo[])`
still passes.

Applying it across `lib/` surfaced three spots the helper cannot cover,
which keep `?? []` with a disable comment or a narrower fix:

- `package-files.ts` destructures a tuple, which `coerceArray()` widens
- `generate.spec.ts` defaults `matchAll()`, an iterator rather than an array
- `mise/upgradeable-tooling.ts` declares a `Record` return, so its
  `?? []` fallback was wrong to begin with and becomes `coerceObject()`

* refactor(platform/github): hoist the GHE version header lookup

`Object.entries(...).find()` returns a tuple, and defaulting it with
`?? []` only to destructure the second element reads as an array
default when it is not one. Name the found entry instead, which drops
the `?? []` rather than routing a tuple through `coerceArray()`.
2026-08-28 09:27:58 +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
Jamie Tanna da5b7c3a67 chore: use a stable sort for manager extract durations (ms) (#41509)
As per request in #40091, we have cases where folks are using tools to
read or diff the `manager extract durations (ms)`

To improve this, we can make sure to perform a stable sort, by
alphabetically sorting our package manager names.

Co-authored-by: Claude Sonnet 4.5 <jamie.tanna+github-copilot@mend.io>
2026-02-26 13:36:13 +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
Jamie Tanna e1ad5c2ddd fix(instrumentation): instrument manager extractions (#39613)
As a means to provide more insight into how long package manager
extractions take when using instrumentation, we can wrap the individual
manager's extractions, as well as the filtering of packageFiles for each
manager.
2025-11-28 19:32:13 +00:00
RahulGautamSingh 76f911041a refactor: use named exports (#39196)
* use named exports

* fix test

* add missing imnport

* fix prettier
2025-11-10 12:00:35 +00:00
RahulGautamSingh 79556f4ecb refactor(enabled-managers): implement custom.<customMgrName> syntax (#24079)
Co-authored-by: Sebastian Poxhofer <secustor@users.noreply.github.com>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2023-11-08 13:13:26 +00:00
Sergei Zharinov b69416ce17 refactor(prettier): Force trailing commas (#25631) 2023-11-07 15:50:29 +00:00
RahulGautamSingh 6f9d37a6c0 feat(migrate): regexManagers -> customManagers (#24451)
Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com>
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2023-09-24 08:55:56 +00:00
Rhys Arkins d036c044c9 feat: initial bun support (#24464)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2023-09-18 18:10:00 +00:00
RahulGautamSingh 0613c24729 feat(managers/custom): introduce customType field (#23919)
Co-authored-by: Anne Stellingwerf <astellin@opentext.com>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2023-08-22 14:01:03 +00:00
RahulGautamSingh bf2c0693ac refactor(managers): implement custom managers api (#23357)
Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
Co-authored-by: Sebastian Poxhofer <secustor@users.noreply.github.com>
2023-08-15 17:12:54 +00:00
Rhys Arkins 9276a54069 refactor(scm): use scm for getFileList, checkoutBranch (#22006) 2023-05-07 04:12:15 +00:00
Rhys Arkins a3cc159f7e chore: extract and lookup duration logging (#20816) 2023-03-09 11:24:50 +00:00
Rhys Arkins cf6be1719e feat(cache): retain fingerprints for all matched managers (#20138) 2023-02-01 09:12:45 +01:00
RahulGautamSingh c7c5c8fb47 refactor: ExtractResult (#20131) 2023-01-31 20:05:23 +01:00
RahulGautamSingh abe821ac4d refactor: update WorkerExtractConfig type definition (#16020)
* update WorkerExtractConfig types

* update comment

* move worker-extract

* update CustomManager

* move interface RegExManagerTemplates manager->config

* fix import error

* rename CustomManager -> RegExManager

* fix lint error
2022-06-16 18:18:36 +02:00
RahulGautamSingh 87f85951a2 refactor: move update internal deps to lookup (#16059) 2022-06-15 04:21:37 +00:00
Sergei Zharinov 82da704955 refactor: Strict null checks for extract-related functions (#15806)
* refactor: Strict null checks for extract-related functions

* Fix

Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2022-06-02 14:25:20 +00:00
RahulGautamSingh 56170df9ae refactor: move updateInternalDeps to worker logic (#15790) 2022-05-31 03:53:25 +00:00
Michael Kriese 3ee32bce6c fix: Revert "fix: move update internal deps to worker logic" (#15756) 2022-05-27 16:44:58 +02:00
RahulGautamSingh 9e7659f754 fix: move update internal deps to worker logic (#15745) 2022-05-27 09:22:56 +02:00
Rhys Arkins c3acca8877 refactor: better manager types (#15708)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2022-05-24 07:01:43 +00: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
Rhys Arkins 5a23e9b4dc fix: no warn for enabledManagers 2021-10-09 05:50:00 +02:00
Oleg Krivtsov 9b4b6ce275 feat: enabledManagers log warning when empty (#11902) 2021-10-07 05:15:23 +00:00
Sergei Zharinov b957d4afb7 refactor(config): Extract interfaces from "index.ts" to separate "types.ts" (#9629) 2021-04-20 10:52:57 +02:00
Sergei Zharinov d1c8917a26 refactor(workers): Extract common file matching configuration logic (#9471) 2021-04-09 17:05:05 +02:00
Michael Kriese 74d7691bef refactor: optimize type usage (#8947) 2021-03-02 21:44:55 +01:00
Sergio Zharinov 8ab6d6076a refactor(workers): Extract 'getFileList' call outside of match loop (#7349) 2020-09-30 08:40:19 +02:00
Jamie Magee 456245aabe chore(eslint): enable typescript 3.7 rules (#6765) 2020-07-18 08:42:32 +02:00
Rhys Arkins b69e9c0f5a fix: Revert "feat(internal): cache extractions results (#6118)"
This reverts commit 51a43d5e41.
2020-05-05 16:01:49 +02:00
Rhys Arkins 51a43d5e41 feat(internal): cache extractions results (#6118) 2020-05-04 08:27:38 +02:00
Rhys Arkins 8d8b617ecd feat(internal): extract managers in parallel (#6112) 2020-05-03 19:21:10 +02:00
Rhys Arkins 0121cc48f5 refactor: extractAllDependencies 2020-05-03 17:27:35 +02:00
Rhys Arkins 899b351643 refactor: split extractAllDependencies logic 2020-05-03 17:03:23 +02:00
Rhys Arkins 273d9355e3 refactor: enabledManagers filtering 2020-05-03 16:15:22 +02:00
Rhys Arkins 53ca91301f chore: import linting (#6105) 2020-05-01 18:03:48 +02:00
Rhys Arkins c9071a7e54 fix: Revert "refactor: extract and update now decoupled (#5835)"
This reverts commit f04adc50df.
2020-04-14 12:56:44 +02:00
Yura Beznos f04adc50df refactor: extract and update now decoupled (#5835) 2020-04-14 06:58:27 +02:00
Rhys Arkins b2b8d7e953 feat: regex manager (#5617) 2020-03-06 09:07:55 +01:00
Rhys Arkins f1d0b7b5fe refactor: lower some levels from info to debug
Ref #5555
2020-02-24 09:26:42 +01:00
Jamie Magee 427fb1ce67 fix(ts): convert workers/repository/extract to typescript (#4956) 2019-12-12 05:38:40 +02:00