summaryrefslogtreecommitdiffstats
path: root/.pre-commit-config.yaml
blob: e933a9d99b09b893fa7b12b075bbf717de5c662a (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
93
94
95
96
---
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
files: ^(anta|docs|scripts|tests)/

repos:
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.4.0
    hooks:
      - id: trailing-whitespace
      - id: end-of-file-fixer
      - id: check-added-large-files
      - id: check-merge-conflict

  - repo: https://github.com/Lucas-C/pre-commit-hooks
    rev: v1.5.4
    hooks:
      - name: Check and insert license on Python files
        id: insert-license
        # exclude:
        files: .*\.py$
        args:
          - --license-filepath
          - .github/license-short.txt
          - --use-current-year
          - --allow-past-years
          - --fuzzy-match-generates-todo
          - --no-extra-eol

      - name: Check and insert license on Markdown files
        id: insert-license
        files: .*\.md$
        # exclude:
        args:
          - --license-filepath
          - .github/license-short.txt
          - --use-current-year
          - --allow-past-years
          - --fuzzy-match-generates-todo
          - --comment-style
          - '<!--|  ~|  -->'

  - repo: https://github.com/astral-sh/ruff-pre-commit
    rev: v0.3.5
    hooks:
    - id: ruff
      name: Run Ruff linter
      args: [ --fix ]
    - id: ruff-format
      name: Run Ruff formatter

  - repo: local  # as per https://pylint.pycqa.org/en/latest/user_guide/installation/pre-commit-integration.html
    hooks:
      - id: pylint
        entry: pylint
        language: python
        name: Check code style with pylint
        description: This hook runs pylint.
        types: [python]
        args:
          - -rn                      # Only display messages
          - -sn                      # Don't display the score
          - --rcfile=pyproject.toml  # Link to config file

  - repo: https://github.com/codespell-project/codespell
    rev: v2.2.6
    hooks:
      - id: codespell
        name: Checks for common misspellings in text files.
        entry: codespell
        language: python
        types: [text]

  - repo: https://github.com/pre-commit/mirrors-mypy
    rev: v1.9.0
    hooks:
      - id: mypy
        name: Check typing with mypy
        args:
          - --config-file=pyproject.toml
        additional_dependencies:
          - "aio-eapi==0.3.0"
          - "click==8.1.3"
          - "click-help-colors==0.9.1"
          - "cvprac~=1.3"
          - "netaddr==0.8.0"
          - "pydantic~=2.0"
          - "PyYAML==6.0"
          - "requests>=2.27"
          - "rich~=13.4"
          - "asyncssh==2.13.1"
          - "Jinja2==3.1.2"
          - types-PyYAML
          - types-paramiko
          - types-requests
        files: ^(anta|tests)/