Skip to content

Commit f1f14a0

Browse files
sbaidachniCopilot
andauthored
precommit init (#258)
* precommit init * Update .pre-commit-config.yaml Co-authored-by: Copilot <[email protected]> * Update .flake8 Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]>
1 parent bc633bf commit f1f14a0

File tree

8 files changed

+274
-197
lines changed

8 files changed

+274
-197
lines changed

.flake8

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[flake8]
2+
max-line-length = 120
3+
ignore = E203, E266, E501, W503
4+
exclude =
5+
.git,
6+
.azure,
7+
__pycache__,
8+
.venv

.pre-commit-config.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v5.0.0
4+
hooks:
5+
- id: detect-private-key
6+
- id: check-merge-conflict
7+
8+
- repo: https://github.com/psf/black
9+
rev: 24.4.2
10+
hooks:
11+
- id: black
12+
language_version: python3
13+
14+
- repo: https://github.com/pycqa/flake8
15+
rev: 7.1.1
16+
hooks:
17+
- id: flake8
18+
language_version: python3
19+
20+
- repo: https://github.com/antonbabenko/pre-commit-terraform
21+
rev: v1.84.0
22+
hooks:
23+
- id: terraform_fmt
24+
- id: terraform_validate
25+
args: [infra]
26+
27+
- repo: https://github.com/gitleaks/gitleaks
28+
rev: v8.18.2
29+
hooks:
30+
- id: gitleaks

src/search/common_utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import argparse
44
from urllib.parse import urlparse
55

6+
67
def absolute_url(value):
78
"""
89
Validate that the input is an absolute URL with a valid scheme and netloc.
@@ -20,6 +21,7 @@ def absolute_url(value):
2021
raise argparse.ArgumentTypeError(f"'{value}' is not a valid absolute URL")
2122
return value
2223

24+
2325
def valid_name(value):
2426
"""
2527
Validate that the input is a valid name that may include alphanumeric symbols, "-" or "_".
@@ -36,5 +38,7 @@ def valid_name(value):
3638
raise argparse.ArgumentTypeError(f"'{value}' is not a valid name")
3739
parsed_value = value.replace("-", "").replace("_", "")
3840
if not parsed_value.isalnum():
39-
raise argparse.ArgumentTypeError(f"'{value}' contains invalid characters. Look at the documentation for naming conventions.")
41+
raise argparse.ArgumentTypeError(
42+
f"'{value}' contains invalid characters. Look at the documentation for naming conventions."
43+
)
4044
return value

0 commit comments

Comments
 (0)