Skip to content

Commit

Permalink
Solution v2
Browse files Browse the repository at this point in the history
  • Loading branch information
Den-k0 committed Sep 24, 2024
1 parent bf711e2 commit e58045c
Showing 1 changed file with 4 additions and 26 deletions.
30 changes: 4 additions & 26 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,38 +11,16 @@ def format_linter_error(error: dict) -> dict:
def format_single_linter_file(file_path: str, errors: list) -> dict:
return {
"errors": [
{
"line": error["line_number"],
"column": error["column_number"],
"message": error["text"],
"name": error["code"],
"source": "flake8"
}
format_linter_error(error)
for error in errors
],
"path": file_path,
"status": "failed"
"status": "passed" if not errors else "failed"
}


def format_linter_report(linter_report: dict) -> list:
return [
{
"errors": [],
"path": filepath,
"status": "passed"
} if not issues else {
"errors": [
{
"line": issue["line_number"],
"column": issue["column_number"],
"message": issue["text"],
"name": issue["code"],
"source": "flake8"
}
for issue in issues
],
"path": filepath,
"status": "failed"
} for filepath, issues in linter_report.items()
format_single_linter_file(filepath, issues)
for filepath, issues in linter_report.items()
]

0 comments on commit e58045c

Please sign in to comment.