aboutsummaryrefslogtreecommitdiff
path: root/.pre-commit-config.yaml
blob: 108f84387c98a871dd7841dc7895e1eca1501861 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# Copyright (c) 2023 Arm Limited.
#
# SPDX-License-Identifier: MIT
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
fail_fast: false

exclude: |
    (?x)^(
        data/.*|
        include/.*|
        src/CMakeLists.txt|
        src/Bazel.build|
        Android.bp|
        src/core/NEON/kernels/convolution/.*|
        src/core/NEON/kernels/arm_gemm/.*|
        src/core/NEON/kernels/arm_conv/.*|
        compute_kernel_writer/validation/.*
    )$

repos:
  - repo: local
    hooks:
      - id: format-code
        name: ACL Format Code Script
        stages: [commit]
        language: python
        entry: python ./scripts/format_code.py --files=git-diff
        pass_filenames: false
        additional_dependencies: ['psutil==5.8.0', 'Jinja2==3.0.1']
      - id: prepare-cmake-build-files
        name: Prepare CMake build files
        stages: [commit]
        language: python
        entry: python ./scripts/generate_build_files.py --cmake
        pass_filenames: false
      - id: prepare-bazel-build-files
        name: Prepare Bazel build files
        stages: [commit]
        language: python
        entry: python ./scripts/generate_build_files.py --bazel
        pass_filenames: false
      - id: fix-header-guards-ckw
        name: Fix header guards in CKW
        stages: [commit]
        language: python
        entry: python ./scripts/check_header_guards.py --extensions=h,hh,hpp,inl --comment_style=double_slash --prefix=CKW --include=compute_kernel_writer/ --add_extension --drop_outermost_subdir
        pass_filenames: true
      - id: fix-header-guards-acl
        name: Fix header guards in ACL
        stages: [commit]
        language: python
        entry: python ./scripts/check_header_guards.py --extensions=h,hh,hpp,inl --comment_style=double_slash --prefix=ACL --exclude=compute_kernel_writer/,src/core/NEON/kernels/convolution/,src/core/NEON/kernels/arm_gemm/,src/core/NEON/kernels/arm_conv/,include/ --add_extension
        pass_filenames: true
  - repo: https://github.com/pre-commit/mirrors-clang-format
    rev: v14.0.6
    hooks:
      - id: clang-format
        files: .*\.(cpp|h|hpp|hh|cc|inl|c)$
        exclude: |
            (?x)^(
              tests/.*
            )$
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.4.0
    hooks:
      - id: end-of-file-fixer
        stages: [commit]
      - id: trailing-whitespace
        stages: [commit]
      - id: mixed-line-ending
        args: ['--fix=lf']
        description: Forces to replace line ending by the UNIX 'lf' character.
      - id: check-added-large-files
        args: ['--maxkb=100']
        stages: [commit]