Skip to content

Commit a656cdb

Browse files
authored
Upgrade pre-commit hooks (#176)
1 parent 119aad4 commit a656cdb

31 files changed

+6389
-6271
lines changed

.pre-commit-config.yaml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ repos:
2424
- id: check-yaml
2525
- id: detect-private-key
2626
- repo: https://github.com/rhysd/actionlint
27-
rev: v1.7.7
27+
rev: v1.7.8
2828
hooks:
2929
- id: actionlint
3030
# - repo: https://github.com/asottile/reorder_python_imports
@@ -36,14 +36,15 @@ repos:
3636
hooks:
3737
- id: setup-cfg-fmt
3838
- repo: https://github.com/pycqa/isort
39-
rev: 6.1.0
39+
rev: 7.0.0
4040
hooks:
4141
- id: isort
4242
name: isort (python)
4343
- repo: https://github.com/pycqa/pylint
44-
rev: v3.3.9
44+
rev: v4.0.0
4545
hooks:
4646
- id: pylint
47+
exclude: (dbt_artifacts_parser/parsers/)
4748
# - repo: https://github.com/pre-commit/mirrors-mypy
4849
# rev: 'v1.4.1'
4950
# hooks:
@@ -53,7 +54,12 @@ repos:
5354
rev: v0.11.0.1
5455
hooks:
5556
- id: shellcheck
56-
- repo: https://github.com/rhysd/actionlint
57-
rev: v1.7.7
57+
- repo: https://github.com/astral-sh/ruff-pre-commit
58+
# Ruff version.
59+
rev: v0.14.0
5860
hooks:
59-
- id: actionlint-docker
61+
# Run the linter.
62+
- id: ruff-check
63+
args: [ --fix ]
64+
# Run the formatter.
65+
- id: ruff-format

.style.yapf

Lines changed: 0 additions & 2 deletions
This file was deleted.

Makefile

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ setup-pre-commit:
1414

1515
# Check all the coding style.
1616
.PHONY: lint
17-
lint: run-pre-commit lint-shell lint-python
17+
lint: run-pre-commit
1818

1919
# Run the pre-commit hooks.
2020
.PHONY: run-pre-commit
@@ -26,25 +26,6 @@ run-pre-commit:
2626
update-pre-commit:
2727
pre-commit autoupdate
2828

29-
# Check the coding style for the shell scripts.
30-
.PHONY: lint-shell
31-
lint-shell:
32-
shellcheck ./dev/*.sh
33-
34-
# Check the coding style for the python files.
35-
.PHONY: lint-python
36-
lint-python:
37-
bash ./dev/lint_python.sh
38-
39-
# Format source codes
40-
.PHONY: format
41-
format: format-python
42-
43-
# Format python codes
44-
.PHONY: format-python
45-
format-python:
46-
bash ./dev/format_python.sh
47-
4829
# Run the unit tests.
4930
.PHONY: test
5031
test:

dbt_artifacts_parser/parser.py

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -74,18 +74,18 @@ def parse_catalog_v1(catalog: dict) -> CatalogV1:
7474
def parse_manifest(
7575
manifest: dict,
7676
) -> Union[
77-
ManifestV1,
78-
ManifestV2,
79-
ManifestV3,
80-
ManifestV4,
81-
ManifestV5,
82-
ManifestV6,
83-
ManifestV7,
84-
ManifestV8,
85-
ManifestV9,
86-
ManifestV10,
87-
ManifestV11,
88-
ManifestV12,
77+
ManifestV1,
78+
ManifestV2,
79+
ManifestV3,
80+
ManifestV4,
81+
ManifestV5,
82+
ManifestV6,
83+
ManifestV7,
84+
ManifestV8,
85+
ManifestV9,
86+
ManifestV10,
87+
ManifestV11,
88+
ManifestV12,
8989
]:
9090
"""Parse manifest.json
9191
@@ -198,6 +198,7 @@ def parse_manifest_v9(manifest: dict) -> ManifestV9:
198198
return ManifestV9(**manifest)
199199
raise ValueError("Not a manifest.json v9")
200200

201+
201202
def parse_manifest_v10(manifest: dict) -> ManifestV10:
202203
"""Parse manifest.json ver.10"""
203204
dbt_schema_version = get_dbt_schema_version(artifact_json=manifest)
@@ -227,8 +228,9 @@ def parse_manifest_v12(manifest: dict) -> ManifestV12:
227228
#
228229
def parse_run_results(
229230
run_results: dict,
230-
) -> Union[RunResultsV1, RunResultsV2, RunResultsV3, RunResultsV4,
231-
RunResultsV5, RunResultsV6]:
231+
) -> Union[
232+
RunResultsV1, RunResultsV2, RunResultsV3, RunResultsV4, RunResultsV5, RunResultsV6
233+
]:
232234
"""Parse run-results.json
233235
234236
Args:
@@ -284,6 +286,7 @@ def parse_run_results_v4(run_results: dict) -> RunResultsV4:
284286
return RunResultsV4(**run_results)
285287
raise ValueError("Not a run-results.json v4")
286288

289+
287290
def parse_run_results_v5(run_results: dict) -> RunResultsV5:
288291
"""Parse run-results.json v5"""
289292
dbt_schema_version = get_dbt_schema_version(artifact_json=run_results)
@@ -299,6 +302,7 @@ def parse_run_results_v6(run_results: dict) -> RunResultsV6:
299302
return RunResultsV6(**run_results)
300303
raise ValueError("Not a run-results.json v6")
301304

305+
302306
#
303307
# sources
304308
#

dbt_artifacts_parser/parsers/catalog/catalog_v1.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,21 @@
1212

1313
class Metadata(BaseParserModel):
1414
model_config = ConfigDict(
15-
extra='forbid',
15+
extra="forbid",
1616
)
1717
dbt_schema_version: Optional[str] = None
18-
dbt_version: Optional[str] = '1.9.0b2'
18+
dbt_version: Optional[str] = "1.9.0b2"
1919
generated_at: Optional[str] = None
2020
invocation_id: Optional[str] = None
2121
env: Optional[Dict[str, str]] = None
2222

2323

2424
class Metadata1(BaseParserModel):
2525
model_config = ConfigDict(
26-
extra='forbid',
26+
extra="forbid",
2727
)
2828
type: str
29-
schema_: str = Field(..., alias='schema')
29+
schema_: str = Field(..., alias="schema")
3030
name: str
3131
database: Optional[str] = None
3232
comment: Optional[str] = None
@@ -35,7 +35,7 @@ class Metadata1(BaseParserModel):
3535

3636
class Columns(BaseParserModel):
3737
model_config = ConfigDict(
38-
extra='forbid',
38+
extra="forbid",
3939
)
4040
type: str
4141
index: int
@@ -45,7 +45,7 @@ class Columns(BaseParserModel):
4545

4646
class Stats(BaseParserModel):
4747
model_config = ConfigDict(
48-
extra='forbid',
48+
extra="forbid",
4949
)
5050
id: str
5151
label: str
@@ -56,30 +56,30 @@ class Stats(BaseParserModel):
5656

5757
class Nodes(BaseParserModel):
5858
model_config = ConfigDict(
59-
extra='forbid',
59+
extra="forbid",
6060
)
61-
metadata: Metadata1 = Field(..., title='TableMetadata')
61+
metadata: Metadata1 = Field(..., title="TableMetadata")
6262
columns: Dict[str, Columns]
6363
stats: Dict[str, Stats]
6464
unique_id: Optional[str] = None
6565

6666

6767
class Sources(BaseParserModel):
6868
model_config = ConfigDict(
69-
extra='forbid',
69+
extra="forbid",
7070
)
71-
metadata: Metadata1 = Field(..., title='TableMetadata')
71+
metadata: Metadata1 = Field(..., title="TableMetadata")
7272
columns: Dict[str, Columns]
7373
stats: Dict[str, Stats]
7474
unique_id: Optional[str] = None
7575

7676

7777
class CatalogV1(BaseParserModel):
7878
model_config = ConfigDict(
79-
extra='forbid',
79+
extra="forbid",
8080
)
81-
metadata: Metadata = Field(..., title='CatalogMetadata')
81+
metadata: Metadata = Field(..., title="CatalogMetadata")
8282
nodes: Dict[str, Nodes]
8383
sources: Dict[str, Sources]
8484
errors: Optional[List[str]] = None
85-
field_compile_results: Any = Field(None, alias='_compile_results')
85+
field_compile_results: Any = Field(None, alias="_compile_results")

0 commit comments

Comments
 (0)