From 008feda63293076edb9efc2103d3634244b89b65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=95=D0=B2=D0=B3=D0=B5=D0=BD=D0=B8=D0=B9=20=D0=9D=D0=B0?= =?UTF-8?q?=D0=B2=D0=BE=D0=BB=D0=BE=D0=BA=D0=BE=D0=B2?= Date: Sat, 21 Dec 2024 12:35:04 +0200 Subject: [PATCH] Solution --- app/main.py | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/app/main.py b/app/main.py index 20463c45..68918b9e 100644 --- a/app/main.py +++ b/app/main.py @@ -1,13 +1,27 @@ 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 + return { + "errors": + [ + format_linter_error(error) + for error in errors + ], + "path": file_path, + "status": "passed" if not errors else "failed" + } + def format_linter_report(linter_report: dict) -> list: - # write your code here - pass + return [ + format_single_linter_file(key, value) + for key, value in linter_report.items() + ]