File tree Expand file tree Collapse file tree 4 files changed +64
-2
lines changed Expand file tree Collapse file tree 4 files changed +64
-2
lines changed Original file line number Diff line number Diff line change @@ -98,6 +98,14 @@ repos:
98
98
- id : shellcheck
99
99
100
100
# Python
101
+ - repo : https://github.com/astral-sh/ruff-pre-commit
102
+ rev : v0.8.4
103
+ hooks :
104
+ - id : ruff
105
+ args :
106
+ - --fix
107
+ - id : ruff-format
108
+
101
109
- repo : https://github.com/pre-commit/mirrors-mypy.git
102
110
rev : v1.15.0
103
111
hooks :
Original file line number Diff line number Diff line change
1
+ # Assume Python 3.9
2
+ target-version = " py39"
3
+
4
+ line-length = 79 # To decrease PR diff size
5
+
6
+ namespace-packages = [" src/pre_commit_terraform/" , " tests/pytest/" ]
7
+
8
+ [format ]
9
+ quote-style = " single"
10
+
11
+ [lint .flake8-quotes ]
12
+ inline-quotes = " single"
13
+
14
+ [lint .pydocstyle ]
15
+ convention = " pep257"
16
+
17
+ [lint ]
18
+ select = [" ALL" ]
19
+ preview = true
20
+ ignore = [
21
+ " CPY001" , # Skip copyright notice requirement at top of files
22
+ ]
23
+
24
+ [lint .isort ]
25
+ # force-single-line = true # To decrease PR diff size
26
+ lines-after-imports = 2
27
+
28
+ [lint .flake8-pytest-style ]
29
+ parametrize-values-type = " tuple"
30
+
31
+ [lint .per-file-ignores ]
32
+ # Exceptions for test files
33
+ "tests/**.py" = [
34
+ " S101" , # Allow use of `assert` in test files
35
+ " PLC2701" , # Allow importing internal files needed for testing
36
+ " PLR6301" , # Allow 'self' parameter in method definitions (required for test stubs)
37
+ " ARG002" , # Allow unused arguments in instance methods (required for test stubs)
38
+ " S404" , # Allow importing 'subprocess' module to testing call external tools needed by these hooks
39
+
40
+ ]
Original file line number Diff line number Diff line change @@ -21,6 +21,9 @@ def invoke_cli_app(cli_args: list[str]) -> ReturnCodeType:
21
21
22
22
Returns:
23
23
ReturnCodeType: The return code of the app.
24
+
25
+ Raises:
26
+ PreCommitTerraformExit: If the app is exiting with error.
24
27
"""
25
28
root_cli_parser = initialize_argument_parser ()
26
29
parsed_cli_args = root_cli_parser .parse_args (cli_args )
@@ -33,7 +36,8 @@ def invoke_cli_app(cli_args: list[str]) -> ReturnCodeType:
33
36
try :
34
37
return invoke_cli_app (parsed_cli_args )
35
38
except PreCommitTerraformExit as exit_err :
36
- # T201 - FIXME here and below - we will replace 'print' with logging later
39
+ # T201 - FIXME here and below - we will replace 'print' with
40
+ # logging later
37
41
print (f'App exiting: { exit_err !s} ' , file = sys .stderr ) # noqa: T201
38
42
raise
39
43
except PreCommitTerraformRuntimeError as unhandled_exc :
Original file line number Diff line number Diff line change
1
+ """Terraform Docs Replace Hook.
2
+
3
+ This hook is deprecated and will be removed in the future.
4
+ Please, use 'terraform_docs' hook instead.
5
+ """
6
+
1
7
import os
2
- import subprocess
8
+
9
+ # S404 - Allow importing 'subprocess' module to call external tools
10
+ # needed by these hooks. FIXME - should be moved to separate module
11
+ # when more hooks will be introduced
12
+ import subprocess # noqa: S404
3
13
import warnings
4
14
from argparse import ArgumentParser , Namespace
5
15
from typing import cast as cast_to
You can’t perform that action at this time.
0 commit comments