Skip to content

Commit 933512c

Browse files
committed
feat: added pre-commit configuration
1 parent 8754d3b commit 933512c

6 files changed

Lines changed: 80 additions & 5 deletions

File tree

.pre-commit-config.yaml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# This file contains 2 stages
2+
# pre-commit stage - runs by default pre-commit
3+
# manual stage - runs the same tools but modifies files
4+
# run as: pre-commit run --all-files --hook-stage manual
5+
repos:
6+
- repo: https://gitlab.cee.redhat.com/infosec-public/developer-workbench/tools.git
7+
rev: rh-pre-commit-2.3.0
8+
hooks:
9+
# If you have not run this hook on your system before, it may prompt you to
10+
# log in for patterns, and you will need to try again.
11+
#
12+
# Docs: https://source.redhat.com/departments/it/it-information-security/leaktk/leaktk_components/rh_pre_commit
13+
- id: rh-pre-commit
14+
name: Red Hat pre-commit (check)
15+
# - id: rh-pre-commit.commit-msg # Optional for commit-msg attestation
16+
- repo: https://github.com/astral-sh/ruff-pre-commit
17+
rev: v0.11.1
18+
hooks:
19+
# Run the linter
20+
- id: ruff
21+
name: ruff (check)
22+
stages: [pre-commit]
23+
- id: ruff
24+
name: ruff (fix)
25+
args: [--fix]
26+
stages: [manual]
27+
# Run the formatter
28+
- id: ruff-format
29+
name: ruff format (check)
30+
args: [--check]
31+
stages: [pre-commit]
32+
- id: ruff-format
33+
name: ruff format (fix)
34+
stages: [manual]
35+
- repo: https://github.com/PyCQA/autoflake
36+
rev: v2.2.1
37+
hooks:
38+
- id: autoflake
39+
name: autoflake (check)
40+
args: [--check, --remove-all-unused-imports]
41+
stages: [pre-commit]
42+
- id: autoflake
43+
name: autoflake (fix)
44+
args: [--in-place, --remove-all-unused-imports]
45+
stages: [manual]
46+
- repo: https://github.com/psf/black
47+
rev: 25.1.0
48+
hooks:
49+
- id: black
50+
name: black (check)
51+
args: [--check]
52+
stages: [pre-commit]
53+
- id: black
54+
name: black (fix)
55+
stages: [manual]
56+
# TODO: Switch back to a regular release docformatter
57+
# after https://github.com/PyCQA/docformatter/issues/289 fix is released
58+
- repo: https://github.com/PyCQA/docformatter
59+
rev: eb1df347edd128b30cd3368dddc3aa65edcfac38
60+
hooks:
61+
- id: docformatter
62+
name: docformatter (check)
63+
additional_dependencies: [tomli]
64+
args: [--check, --config, ./pyproject.toml]
65+
stages: [pre-commit]
66+
- id: docformatter
67+
name: docformatter (fix)
68+
additional_dependencies: [tomli]
69+
args: [--in-place, --config, ./pyproject.toml]
70+
stages: [manual]
71+
- repo: https://github.com/pycqa/isort
72+
rev: 6.0.1
73+
hooks:
74+
- id: isort
75+
name: isort (check)
76+
args: [--check-only]
77+
stages: [pre-commit]
78+
- id: isort
79+
name: isort (fix)
80+
stages: [manual]

logilica_cli/page_dashboard.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77

88
class DashboardPage:
9-
109
PDF_EXPORT_TIMEOUT = 120000
1110

1211
def __init__(self, page: Page):

logilica_cli/page_settings.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ class SettingsPage:
2626
AVAILABLE_LIST_TIMEOUT = 54000
2727

2828
def __init__(self, page: Page):
29-
3029
self.page = page
3130
# UI elements for public access
3231
self.add_public_repository_dialog_button = page.get_by_role(

logilica_cli/pdf_convert.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ def to_format_multiple(
9292
teams: dict[str, dict[str, Any]],
9393
embed_images: bool = True,
9494
) -> int:
95-
9695
total = 0
9796
for team, dashboards in teams.items():
9897
for dashboard, options in dashboards["team_dashboards"].items():

logilica_cli/pdf_extract.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111

1212
class PDFExtract:
13-
1413
def __init__(self, scale: float = 1.0):
1514
"""Encapsulation of PDF extraction."""
1615

tests/test_configuration_schema.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,6 @@ def generate_bad_types() -> Generator[dict[str, Any], None, None]:
335335

336336

337337
class TestConfigurationSchema(unittest.TestCase):
338-
339338
def test_valid_configurations(self):
340339
count = 0
341340

0 commit comments

Comments
 (0)