File size: 3,565 Bytes
8018595
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
default_language_version:
  python: python3.12

default_stages: [pre-commit]

repos:
  - repo: https://github.com/hakancelikdev/unimport
    rev: 1.3.0
    hooks:
      - id: unimport
        args:
          - --remove
  - repo: https://github.com/astral-sh/ruff-pre-commit
    rev: v0.13.1
    hooks:
      - id: ruff-format
      - id: ruff-check
        args: [--fix, --exit-non-zero-on-fix]

  - repo: https://github.com/kynan/nbstripout
    rev: 0.8.1
    hooks:
      - id: nbstripout

  - repo: https://github.com/codespell-project/codespell
    rev: v2.4.1
    hooks:
      - id: codespell
        name: codespell
        description: Checks for common misspellings in text files.
        entry: codespell --skip="*.js,*.html,*.css, *.svg" --ignore-words=.codespell-ignore.txt
        language: python
        types: [text]

  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v6.0.0
    hooks:
      - id: debug-statements
      - id: check-ast  # Simply check whether the files parse as valid python
      - id: check-case-conflict  # Check for files that would conflict in case-insensitive filesystems
      - id: check-builtin-literals  # Require literal syntax when initializing empty or zero Python builtin types
      - id: check-docstring-first  # Check a common error of defining a docstring after code
      - id: check-merge-conflict  # Check for files that contain merge conflict strings
      - id: check-yaml  # Check yaml files
        args: ["--unsafe"]  # Allows special tags in mkdocs.yaml
      - id: end-of-file-fixer  # Ensure that a file is either empty, or ends with one newline
        exclude: end-to-end-pipeline/web/.*
      - id: mixed-line-ending  # Replace or checks mixed line ending
      - id: trailing-whitespace  # This hook trims trailing whitespace
      - id: file-contents-sorter  # Sort the lines in specified files
        files: .*requirements*\.txt$

  - repo: https://github.com/google/yamlfmt
    rev: v0.17.2
    hooks:
      - id: yamlfmt
        args: ["-formatter", "retain_line_breaks_single=true,pad_line_comments=2"]

  - repo: https://github.com/asottile/pyupgrade
    rev: v3.20.0
    hooks:
      - id: pyupgrade
        args: [--py312-plus]

  # The following hook sorts and formats toml files
  - repo: https://github.com/pappasam/toml-sort
    rev: v0.24.3
    hooks:
      - id: toml-sort
        description: "Sort and format toml files."
        args:
          - --all
          - --in-place

  # The following hook checks for secrets in the code
  - repo: https://github.com/zricethezav/gitleaks
    rev: v8.28.0
    hooks:
      - id: gitleaks

  # The following hook checks for secrets in the code
  - repo: https://github.com/trufflesecurity/trufflehog
    rev: v3.90.8
    hooks:
      - id: trufflehog

  - repo: local
    hooks:
      - id: pylint
        name: pylint
        entry: pylint
        language: python
        additional_dependencies: ["pylint"]
        types: [python]
        args: ["--disable=all", "--enable=missing-docstring,unused-argument"]
        exclude: 'test_\.py$'

  # The following hook check docstrings quality
  - repo: https://github.com/terrencepreilly/darglint
    rev: v1.8.1
    hooks:
      - id: darglint
        args: ["--docstring-style=google"]
        exclude: 'src/sentinel/risk_models/qcancer\.py$'

    # The following hook checks for docstring in functions
  - repo: https://github.com/pycqa/pydocstyle
    rev: 6.3.0
    hooks:
      - id: pydocstyle
        args: ["--select=D103", "--match-dir=(genomics_research|projects)"]