File size: 4,486 Bytes
05c9ac2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
repos:
-   repo: https://github.com/python/black
    rev: 22.3.0
    hooks:
    -   id: black
        exclude: >
            (?x)^(
                .*_pb2.py|
                .*_pb2.pyi|
                .*_pb2_grpc.py
            )$

-   repo: https://github.com/pre-commit/mirrors-mypy
    rev: v0.991
    hooks:
    -   id: mypy
        name: mypy-ml-agents
        files: "ml-agents/.*"
        args: [--ignore-missing-imports, --disallow-incomplete-defs, --no-strict-optional]
        additional_dependencies: [types-PyYAML, types-attrs, types-protobuf, types-setuptools, types-filelock]
    -   id: mypy
        name: mypy-ml-agents-envs
        files: "ml-agents-envs/.*"
        # Exclude protobuf files and don't follow them when imported
        exclude: ".*_pb2.py"
        args: [--ignore-missing-imports, --disallow-incomplete-defs, --no-strict-optional]
        additional_dependencies: [types-PyYAML, types-attrs, types-protobuf, types-setuptools, types-filelock]
-   repo: https://github.com/PyCQA/flake8
    rev: 3.9.2
    hooks:
    -   id: flake8
        exclude: >
            (?x)^(
                .*_pb2.py|
                .*_pb2_grpc.py
            )$
        # flake8-tidy-imports is used for banned-modules, not actually tidying
        additional_dependencies: [flake8-comprehensions==3.2.2, flake8-tidy-imports==4.1.0, flake8-bugbear==20.1.4]

-   repo: https://github.com/asottile/pyupgrade
    rev: v2.31.0
    hooks:
    -   id: pyupgrade
        args: [--py3-plus, --py36-plus]
        exclude: >
            (?x)^(
                .*_pb2.py|
                .*_pb2_grpc.py
            )$

-   repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.1.0
    hooks:
    -   id: mixed-line-ending
        exclude: >
            (?x)^(
                .*cs.meta|
                .*.css|
                .*.meta
            )$
        args: [--fix=lf]

    -   id: trailing-whitespace
        name: trailing-whitespace-markdown
        types: [markdown]
    -   id: check-merge-conflict
        args: [--assume-in-merge]
    -   id: check-yaml
        # Won't handle the templating in yamato
        exclude: \.yamato/.*

-   repo: https://github.com/pre-commit/pygrep-hooks
    rev: v1.9.0
    hooks:
    -   id: python-check-mock-methods

- repo: https://github.com/mattlqx/pre-commit-search-and-replace
  rev: v1.0.5
  hooks:
  - id: search-and-replace
    types: [markdown]
    exclude: ".*localized.*"

#- repo: https://github.com/dotnet/format
#  rev: v5.1.225507
#  hooks:
#  - id: dotnet-format
#    entry: dotnet-format whitespace
#    args: [--folder, --include]

# "Local" hooks, see https://pre-commit.com/#repository-local-hooks
-   repo: local
    hooks:
    -   id: dotnet-format
        name: dotnet-format
        language: system
        entry: dotnet format whitespace --folder --include
        types_or: ["c#"]
    -   id: markdown-link-check
        name: markdown-link-check
        entry: utils/run_markdown_link_check.py
        language: script
        types: [markdown]
        # Don't check localized files since their target might not be localized.
        exclude: ".*localized.*"
        # Only run manually, e.g. pre-commit run --hook-stage manual markdown-link-check
        stages: [manual]
    -   id: markdown-link-check-full
        name: markdown-link-check-full
        entry: utils/run_markdown_link_check.py
        language: script
        types: [markdown]
        # Don't check localized files since their target might not be localized.
        exclude: ".*localized.*"
        # Only run manually, e.g. pre-commit run --hook-stage manual markdown-link-check-full
        stages: [manual]
        args: [--check-remote]
    -   id: validate-versions
        name: validate library versions
        language: script
        entry: utils/validate_versions.py
        files: ".*/__init__.py"
    -   id: validate-init-py
        name: validate __init__.py files
        language: script
        entry: utils/validate_inits.py
        types: [python]
    -   id: validate-release-links-py
        name: validate release links
        language: script
        entry: utils/validate_release_links.py
        require_serial: true
    -   id: generate-markdown-docs
        name: generate markdown docs
        language: python
        entry: ./utils/generate_markdown_docs.py --package_dirs ml-agents-envs ml-agents
        pass_filenames: false
        additional_dependencies: [pyyaml, pydoc-markdown==3.10.1]