diff --git a/app/main.py b/app/main.py index 20463c45..c2053beb 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.get("line_number"), + "column": error.get("column_number"), + "message": error.get("text"), + "name": error.get("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 + if error.get("filename") == file_path + ], + "path": file_path, + "status": "failed" if len(errors) else "passed" + } 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() + ]