Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
Jannis-Mittenzwei committed Dec 24, 2024
1 parent 0dcd867 commit 8a4e4bc
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
15 changes: 7 additions & 8 deletions exasol/toolbox/tools/lint.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import typer
import json
from pathlib import Path
from inspect import cleandoc
from dataclasses import dataclass
from collections.abc import Iterable
from dataclasses import dataclass
from inspect import cleandoc
from pathlib import Path

import typer

CLI = typer.Typer()

Expand Down Expand Up @@ -56,15 +57,13 @@ def _rows(issues: Iterable[LintIssue]) -> str:
rows += f"|{issue.message_id}"
rows += f"|{issue.message}|\n"
return rows

template = cleandoc(
"""
{header}{rows}
"""
)
lint_issues = sorted(
lint_issues,
key=lambda i: (i.path, i.message_id, i.line)
)
lint_issues = sorted(lint_issues, key=lambda i: (i.path, i.message_id, i.line))
return template.format(header=_header(), rows=_rows(lint_issues))


Expand Down
2 changes: 1 addition & 1 deletion exasol/toolbox/tools/tbx.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

from exasol.toolbox.tools import (
issue,
lint,
security,
workflow,
lint,
)

CLI = typer.Typer()
Expand Down
17 changes: 10 additions & 7 deletions test/unit/lint_test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import json

import pytest

from exasol.toolbox.tools import lint
import json


@pytest.mark.parametrize(
"data",
Expand All @@ -17,9 +19,9 @@
"path": "test_path",
"symbol": "test_symbol",
"message": "test_message",
"message-id": "test_message_id"
"message-id": "test_message_id",
},
]
],
)
def test_lint_issue_from_json(data):
actual = lint.lint_issue_from_json(json.dumps([data]))
Expand All @@ -38,6 +40,7 @@ def test_lint_issue_from_json(data):
)
assert list(actual) == [expected]


@pytest.mark.parametrize(
"data,expected",
[
Expand All @@ -53,18 +56,18 @@ def test_lint_issue_from_json(data):
"path": "test_path",
"symbol": "test_symbol",
"message": "test_message",
"message-id": "test_message_id"
"message-id": "test_message_id",
},
"""# Static Code Analysis
|File|line<br>column|id|message|
|---|:-:|:-:|---|
|test_path|line: 0<br>column: 1|test_message_id|test_message|
"""
""",
)
]
],
)
def test_lint_issue_to_markdown(data,expected):
def test_lint_issue_to_markdown(data, expected):
issue = lint.LintIssue(
type=data["type"],
module=data["module"],
Expand Down

0 comments on commit 8a4e4bc

Please sign in to comment.