|
1 | 1 | repos: |
2 | | - # Python code formatting |
3 | | - - repo: https://github.com/psf/black |
4 | | - rev: 23.7.0 |
5 | | - hooks: |
6 | | - - id: black |
7 | | - language_version: python3 |
8 | | - args: [--line-length=88] |
9 | | - exclude: ^(sqlfluff_templater_schemachange\.egg-info/|build/|dist/|\.eggs/|\.git/|\.hg/|\.mypy_cache/|\.tox/|\.venv/|venv/|env/|ENV/|env\.bak/|venv\.bak/)$ |
| 2 | +# Python code formatting |
| 3 | +- repo: https://github.com/psf/black |
| 4 | + rev: 23.7.0 |
| 5 | + hooks: |
| 6 | + - id: black |
| 7 | + language_version: python3 |
| 8 | + args: [ --line-length=88 ] |
| 9 | + exclude: ^(sqlfluff_templater_schemachange\.egg-info/|build/|dist/|\.eggs/|\.git/|\.hg/|\.mypy_cache/|\.tox/|\.venv/|venv/|env/|ENV/|env\.bak/|venv\.bak/)$ |
10 | 10 |
|
11 | | - # Python import sorting |
12 | | - - repo: https://github.com/pycqa/isort |
13 | | - rev: 5.12.0 |
14 | | - hooks: |
15 | | - - id: isort |
16 | | - args: [--profile=black] |
17 | | - exclude: ^(sqlfluff_templater_schemachange\.egg-info/|build/|dist/|\.eggs/|\.git/|\.hg/|\.mypy_cache/|\.tox/|\.venv/|venv/|env/|ENV/|env\.bak/|venv\.bak/)$ |
| 11 | +# Python import sorting |
| 12 | +- repo: https://github.com/pycqa/isort |
| 13 | + rev: 5.12.0 |
| 14 | + hooks: |
| 15 | + - id: isort |
| 16 | + args: [ --profile=black ] |
| 17 | + exclude: ^(sqlfluff_templater_schemachange\.egg-info/|build/|dist/|\.eggs/|\.git/|\.hg/|\.mypy_cache/|\.tox/|\.venv/|venv/|env/|ENV/|env\.bak/|venv\.bak/)$ |
18 | 18 |
|
19 | | - # Python linting |
20 | | - - repo: https://github.com/pycqa/flake8 |
21 | | - rev: 6.0.0 |
22 | | - hooks: |
23 | | - - id: flake8 |
24 | | - exclude: ^(sqlfluff_templater_schemachange\.egg-info/|build/|dist/|\.eggs/|\.git/|\.hg/|\.mypy_cache/|\.tox/|\.venv/|venv/|env/|ENV/|env\.bak/|venv\.bak/)$ |
| 19 | +# Python linting |
| 20 | +- repo: https://github.com/pycqa/flake8 |
| 21 | + rev: 6.0.0 |
| 22 | + hooks: |
| 23 | + - id: flake8 |
| 24 | + exclude: ^(sqlfluff_templater_schemachange\.egg-info/|build/|dist/|\.eggs/|\.git/|\.hg/|\.mypy_cache/|\.tox/|\.venv/|venv/|env/|ENV/|env\.bak/|venv\.bak/)$ |
25 | 25 |
|
26 | | - # Type checking |
27 | | - - repo: https://github.com/pre-commit/mirrors-mypy |
28 | | - rev: v1.4.1 |
29 | | - hooks: |
30 | | - - id: mypy |
31 | | - additional_dependencies: [types-PyYAML] |
32 | | - args: [--ignore-missing-imports] |
33 | | - exclude: ^(fix_lint_issues\.py|dev-setup\.py|setup_test_environments\.py|verify_setup\.py|test_generator\.py|sqlfluff_templater_schemachange\.egg-info/|build/|dist/|\.eggs/|\.git/|\.hg/|\.mypy_cache/|\.tox/|\.venv/|venv/|env/|ENV/|env\.bak/|venv\.bak/)$ |
| 26 | +# Type checking |
| 27 | +- repo: https://github.com/pre-commit/mirrors-mypy |
| 28 | + rev: v1.4.1 |
| 29 | + hooks: |
| 30 | + - id: mypy |
| 31 | + additional_dependencies: [ types-PyYAML ] |
| 32 | + args: [ --ignore-missing-imports ] |
| 33 | + exclude: ^(fix_lint_issues\.py|dev-setup\.py|setup_test_environments\.py|verify_setup\.py|test_generator\.py|sqlfluff_templater_schemachange\.egg-info/|build/|dist/|\.eggs/|\.git/|\.hg/|\.mypy_cache/|\.tox/|\.venv/|venv/|env/|ENV/|env\.bak/|venv\.bak/)$ |
34 | 34 |
|
35 | | - # SQLFluff linting for SQL files (using local development package) |
36 | | - # NOTE: Requires 'pip install -e .' to be run first to install the development package |
37 | | - # Only runs on examples/ directory which has proper .sqlfluff configuration |
38 | | - - repo: local |
39 | | - hooks: |
40 | | - - id: sqlfluff-lint-examples |
41 | | - name: SQLFluff Lint Examples |
42 | | - entry: python |
43 | | - language: system |
44 | | - files: ^examples/.*\.sql$ |
45 | | - args: [-c, "import os; os.chdir('examples'); os.system('sqlfluff lint migrations/')"] |
46 | | - require_serial: false |
47 | | - pass_filenames: false |
48 | | - - id: sqlfluff-fix-examples |
49 | | - name: SQLFluff Fix Examples |
50 | | - entry: python |
51 | | - language: system |
52 | | - files: ^examples/.*\.sql$ |
53 | | - args: [-c, "import os; os.chdir('examples'); os.system('sqlfluff fix migrations/ ')"] |
54 | | - require_serial: false |
55 | | - pass_filenames: false |
| 35 | +# SQLFluff linting for SQL files (using local development package) |
| 36 | +# NOTE: Requires 'pip install -e .' to be run first to install the development package |
| 37 | +# Only runs on examples/ directory which has proper .sqlfluff configuration |
| 38 | +- repo: local |
| 39 | + hooks: |
| 40 | + # - id: sqlfluff-lint-examples |
| 41 | + # name: SQLFluff Lint Examples |
| 42 | + # entry: python |
| 43 | + # language: system |
| 44 | + # files: ^examples/.*\.sql$ |
| 45 | + # args: [ -c, "import os; os.chdir('examples'); os.system('sqlfluff lint migrations/')" ] |
| 46 | + # require_serial: false |
| 47 | + # pass_filenames: false |
| 48 | + - id: sqlfluff-fix-examples |
| 49 | + name: SQLFluff Fix Examples |
| 50 | + entry: python |
| 51 | + language: system |
| 52 | + files: ^examples/.*\.sql$ |
| 53 | + args: [ -c, "import os; os.chdir('examples'); os.system('sqlfluff fix migrations/ ')" ] |
| 54 | + require_serial: false |
| 55 | + pass_filenames: false |
56 | 56 |
|
57 | | - # General file checks |
58 | | - - repo: https://github.com/pre-commit/pre-commit-hooks |
59 | | - rev: v4.4.0 |
60 | | - hooks: |
61 | | - - id: trailing-whitespace |
62 | | - exclude: ^(sqlfluff_templater_schemachange\.egg-info/|build/|dist/|\.eggs/|\.git/|\.hg/|\.mypy_cache/|\.tox/|\.venv/|venv/|env/|ENV/|env\.bak/|venv\.bak/)$ |
63 | | - - id: end-of-file-fixer |
64 | | - exclude: ^(LICENSE|sqlfluff_templater_schemachange\.egg-info/|build/|dist/|\.eggs/|\.git/|\.hg/|\.mypy_cache/|\.tox/|\.venv/|venv/|env/|ENV/|env\.bak/|venv\.bak/)$ |
65 | | - - id: check-yaml |
66 | | - exclude: ^(sqlfluff_templater_schemachange\.egg-info/|build/|dist/|\.eggs/|\.git/|\.hg/|\.mypy_cache/|\.tox/|\.venv/|venv/|env/|ENV/|env\.bak/|venv\.bak/)$ |
67 | | - - id: check-json |
68 | | - exclude: ^(bandit-report\.json$|sqlfluff_templater_schemachange\.egg-info/|build/|dist/|\.eggs/|\.git/|\.hg/|\.mypy_cache/|\.tox/|\.venv/|venv/|env/|ENV/|env\.bak/|venv\.bak/)$ |
69 | | - - id: check-added-large-files |
70 | | - exclude: ^(sqlfluff_templater_schemachange\.egg-info/|build/|dist/|\.eggs/|\.git/|\.hg/|\.mypy_cache/|\.tox/|\.venv/|venv/|env/|ENV/|env\.bak/|venv\.bak/)$ |
71 | | - - id: check-case-conflict |
72 | | - exclude: ^(sqlfluff_templater_schemachange\.egg-info/|build/|dist/|\.eggs/|\.git/|\.hg/|\.mypy_cache/|\.tox/|\.venv/|venv/|env/|ENV/|env\.bak/|venv\.bak/)$ |
73 | | - - id: check-merge-conflict |
74 | | - exclude: ^(sqlfluff_templater_schemachange\.egg-info/|build/|dist/|\.eggs/|\.git/|\.hg/|\.mypy_cache/|\.tox/|\.venv/|venv/|env/|ENV/|env\.bak/|venv\.bak/)$ |
75 | | - - id: debug-statements |
76 | | - exclude: ^(sqlfluff_templater_schemachange\.egg-info/|build/|dist/|\.eggs/|\.git/|\.hg/|\.mypy_cache/|\.tox/|\.venv/|venv/|env/|ENV/|env\.bak/|venv\.bak/)$ |
77 | | - - id: requirements-txt-fixer |
78 | | - exclude: ^(sqlfluff_templater_schemachange\.egg-info/|build/|dist/|\.eggs/|\.git/|\.hg/|\.mypy_cache/|\.tox/|\.venv/|venv/|env/|ENV/|env\.bak/|venv\.bak/)$ |
| 57 | +# General file checks |
| 58 | +- repo: https://github.com/pre-commit/pre-commit-hooks |
| 59 | + rev: v4.4.0 |
| 60 | + hooks: |
| 61 | + - id: trailing-whitespace |
| 62 | + exclude: ^(sqlfluff_templater_schemachange\.egg-info/|build/|dist/|\.eggs/|\.git/|\.hg/|\.mypy_cache/|\.tox/|\.venv/|venv/|env/|ENV/|env\.bak/|venv\.bak/)$ |
| 63 | + - id: end-of-file-fixer |
| 64 | + exclude: ^(LICENSE|sqlfluff_templater_schemachange\.egg-info/|build/|dist/|\.eggs/|\.git/|\.hg/|\.mypy_cache/|\.tox/|\.venv/|venv/|env/|ENV/|env\.bak/|venv\.bak/)$ |
| 65 | + - id: check-yaml |
| 66 | + exclude: ^(tests/jinja_yaml/schemachange-config.yml$|sqlfluff_templater_schemachange\.egg-info/|build/|dist/|\.eggs/|\.git/|\.hg/|\.mypy_cache/|\.tox/|\.venv/|venv/|env/|ENV/|env\.bak/|venv\.bak/)$ |
| 67 | + - id: check-json |
| 68 | + exclude: ^(bandit-report\.json$|sqlfluff_templater_schemachange\.egg-info/|build/|dist/|\.eggs/|\.git/|\.hg/|\.mypy_cache/|\.tox/|\.venv/|venv/|env/|ENV/|env\.bak/|venv\.bak/)$ |
| 69 | + - id: check-added-large-files |
| 70 | + exclude: ^(sqlfluff_templater_schemachange\.egg-info/|build/|dist/|\.eggs/|\.git/|\.hg/|\.mypy_cache/|\.tox/|\.venv/|venv/|env/|ENV/|env\.bak/|venv\.bak/)$ |
| 71 | + - id: check-case-conflict |
| 72 | + exclude: ^(sqlfluff_templater_schemachange\.egg-info/|build/|dist/|\.eggs/|\.git/|\.hg/|\.mypy_cache/|\.tox/|\.venv/|venv/|env/|ENV/|env\.bak/|venv\.bak/)$ |
| 73 | + - id: check-merge-conflict |
| 74 | + exclude: ^(sqlfluff_templater_schemachange\.egg-info/|build/|dist/|\.eggs/|\.git/|\.hg/|\.mypy_cache/|\.tox/|\.venv/|venv/|env/|ENV/|env\.bak/|venv\.bak/)$ |
| 75 | + - id: debug-statements |
| 76 | + exclude: ^(sqlfluff_templater_schemachange\.egg-info/|build/|dist/|\.eggs/|\.git/|\.hg/|\.mypy_cache/|\.tox/|\.venv/|venv/|env/|ENV/|env\.bak/|venv\.bak/)$ |
| 77 | + - id: requirements-txt-fixer |
| 78 | + exclude: ^(sqlfluff_templater_schemachange\.egg-info/|build/|dist/|\.eggs/|\.git/|\.hg/|\.mypy_cache/|\.tox/|\.venv/|venv/|env/|ENV/|env\.bak/|venv\.bak/)$ |
79 | 79 |
|
80 | | - # Security checks |
81 | | - - repo: https://github.com/PyCQA/bandit |
82 | | - rev: 1.7.5 |
83 | | - hooks: |
84 | | - - id: bandit |
85 | | - args: [--recursive, --format, json, --output, bandit-report.json, --configfile, .bandit] |
86 | | - files: \.py$ |
87 | | - exclude: ^(test_.*\.py|tests/.*\.py|dev-setup\.py|setup_test_environments\.py|verify_setup\.py|test_generator\.py|LICENSE|sqlfluff_templater_schemachange\.egg-info/|build/|dist/|\.eggs/|\.git/|\.hg/|\.mypy_cache/|\.tox/|\.venv/|venv/|env/|ENV/|env\.bak/|venv\.bak/)$ |
| 80 | +# Security checks |
| 81 | +- repo: https://github.com/PyCQA/bandit |
| 82 | + rev: 1.7.5 |
| 83 | + hooks: |
| 84 | + - id: bandit |
| 85 | + args: [ --recursive, --format, json, --output, bandit-report.json, --configfile, .bandit ] |
| 86 | + files: \.py$ |
| 87 | + exclude: ^(test_.*\.py|tests/.*\.py|dev-setup\.py|setup_test_environments\.py|verify_setup\.py|test_generator\.py|LICENSE|sqlfluff_templater_schemachange\.egg-info/|build/|dist/|\.eggs/|\.git/|\.hg/|\.mypy_cache/|\.tox/|\.venv/|venv/|env/|ENV/|env\.bak/|venv\.bak/)$ |
88 | 88 |
|
89 | | - |
90 | | - |
91 | | - # Documentation linting |
92 | | - - repo: https://github.com/pycqa/pydocstyle |
93 | | - rev: 6.3.0 |
94 | | - hooks: |
95 | | - - id: pydocstyle |
96 | | - args: [--convention=google] |
97 | | - exclude: ^(dev-setup\.py|setup_test_environments\.py|verify_setup\.py|test_generator\.py|LICENSE|sqlfluff_templater_schemachange\.egg-info/|build/|dist/|\.eggs/|\.git/|\.hg/|\.mypy_cache/|\.tox/|\.venv/|venv/|env/|ENV/|env\.bak/|venv\.bak/)$ |
| 89 | +# Documentation linting |
| 90 | +- repo: https://github.com/pycqa/pydocstyle |
| 91 | + rev: 6.3.0 |
| 92 | + hooks: |
| 93 | + - id: pydocstyle |
| 94 | + args: [ --convention=google ] |
| 95 | + exclude: ^(dev-setup\.py|setup_test_environments\.py|verify_setup\.py|test_generator\.py|LICENSE|sqlfluff_templater_schemachange\.egg-info/|build/|dist/|\.eggs/|\.git/|\.hg/|\.mypy_cache/|\.tox/|\.venv/|venv/|env/|ENV/|env\.bak/|venv\.bak/)$ |
98 | 96 |
|
99 | 97 | # Configuration for specific hooks |
100 | 98 | ci: |
|
0 commit comments