Files
renovate/lib/modules/manager/pre-commit
Sebastian Poxhofer 0583e54718 refactor(constants): add a platform family capability table (#46191)
* refactor(constants): add a platform family capability table

Every consumer of `detectPlatform` carried its own mapping from the
detected platform to a tags datasource or a web UI path, and the seven
`*_API_USING_HOST_TYPES` arrays were checked one by one to produce that
platform in the first place.

Introduce `PLATFORM_FAMILIES`, one record keyed by family holding the
host types, the hostnames which identify the family outright, the tags
datasource, the API base URL derivation and the web UI path to a
directory at the default branch. A family is a group of platforms, so
the ids are checked against `PlatformId`: a family which is not a
platform is a compile error. Not every platform is a family, because
codecommit, gerrit, local and scm-manager are never recognized from a
URL.

`detectPlatform` loops the table for both its hostname and its hostType
matching, and the consumers look their answers up:

- `github-actions` and `pre-commit` read `tagsDatasource` instead of
  importing the tags datasource classes.
- The PR body reads `webDirPath` instead of special-casing Bitbucket and
  Bitbucket Server.

`apiBaseUrl` has no consumer yet; the changelog sources pick it up in
the next commit.

`lib/util/http/auth.ts` and `lib/util/http/host-rules.ts` still read six
of the old arrays by name, so those stay as aliases of the table and are
migrated in a follow-up. `AZURE_API_USING_HOST_TYPES` had no other
consumer and is dropped.

Behaviour changes: none. `detectPlatform` now tests every known hostname
before its name heuristics instead of interleaving the two, which is
equivalent because the hostname lists are pairwise disjoint and no known
hostname contains the name of another family.

* Apply suggestion from @secustor
2026-09-21 15:27:50 +00:00
..

Important note: The pre-commit manager is disabled by default and must be opted into through config. Renovate's approach to version updating is not fully aligned with pre-commit autoupdate and this has caused frustration for pre-commit's creator/maintainer. Attempts to work with the pre-commit project to fix these gaps have been rejected, so we have chosen to disable the manager by default indefinitely. Please do not contact the pre-commit project/maintainer about any Renovate-related topic. To view a list of open issues related to the pre-commit manager in Renovate, see the filtered list using the manager:pre-commit label.

When enabled, Renovate supports updating of Git dependencies within pre-commit configuration .pre-commit-config.yaml files or other YAML files that use the same format (via managerFilePatterns configuration). Updates are performed if the files follow the conventional format used in typical pre-commit files:

repos:
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v1.0.0
    hooks:
      - id: some-hook-id

To enable the pre-commit manager, add the following config:

{
  "pre-commit": {
    "enabled": true
  }
}

Alternatively, add :enablePreCommit to your extends array.

Additional Dependencies

Renovate has partial support for additional_dependencies, currently Go, Node.js and Python only.

You will need to explicitly add the language to your hooks with additional_dependencies to let Renovate know what kind of dependencies they are.

Examples for the supported languages are listed below.

Go

- repo: https://github.com/rhysd/actionlint
  rev: v1.7.7
  hooks:
    - id: actionlint
      language: golang
      additional_dependencies:
        - 'github.com/wasilibs/go-shellcheck/cmd/shellcheck@v0.10.0'

Node.js

- repo: https://github.com/pre-commit/mirrors-prettier
  rev: v3.1.0
  hooks:
    - id: prettier
      language: node
      additional_dependencies:
        - '@trivago/prettier-plugin-sort-imports@^5.2.2'
        - prettier@^3.6.2

Python

- repo: https://github.com/psf/black
  rev: 19.3b0
  hooks:
    - id: black
      language: python
      additional_dependencies:
        - 'requests==1.1.1'