xref: /aosp_15_r20/external/bazelbuild-rules_python/.pre-commit-config.yaml (revision 60517a1edbc8ecf509223e9af94a7adec7d736b8)
1# Copyright 2023 The Bazel Authors. All rights reserved.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15# See CONTRIBUTING.md for instructions.
16# See https://pre-commit.com for more information
17# See https://pre-commit.com/hooks.html for more hooks
18repos:
19  - repo: https://github.com/keith/pre-commit-buildifier
20    rev: 6.1.0
21    hooks:
22      - id: buildifier
23        args: &args
24          # Keep this argument in sync with .bazelci/presubmit.yaml
25          - --warnings=all
26      - id: buildifier-lint
27        args: *args
28  - repo: https://github.com/pycqa/isort
29    rev: 5.12.0
30    hooks:
31      - id: isort
32        name: isort (python)
33        args:
34          - --profile
35          - black
36  - repo: https://github.com/psf/black
37    rev: 23.1.0
38    hooks:
39      - id: black
40  - repo: local
41    hooks:
42      - id: update-deleted-packages
43        name: Update deleted packages
44        language: system
45        entry: bazel run @rules_bazel_integration_test//tools:update_deleted_packages
46        files: ^((examples|tests)/.*/(MODULE.bazel|WORKSPACE|WORKSPACE.bzlmod|BUILD.bazel)|.bazelrc)$
47        pass_filenames: false
48      - id: update-bzlmod-lockfiles
49        name: Update bzlmod lockfiles
50        language: script
51        entry: ./tools/private/update_bzlmod_lockfiles.sh
52        files: ^python/
53        pass_filenames: false
54