Commit Graph

36 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
Jamie Tanna f932d52fbd feat(platform): get all branch update dates in a more performant manner (#44582)
* feat(platform): get all branch update dates in a more performant manner

When Renovate is working on a repository with many /potential/ branches,
as well as some actually created branches, it's possible for the
calculation for `commitHourlyLimit` to end up taking significant time.

This can lead to a less performant job generally, but can sometimes lead
to the Renovate job failing to complete, and then timing out when
executed by a job runner.

To handle this, we can instead use use `git for-each-ref` to look up
each Git ref (remotely) and request the commit date, which leads to a
much more performant lookup.

Co-authored-by: Claude Sonnet 5 <jamie.tanna+claude-code@mend.io>

* fixup! feat(platform): get all branch update dates in a more performant manner

Co-authored-by: Claude Sonnet 5 <jamie.tanna+claude-code@mend.io>

* fixup! Merge remote-tracking branch 'origin/HEAD' into wip/commit-hourly-slow

---------

Co-authored-by: Claude Sonnet 5 <jamie.tanna+claude-code@mend.io>
2026-07-21 13:17:58 +00:00
Jamie Tanna df7aa7b687 chore(workers/repository): instrument calculation of limits (#44581)
As part of an investigation around `commitHourlyLimit` performing slowly
on a repository with many branches, we can introduce more
instrumentation to be able to debug further.
2026-07-14 16:09:22 +00:00
Jamie Tanna 121f5df81d chore: log how many branches commitHourlyLimit is being calculated against (#44575)
As it can be useful to know on large repositories.
2026-07-14 13:55:42 +00:00
Felipe Santos 7ebba26236 feat: add commitHourlyLimit (#36226)
* feat: add `commitHourlyLimit`

Signed-off-by: Felipe Santos <felipe.santos@ericsson.com>

* Update docs/usage/configuration-options.md

Co-authored-by: RahulGautamSingh <rahultesnik@gmail.com>

* Remove date optionality

* Fix lint comment

* Fix coverage

* Restore contents of commit.spec.ts

* Use ! somewhere else too

* Change optional parameter to nullish

* Refactor `!` to use proper check

* Fix set-branch-commit.spec.ts lint

* Fix test coverage

* Apply suggestions from code review

Co-authored-by: RahulGautamSingh <rahultesnik@gmail.com>

* Split commit-limit-reached into two

* Fix review comments

* Use toUTC() where applicable

* Simplify another test to utc()

---------

Signed-off-by: Felipe Santos <felipe.santos@ericsson.com>
Co-authored-by: RahulGautamSingh <rahultesnik@gmail.com>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2026-02-19 18:00:32 +00:00
RahulGautamSingh 7a8dcdbd01 refactor(config/inherit): move onboardingBranch to InheritConfig (#40865)
* move onboardingBranch to InheritConfig

* fix lint issue

* fix import order

* more fixrs

* fix import

* fix imports
2026-02-15 08:17:11 +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
RahulGautamSingh 03f2229604 feat(config): allow multiple branch/pr limits (#32556) 2025-01-21 07:59:07 +00:00
Sebastian Poxhofer 3681b2a945 chore: eslint to enforce for typed imports (#30844) 2024-08-19 13:15:27 +00:00
Sergei Zharinov b69416ce17 refactor(prettier): Force trailing commas (#25631) 2023-11-07 15:50:29 +00:00
Florian Greinacher 666819e5e2 fix: allow more than 99 PRs/branches per repository (#24705) 2023-09-30 05:39:32 +00:00
kroonprins 03636915e4 feat(platform/azure): check targetBranch when finding PRs (#23941)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2023-08-25 08:26:14 +00:00
Rhys Arkins 36e2b328bb chore: update types reference 2023-08-15 11:31:15 +02:00
Markus Schulz dd6c8e5147 feat: Move some Git commands behind a PlatformScm interface (#19327)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2023-02-22 08:18:53 +00:00
RahulGautamSingh af3b2038f8 refactor: replace enums with union/object (#18903) 2022-11-14 20:55:38 +02:00
Sergei Zharinov 049d624be9 fix(limits): Re-throw ExternalHostError on calling getBranchPr (#17721) 2022-09-09 12:01:31 +00:00
Michael Kriese e5c6f38d75 refactor: enable strict checks (#16168)
* refactor:  enable strict checks

* chore: revert changes

* chore: fix tsconfig
2022-06-21 13:00:21 +02:00
RahulGautamSingh 03b0d2a24e refactor(lib/workers): fix null-check for tests (#16163)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2022-06-21 09:39:30 +00:00
Sergei Zharinov 0cf4f48842 refactor: Strict null checks for all files except tests (#16071)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2022-06-20 11:47:07 +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
Sergei Zharinov d680ff1e7c fix(limits): Use PR hourly limits to calculate remaining branch count (#10053)
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2021-05-19 15:50:37 +00:00
Michael Kriese 74d7691bef refactor: optimize type usage (#8947) 2021-03-02 21:44:55 +01:00
Sergei Zharinov 44004bf2d6 refactor(limits): Log more for concurrent branch detection (#8698) 2021-02-15 14:23:31 +01:00
Sergei Zharinov 746d170824 feat(limits): Add "branchConcurrentLimit" option (#8046)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2021-01-10 13:29:14 +01:00
Rhys Arkins 0b53e9462c fix: pass ExternalHostError up 2020-12-14 09:09:21 +01:00
Sergei Zharinov 683b87f845 fix(limits): Refactor hourly PR limit calculation (#7930)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2020-12-11 10:10:26 +01:00
Michael Kriese 0e10c4199f feat: replace moment with luxon (#7564) 2020-10-27 15:02:25 +01:00
Sergio Zharinov b2fde31693 fix(limits): Count concurrent PR with platform API instead of branches (#7421)
Co-authored-by: Rhys Arkins <rhys@arkins.net>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2020-10-07 12:07:25 +02:00
Sergio Zharinov 0ea1413e57 refactor(platform): Rename "branchName" to "sourceBranch" (#7284)
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2020-09-22 06:09:59 +02:00
Sergio Zharinov ad52ac9b13 fix(eslint): Restrict the rules and fix errors (#7117) 2020-08-31 13:13:02 +02:00
Rhys Arkins 012561f69a feat(git): get branch commit without cloning (#7130)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2020-08-30 22:03:58 +02:00
Rhys Arkins 52cddfde8b refactor: remove branch functions from platform (#6676) 2020-07-04 18:15:29 +02:00
Rhys Arkins 53ca91301f chore: import linting (#6105) 2020-05-01 18:03:48 +02:00
renovate[bot] 4f59b62da4 chore(deps): update dependency prettier to v2 (#5952)
* chore(deps): update dependency prettier to v2

* Run prettier-fix

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Jamie Magee <jamie.magee@gmail.com>
2020-04-12 18:09:36 +02:00
Michael Kriese 6c4892b593 chore(types): fix more typescript types (#5615) 2020-03-02 12:06:16 +01:00
Michael Kriese 62b18dee78 fix(ts): convert worker/repository/process to ts (#5046) 2020-01-06 08:16:15 +00:00