Skip to content

Commit

Permalink
Solution py-linter-formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
Nadiia-developer committed Jul 21, 2023
1 parent 2cd836b commit bd2b27e
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions app/main.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
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 {
"path": file_path,
"status": "failed" if errors else "passed",
"errors":
[format_linter_error(error) for error in errors]
}


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()]

0 comments on commit bd2b27e

Please sign in to comment.