# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
#
# This source code is licensed under the BSD license found in the
# LICENSE file in the root directory of this source tree.

# If you change the versions below, please make sure they are in-sync
# with requirements-dev.txt

exclude: 'build|stubs'

default_language_version:
    python: python3

repos:
-   repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.0.1
    hooks:
    -   id: trailing-whitespace
    -   id: check-ast
    -   id: check-merge-conflict
    -   id: check-added-large-files
        args: ['--maxkb=500']
    -   id: end-of-file-fixer

-   repo: https://github.com/ambv/black
    rev: 22.3.0
    hooks:
    - id: black

-   repo: https://gitlab.com/pycqa/flake8
    rev: 4.0.1
    hooks:
    -   id: flake8
        args: [--show-source, --statistics]

-   repo: https://github.com/pycqa/isort
    rev: 5.10.1
    hooks:
    -   id: isort
        exclude: README.md
        additional_dependencies: [toml]

-   repo: https://github.com/pre-commit/mirrors-mypy
    rev: 'v0.910'
    hooks:
    -   id: mypy
        args: [--no-strict-optional, --ignore-missing-imports, --scripts-are-modules, --pretty]
        # See requirements-dev.txt for the reason for a fixed version of numpy here.
        additional_dependencies: [numpy==1.21.5]
