-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Solution-py-linter-formatter #1616
base: master
Are you sure you want to change the base?
Changes from 6 commits
262eabc
c02110b
7f691a9
f0cf009
8857649
40fb7e7
bf7f234
e45b1e2
058d1f0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,24 @@ | ||
def format_linter_error(error: dict) -> dict: | ||
# write your code here | ||
pass | ||
return { | ||
("name" if key == "code" else "source" if key == "filename" else | ||
"message" if key == "text" else tuple(key.split("_"))[0]): | ||
("flake8" if key == "filename" else value) | ||
for key, value in error.items() if key != "physical_line" | ||
} | ||
|
||
|
||
def format_single_linter_file(file_path: str, errors: list) -> dict: | ||
# write your code here | ||
pass | ||
return { | ||
("errors" if elem == "error" else elem): | ||
([format_linter_error(error) for error in errors] | ||
if elem == "error" else file_path if elem == "path" else | ||
"failed" if elem == "status" and errors != [] else "passed") | ||
for elem in ("error", "path", "status") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the same here. also, |
||
} | ||
|
||
|
||
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() | ||
] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not readable code. please, use static key names and choose the correct fields from the dictionary for those keys. for example: