From 29d6a6af60bea4bfefe8fcc47acaf5dc60de2534 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D1=80=D0=B8=D1=81=D1=8F=D0=B6=D0=BD=D1=96=D0=BA?= =?UTF-8?q?=D0=BE=D0=B2?= <150026110+maximprysyazhnikov@users.noreply.github.com> Date: Thu, 17 Oct 2024 13:40:06 +0300 Subject: [PATCH 1/2] Solution --- app/main.py | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/app/main.py b/app/main.py index 20463c45..fcd020e3 100644 --- a/app/main.py +++ b/app/main.py @@ -1,13 +1,25 @@ def format_linter_error(error: dict) -> dict: - # write your code here - pass + return { + "line": error["line_number"], + "column": error["column_number"], + "message": error["text"], + "name": error["code"], + "source": "flake8" + } def format_single_linter_file(file_path: str, errors: list) -> dict: - # write your code here - pass + formatted_errors = [format_linter_error(error) for error in errors] + + return { + "errors": formatted_errors, + "path": file_path, + "status": "failed" if errors else "passed" + } def format_linter_report(linter_report: dict) -> list: - # write your code here - pass + return [ + format_single_linter_file(file_path, errors) + for file_path, errors in linter_report.items() + ] From 8c3a66fbc617cd4004a671baa800684084e942b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D1=80=D0=B8=D1=81=D1=8F=D0=B6=D0=BD=D1=96=D0=BA?= =?UTF-8?q?=D0=BE=D0=B2?= <150026110+maximprysyazhnikov@users.noreply.github.com> Date: Thu, 17 Oct 2024 13:44:15 +0300 Subject: [PATCH 2/2] Solution --- app/main.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/main.py b/app/main.py index fcd020e3..5a1c6a6d 100644 --- a/app/main.py +++ b/app/main.py @@ -9,10 +9,8 @@ def format_linter_error(error: dict) -> dict: def format_single_linter_file(file_path: str, errors: list) -> dict: - formatted_errors = [format_linter_error(error) for error in errors] - return { - "errors": formatted_errors, + "errors": [format_linter_error(error) for error in errors], "path": file_path, "status": "failed" if errors else "passed" }