-
Notifications
You must be signed in to change notification settings - Fork 55
/
.pre-commit-config.yaml
132 lines (132 loc) · 4.22 KB
/
.pre-commit-config.yaml
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
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
hooks:
- id: trailing-whitespace
exclude: '(^tests/|^tests_integration/|^tests_e2e)'
- id: end-of-file-fixer
exclude: license_header.txt
- id: check-yaml
exclude: .github/repo_meta.yaml
- id: debug-statements
exclude: src/snowflake/cli/_app/dev/pycharm_remote_debug.py
- id: check-ast
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: "v0.1.7"
hooks:
- id: ruff
args: [--fix, --exclude, "**/tests_common/,**/tests_integration/"]
- repo: https://github.com/psf/black
rev: 22.12.0
hooks:
- id: black
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.990
hooks:
- id: mypy
additional_dependencies: [types-pkg-resources==0.1.3, types-all==1.0.0]
- repo: https://github.com/codespell-project/codespell
rev: v2.2.4
hooks:
- id: codespell
additional_dependencies:
- tomli
- repo: local
hooks:
- id: check-print-in-code
language: pygrep
name: "Check for print statements"
entry: "print\\(|echo\\("
pass_filenames: true
files: ^src/snowflake/.*\.py$
exclude: >
(?x)
^src/snowflake/cli/api/console/.*$|
^src/snowflake/cli/_app/printing.py$|
^src/snowflake/cli/_app/dev/.*$|
^src/snowflake/cli/templates/.*$|
^src/snowflake/cli/api/utils/rendering.py$|
^src/snowflake/cli/_plugins/spcs/common.py$|
^src/snowflake/cli/_plugins/snowpark/venv.py$|
^src/snowflake/cli/_app/cli_app.py$
- id: check-app-imports-in-api
language: pygrep
name: "No top level cli._app imports in cli.api"
entry: "^from snowflake\\.cli\\._app"
pass_filenames: true
files: ^src/snowflake/cli/api/.*\.py$
- id: avoid-snowcli
language: pygrep
name: "Prefer snowflake CLI over snowcli"
entry: "snowcli"
pass_filenames: true
files: ^src/.*\.py$
exclude: ^src/snowflake/cli/_app/constants.py$
- id: dependencies-sync
name: "Copy dependencies from pyproject.toml to requirements.txt"
language: system
entry: python snyk/dependency-sync.py
files: ^pyproject.toml$
- id: use-local-requirements-model
language: pygrep
name: "Use snowflake.cli._plugins.snowpark.models.Requirement for requirements parsing"
files: ^src/snowflake/.*\.py$
entry: >
^from requirements.* import|
^import requirements.*
pass_filenames: true
exclude: ^src/snowflake/cli/_plugins/snowpark/models.py$
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.5.5
hooks:
- id: insert-license
name: Add license for all SQL files
files: \.sql$
exclude: |
(?x)
^\.github/|
tests/test_data/projects/.*|
tests_integration/test_data/projects/.*
args:
- --comment-style
- "/*||*/"
- --license-filepath
- scripts/LICENSE.txt
- --fuzzy-match-generates-todo
- id: insert-license
name: Add license for all toml files
files: \.toml$
args:
- --comment-style
- "|#|"
- --license-filepath
- scripts/LICENSE.txt
- --fuzzy-match-generates-todo
- id: insert-license
name: Add license for all Python files
exclude: |
(?x)
^\.github/|
tests/test_data/projects/.*|
tests_integration/test_data/projects/.*|
files: \.py$|\.pyi$
args:
- --comment-style
- "|#|"
- --license-filepath
- scripts/LICENSE.txt
- --fuzzy-match-generates-todo
- id: insert-license
name: Add license for all Markdown files
exclude: |
(?x)
^\.github/|
tests/test_data/projects/.*|
tests_integration/test_data/projects/.*
files: \.md$
args:
- --comment-style
- "<!--|| -->"
- --license-filepath
- scripts/LICENSE.txt
- --fuzzy-match-generates-todo