Skip to content

Commit b83e1d6

Browse files
fix format
1 parent 1b19e19 commit b83e1d6

File tree

2 files changed

+234
-76
lines changed

2 files changed

+234
-76
lines changed

exasol/toolbox/nox/_gh.py

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
1-
import nox
2-
from nox import Session
3-
from noxconfig import PROJECT_CONFIG
4-
import sys
5-
from pathlib import Path
61
import json
72
import sqlite3
3+
import sys
4+
from pathlib import Path
85
from typing import Iterable
96

7+
import nox
8+
from nox import Session
9+
10+
from noxconfig import PROJECT_CONFIG
11+
1012

1113
@nox.session(name="check:lint-files", python=False)
1214
def check_lint_files(session: Session) -> None:
1315
"""task to validate linting files"""
1416
if not_available := files_not_available(
15-
[".lint.json", ".lint.txt", ".security.json", ".coverage"],
16-
PROJECT_CONFIG.root):
17+
[".lint.json", ".lint.txt", ".security.json", ".coverage"], PROJECT_CONFIG.root
18+
):
1719
print(f"not available: {not_available}")
1820
sys.exit(1)
1921

@@ -47,8 +49,19 @@ def check_lint_json(path: Path) -> str:
4749
issues = json.load(file)
4850
error = False
4951
for issue in issues:
50-
attributes = ["type", "module", "obj", "line", "column", "endLine",
51-
"endColumn", "path", "symbol", "message", "message-id"]
52+
attributes = [
53+
"type",
54+
"module",
55+
"obj",
56+
"line",
57+
"column",
58+
"endLine",
59+
"endColumn",
60+
"path",
61+
"symbol",
62+
"message",
63+
"message-id",
64+
]
5265
for attribute in attributes:
5366
error |= attribute not in issue
5467
if error:

test/unit/lint_file_check_test.py

Lines changed: 212 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,46 @@
11
import json
2+
import sqlite3
3+
from pathlib import Path
24

35
import pytest
4-
from pathlib import Path
5-
import sqlite3
66

77
from exasol.toolbox.nox import _gh
88

