Skip to content

Commit

Permalink
Solution
Browse files Browse the repository at this point in the history
  • Loading branch information
Gleb232 committed Nov 7, 2024
1 parent 6ea507b commit a00b171
Showing 1 changed file with 5 additions and 24 deletions.
29 changes: 5 additions & 24 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,13 @@ def format_linter_error(error: dict) -> dict:

def format_single_linter_file(file_path: str, errors: list) -> dict:
return {
"errors": [{
"line": key["line_number"],
"column": key["column_number"],
"message": key["text"],
"name": key["code"],
"source": "flake8"
} for key in errors],
"errors": [format_linter_error(key)
for key in errors],
"path": file_path,
"status": "failed"
"status": "failed" if errors else "passed",
}


def format_linter_report(linter_report: dict) -> list:
return [
{"errors":
[
{
"line": key["line_number"],
"column": key["column_number"],
"message": key["text"],
"name": key["code"],
"source": "flake8"
} for key in linter_report[file]],
"path": file,
"status": "passed" if not linter_report[file] else "failed"}
for file in ["./test_source_code_2.py",
"./source_code_2.py",
"./source_code_1.py",
"./test_source_code_1.py"]]
return [format_single_linter_file(file_path, errors)
for file_path, errors in linter_report.items()]

0 comments on commit a00b171

Please sign in to comment.