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