File tree Expand file tree Collapse file tree 3 files changed +18
-16
lines changed
Expand file tree Collapse file tree 3 files changed +18
-16
lines changed Original file line number Diff line number Diff line change 1- import typer
21import json
3- from pathlib import Path
4- from inspect import cleandoc
5- from dataclasses import dataclass
62from collections .abc import Iterable
3+ from dataclasses import dataclass
4+ from inspect import cleandoc
5+ from pathlib import Path
6+
7+ import typer
78
89CLI = typer .Typer ()
910
@@ -56,15 +57,13 @@ def _rows(issues: Iterable[LintIssue]) -> str:
5657 rows += f"|{ issue .message_id } "
5758 rows += f"|{ issue .message } |\n "
5859 return rows
60+
5961 template = cleandoc (
6062 """
6163 {header}{rows}
6264 """
6365 )
64- lint_issues = sorted (
65- lint_issues ,
66- key = lambda i : (i .path , i .message_id , i .line )
67- )
66+ lint_issues = sorted (lint_issues , key = lambda i : (i .path , i .message_id , i .line ))
6867 return template .format (header = _header (), rows = _rows (lint_issues ))
6968
7069
Original file line number Diff line number Diff line change 22
33from exasol .toolbox .tools import (
44 issue ,
5+ lint ,
56 security ,
67 workflow ,
7- lint ,
88)
99
1010CLI = typer .Typer ()
Original file line number Diff line number Diff line change 1+ import json
2+
13import pytest
24
35from exasol .toolbox .tools import lint
4- import json
6+
57
68@pytest .mark .parametrize (
79 "data" ,
1719 "path" : "test_path" ,
1820 "symbol" : "test_symbol" ,
1921 "message" : "test_message" ,
20- "message-id" : "test_message_id"
22+ "message-id" : "test_message_id" ,
2123 },
22- ]
24+ ],
2325)
2426def test_lint_issue_from_json (data ):
2527 actual = lint .lint_issue_from_json (json .dumps ([data ]))
@@ -38,6 +40,7 @@ def test_lint_issue_from_json(data):
3840 )
3941 assert list (actual ) == [expected ]
4042
43+
4144@pytest .mark .parametrize (
4245 "data,expected" ,
4346 [
@@ -53,18 +56,18 @@ def test_lint_issue_from_json(data):
5356 "path" : "test_path" ,
5457 "symbol" : "test_symbol" ,
5558 "message" : "test_message" ,
56- "message-id" : "test_message_id"
59+ "message-id" : "test_message_id" ,
5760 },
5861 """# Static Code Analysis
5962
6063|File|line<br>column|id|message|
6164|---|:-:|:-:|---|
6265|test_path|line: 0<br>column: 1|test_message_id|test_message|
63- """
66+ """ ,
6467 )
65- ]
68+ ],
6669)
67- def test_lint_issue_to_markdown (data ,expected ):
70+ def test_lint_issue_to_markdown (data , expected ):
6871 issue = lint .LintIssue (
6972 type = data ["type" ],
7073 module = data ["module" ],
You can’t perform that action at this time.
0 commit comments