Skip to content

Commit 80bb0cd

Browse files
author
Bryan Sieber
committed
Updates from review
1 parent 66c61fa commit 80bb0cd

File tree

13 files changed

+25
-62
lines changed

13 files changed

+25
-62
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ repos:
55
name: pylint
66
entry: poetry run pylint
77
language: system
8-
exclude: ^migrations/
8+
exclude: ^tests/
99
types: [python]
1010
- repo: https://github.com/pre-commit/pre-commit-hooks
1111
rev: v2.1.0
@@ -20,6 +20,7 @@ repos:
2020
'--indent', '4',
2121
'--no-sort-keys',
2222
]
23+
exclude: "infra/k8s/secret.json"
2324
- id: trailing-whitespace
2425
- repo: local
2526
hooks:

infra/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ RUN bandit -lll --recursive src --exclude "src/poetry.lock,src/.venv,src/.mypy,s
8787
RUN mypy src
8888
RUN black --config ./pyproject.toml --check src tests
8989
RUN isort --recursive --settings-path ./pyproject.toml --check-only src
90-
RUN pylint src tests/unit
90+
RUN pylint src tests
9191
RUN yamllint -d "{extends: default, rules: {key-duplicates: enable, key-ordering: enable}}" ./config
9292
CMD ./infra/detect_secrets_helper.sh
9393

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ testpaths = [
5454
[tool.pylint.MASTER]
5555
load-plugins='pylint_pytest'
5656
ignore='third_party'
57-
57+
ignore-patterns = "tests/*"
5858

5959
[tool.isort]
6060
profile = "black"

src/app/api.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,7 @@
3030

3131
@app.get("/", include_in_schema=False)
3232
def root(request: Request):
33-
"""GET via root redirects to /docs.
34-
- Args:
35-
- Returns:
36-
- **redirect**: Redirects call to ./docs
37-
"""
33+
"""GET via root redirects to /docs."""
3834
return RedirectResponse(url="./docs")
3935

4036

src/app/environment.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,9 @@ def get_settings() -> Settings:
3737

3838
@lru_cache()
3939
def get_version():
40-
"""
41-
Return contents of version.json.
42-
This has generic data in repo, but gets the build details in CI.
43-
"""
40+
"""Return contents of version.json. This has generic data in repo, but gets the build details in CI."""
4441
info = {}
4542
version_path = Path(__file__).parents[2] / "version.json"
46-
print(version_path)
4743
if version_path.exists():
4844
info = json.loads(version_path.read_text(encoding="utf8"))
4945
return info

src/app/log.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@
1111

1212

1313
def configure_logging():
14-
"""
15-
Configure logging; mozlog format for Dockerflow
16-
"""
14+
"""Configure logging; mozlog format for Dockerflow"""
1715
logging_config = {
1816
"version": 1,
1917
"formatters": {

src/app/monitor.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ def get_heartbeat(
2828
request: Request,
2929
settings: environment.Settings = Depends(environment.get_settings),
3030
):
31-
"""
32-
Dockerflow API for heartbeat: GET
33-
"""
31+
"""Dockerflow API for heartbeat: GET"""
3432
return heartbeat(request, settings)
3533

3634

@@ -39,9 +37,7 @@ def head_heartbeat(
3937
request: Request,
4038
settings: environment.Settings = Depends(environment.get_settings),
4139
):
42-
"""
43-
Dockerflow API for heartbeat: HEAD
44-
"""
40+
"""Dockerflow API for heartbeat: HEAD"""
4541
return heartbeat(request, settings)
4642

4743

@@ -52,17 +48,13 @@ def lbheartbeat(request: Request):
5248

5349
@api_router.get("/__lbheartbeat__")
5450
def get_lbheartbeat(request: Request):
55-
"""
56-
Dockerflow API for lbheartbeat: GET
57-
"""
51+
"""Dockerflow API for lbheartbeat: GET"""
5852
return lbheartbeat(request)
5953

6054

6155
@api_router.head("/__lbheartbeat__")
6256
def head_lbheartbeat(request: Request):
63-
"""
64-
Dockerflow API for lbheartbeat: HEAD
65-
"""
57+
"""Dockerflow API for lbheartbeat: HEAD"""
6658
return lbheartbeat(request)
6759

6860

src/jbi/configuration.py

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
"""
2-
Parsing and validating the YAML configuration occurs within this module
3-
"""
1+
"""Parsing and validating the YAML configuration occurs within this module"""
42
import importlib
53
import logging
64
from inspect import signature
@@ -17,23 +15,17 @@
1715

1816

1917
class ConfigError(Exception):
20-
"""
21-
Errors used to determine when the Configuration is invalid
22-
"""
18+
"""Errors used to determine when the Configuration is invalid"""
2319

2420

2521
class ProcessError(Exception):
26-
"""
27-
Error when an exception occurs during processing
28-
"""
22+
"""Error when an exception occurs during processing"""
2923

3024

3125
def get_yaml_configurations(
3226
jbi_config_file: str = f"config/config.{settings.env}.yaml",
3327
) -> Dict[str, Dict]:
34-
"""
35-
Convert and validate YAML configuration to python dict
36-
"""
28+
"""Convert and validate YAML configuration to python dict"""
3729

3830
with open(jbi_config_file, encoding="utf-8") as file:
3931
try:
@@ -49,9 +41,7 @@ def get_yaml_configurations(
4941

5042

5143
def process_actions(action_configuration) -> Dict[str, Dict]:
52-
"""
53-
Validate `actions` section of the YAML config
54-
"""
44+
"""Validate `actions` section of the YAML config"""
5545
requested_actions = {}
5646
for yaml_action_key, inner_action_dict in action_configuration.items():
5747
inner_action_dict.setdefault("action", "src.jbi.whiteboard_actions.default")

src/jbi/router.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,15 @@
1919

2020

2121
def execute_request(request, settings):
22-
"""
23-
Is request valid?
24-
Is whiteboard known?
25-
Execute desired action -- based on whiteboard config
26-
"""
22+
"""Execute action"""
2723

2824

2925
@api_router.post("/bugzilla_webhook")
3026
def bugzilla_webhook(
3127
request: Request,
3228
settings: environment.Settings = Depends(environment.get_settings),
3329
):
34-
"""
35-
API endpoint that Bugzilla Webhook Events request
36-
"""
30+
"""API endpoint that Bugzilla Webhook Events request"""
3731
return execute_request(request, settings)
3832

3933

src/jbi/services.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
"""
2-
Services and functions that can be used to create custom actions
3-
"""
1+
"""Services and functions that can be used to create custom actions"""
42
import logging
53

64
import bugzilla as rh_bugzilla # type: ignore

0 commit comments

Comments
 (0)