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:
9898 - id : shellcheck
9999
100100# 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+
101109- repo : https://github.com/pre-commit/mirrors-mypy.git
102110 rev : v1.15.0
103111 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:
2121
2222 Returns:
2323 ReturnCodeType: The return code of the app.
24+
25+ Raises:
26+ PreCommitTerraformExit: If the app is exiting with error.
2427 """
2528 root_cli_parser = initialize_argument_parser ()
2629 parsed_cli_args = root_cli_parser .parse_args (cli_args )
@@ -33,7 +36,8 @@ def invoke_cli_app(cli_args: list[str]) -> ReturnCodeType:
3336 try :
3437 return invoke_cli_app (parsed_cli_args )
3538 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
3741 print (f'App exiting: { exit_err !s} ' , file = sys .stderr ) # noqa: T201
3842 raise
3943 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+
17import 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
313import warnings
414from argparse import ArgumentParser , Namespace
515from typing import cast as cast_to
You can’t perform that action at this time.
0 commit comments