From 1bbe10f682186983adfb14f33aa829642045aa52 Mon Sep 17 00:00:00 2001 From: Trukhanov Danylo Date: Tue, 26 Nov 2024 20:14:53 +0200 Subject: [PATCH] Solution --- app/main.py | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/app/main.py b/app/main.py index 20463c45..c96a5619 100644 --- a/app/main.py +++ b/app/main.py @@ -1,13 +1,32 @@ 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": [ + { + "line": error["line_number"], + "column": error["column_number"], + "message": error["text"], + "name": error["code"], + "source": "flake8" + } + for error in 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=path, errors=errors) + for path, errors in linter_report.items() + ]