9+
910
@pytest.mark.parametrize(
1011
"files,requested_files,expected",
1112
[
1213
(
1314
[".lint.json", ".lint.txt", ".security.json", ".coverage"],
1415
[".lint.json", ".lint.txt", ".security.json", ".coverage"],
15-
[]
16-
), (
16+
[],
17+
),
18+
(
1719
[".lint.txt", ".security.json", ".coverage"],
1820
[".lint.json", ".lint.txt", ".security.json", ".coverage"],
19-
[".lint.json"]
20-
), (
21+
[".lint.json"],
22+
),
23+
(
2124
[".lint.json", ".security.json", ".coverage"],
2225
[".lint.json", ".lint.txt", ".security.json", ".coverage"],
23-
[".lint.txt"]
24-
), (
26+
[".lint.txt"],
27+
),
28+
(
2529
[".lint.json", ".lint.txt", ".coverage"],
2630
[".lint.json", ".lint.txt", ".security.json", ".coverage"],
27-
[".security.json"]
28-
), (
31+
[".security.json"],
32+
),
33+
(
2934
[".lint.json", ".lint.txt", ".security.json"],
3035
[".lint.json", ".lint.txt", ".security.json", ".coverage"],
31-
[".coverage"]
32-
), (
36+
[".coverage"],
37+
),
38+
(
3339
[],
3440
[".lint.json", ".lint.txt", ".security.json", ".coverage"],
35-
[".lint.json", ".lint.txt", ".security.json", ".coverage"]
41+
[".lint.json", ".lint.txt", ".security.json", ".coverage"],
3642
),
37-
]
43+
],
3844
)
3945
def test_check_lint_files(files, requested_files, expected, tmp_path):
4046
path = Path(tmp_path)
@@ -49,55 +55,187 @@ def test_check_lint_files(files, requested_files, expected, tmp_path):
4955
"attributes,expected",
5056
[
5157
(
52-
["type", "module", "obj", "line", "column", "endLine",
53-
"endColumn", "path", "symbol", "message", "message-id"],
54-
""
55-
), (
56-
["module", "obj", "line", "column", "endLine",
57-
"endColumn", "path", "symbol", "message", "message-id"],
58-
"incompatible format"
59-
), (
60-
["type", "obj", "line", "column", "endLine",
61-
"endColumn", "path", "symbol", "message", "message-id"],
62-
"incompatible format"
63-
), (
64-
["type", "module", "line", "column", "endLine",
65-
"endColumn", "path", "symbol", "message", "message-id"],
66-
"incompatible format"
67-
), (
68-
["type", "module", "obj", "column", "endLine",
69-
"endColumn", "path", "symbol", "message", "message-id"],
70-
"incompatible format"
71-
), (
72-
["type", "module", "obj", "line", "endLine",
73-
"endColumn", "path", "symbol", "message", "message-id"],
74-
"incompatible format"
75-
), (
76-
["type", "module", "obj", "line", "column",
77-
"endColumn", "path", "symbol", "message", "message-id"],
78-
"incompatible format"
79-
), (
80-
["type", "module", "obj", "line", "column", "endLine",
81-
"path", "symbol", "message", "message-id"],
82-
"incompatible format"
83-
), (
84-
["type", "module", "obj", "line", "column", "endLine",
85-
"endColumn", "symbol", "message", "message-id"],
86-
"incompatible format"
87-
), (
88-
["type", "module", "obj", "line", "column", "endLine",
89-
"endColumn", "path", "message", "message-id"],
90-
"incompatible format"
91-
), (
92-
["type", "module", "obj", "line", "column", "endLine",
93-
"endColumn", "path", "symbol", "message-id"],
94-
"incompatible format"
95-
), (
96-
["type", "module", "obj", "line", "column", "endLine",
97-
"endColumn", "path", "symbol", "message"],
98-
"incompatible format"
99-
),
100-
]
58+
[
59+
"type",
60+
"module",
61+
"obj",
62+
"line",
63+
"column",
64+
"endLine",
65+
"endColumn",
66+
"path",
67+
"symbol",
68+
"message",
69+
"message-id",
70+
],
71+
"",
72+
),
73+
(
74+
[
75+
"module",
76+
"obj",
77+
"line",
78+
"column",
79+
"endLine",
80+
"endColumn",
81+
"path",
82+
"symbol",
83+
"message",
84+
"message-id",
85+
],
86+
"incompatible format",
87+
),
88+
(
89+
[
90+
"type",
91+
"obj",
92+
"line",
93+
"column",
94+
"endLine",
95+
"endColumn",
96+
"path",
97+
"symbol",
98+
"message",
99+
"message-id",
100+
],
101+
"incompatible format",
102+
),
103+
(
104+
[
105+
"type",
106+
"module",
107+
"line",
108+
"column",
109+
"endLine",
110+
"endColumn",
111+
"path",
112+
"symbol",
113+
"message",
114+
"message-id",
115+
],
116+
"incompatible format",
117+
),
118+
(
119+
[
120+
"type",
121+
"module",
122+
"obj",
123+
"column",
124+
"endLine",
125+
"endColumn",
126+
"path",
127+
"symbol",
128+
"message",
129+
"message-id",
130+
],
131+
"incompatible format",
132+
),
133+
(
134+
[
135+
"type",
136+
"module",
137+
"obj",
138+
"line",
139+
"endLine",
140+
"endColumn",
141+
"path",
142+
"symbol",
143+
"message",
144+
"message-id",
145+
],
146+
"incompatible format",
147+
),
148+
(
149+
[
150+
"type",
151+
"module",
152+
"obj",
153+
"line",
154+
"column",
155+
"endColumn",
156+
"path",
157+
"symbol",
158+
"message",
159+
"message-id",
160+
],
161+
"incompatible format",
162+
),
163+
(
164+
[
165+
"type",
166+
"module",
167+
"obj",
168+
"line",
169+
"column",
170+
"endLine",
171+
"path",
172+
"symbol",
173+
"message",
174+
"message-id",
175+
],
176+
"incompatible format",
177+
),
178+
(
179+
[
180+
"type",
181+
"module",
182+
"obj",
183+
"line",
184+
"column",
185+
"endLine",
186+
"endColumn",
187+
"symbol",
188+
"message",
189+
"message-id",
190+
],
191+
"incompatible format",
192+
),
193+
(
194+
[
195+
"type",
196+
"module",
197+
"obj",
198+
"line",
199+
"column",
200+
"endLine",
201+
"endColumn",
202+
"path",
203+
"message",
204+
"message-id",
205+
],
206+
"incompatible format",
207+
),
208+
(
209+
[
210+
"type",
211+
"module",
212+
"obj",
213+
"line",
214+
"column",
215+
"endLine",
216+
"endColumn",
217+
"path",
218+
"symbol",
219+
"message-id",
220+
],
221+
"incompatible format",
222+
),
223+
(
224+
[
225+
"type",
226+
"module",
227+
"obj",
228+
"line",
229+
"column",
230+
"endLine",
231+
"endColumn",
232+
"path",
233+
"symbol",
234+
"message",
235+
],
236+
"incompatible format",
237+
),
238+
],
101239
)
102240
def test_check_lint_json(attributes, expected, tmp_path):
103241
path = Path(tmp_path, ".lint.json")
@@ -114,12 +252,12 @@ def test_check_lint_json(attributes, expected, tmp_path):
114252
@pytest.mark.parametrize(
115253
"attributes,expected",
116254
[
117-
(['errors', 'generated_at', 'metrics', 'results'], ""),
255+
(["errors", "generated_at", "metrics", "results"], ""),
118256
(["generated_at", "metrics", "results"], "incompatible format"),
119257
(["errors", "metrics", "results"], "incompatible format"),
120258
(["errors", "generated_at", "results"], "incompatible format"),
121259
(["errors", "generated_at", "metrics"], "incompatible format"),
122-
]
260+
],
123261
)
124262
def test_check_security_json(attributes, expected, tmp_path):
125263
path = Path(tmp_path, ".security.json")
@@ -140,8 +278,15 @@ def test_check_security_json(attributes, expected, tmp_path):
140278
(["meta", "file", "line_bits"], "not existing tables: ['coverage_schema']"),
141279
(["coverage_schema", "file", "line_bits"], "not existing tables: ['meta']"),
142280
(["coverage_schema", "meta", "line_bits"], "not existing tables: ['file']"),
143-
(["coverage_schema", "meta", "file", ], "not existing tables: ['line_bits']"),
144-
]
281+
(
282+
[
283+
"coverage_schema",
284+
"meta",
285+
"file",
286+
],
287+
"not existing tables: ['line_bits']",
288+
),
289+
],
145290
)
146291
def test_check_coverage(tables, expected, tmp_path):
147292
path = Path(tmp_path, ".coverage")

0 commit comments

Comments
 (0)