-
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 #1641
base: master
Are you sure you want to change the base?
Solution #1641
Conversation
app/main.py
Outdated
return {"line": error["line_number"], "column": error["column_number"], | ||
"message": error["text"], "name": error["code"], | ||
"source": "flake8"} if len(error) > 0 else {} |
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.
return {"line": error["line_number"], "column": error["column_number"], | |
"message": error["text"], "name": error["code"], | |
"source": "flake8"} if len(error) > 0 else {} | |
return { | |
"line": error["line_number"], | |
"column": error["column_number"], | |
"message": error["text"], | |
"name": error["code"], | |
"source": "flake8" | |
} |
Please, place one item per line for this and following cases
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.
No reason for length check in this task
app/main.py
Outdated
# write your code here | ||
return {"line": error["line_number"], "column": error["column_number"], | ||
"message": error["text"], "name": error["code"], | ||
"source": "flake8"} if len(error) > 0 else {} | ||
pass |
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.
Remove this pass
for this and following appearances
app/main.py
Outdated
return {"errors": | ||
[{"line": error["line_number"], | ||
"column": error["column_number"], | ||
"message": error["text"], "name": error["code"], | ||
"source": "flake8"} | ||
if len(error) > 0 else {} for error in errors], | ||
"path": file_path, "status": "failed" | ||
if len(errors) > 0 else "passed"} |
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.
Use function above instead of duplicating same code
app/main.py
Outdated
return [{"errors": | ||
[{"line": error["line_number"], "column": error["column_number"], | ||
"message": error["text"], "name": error["code"], | ||
"source": "flake8"} | ||
if len(error) > 0 else {} for error in errors], | ||
"path": name, "status": "failed" if len(errors) > 0 else "passed"} | ||
for name, errors in linter_report.items()] |
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.
same here
app/main.py
Outdated
"status": "failed" | ||
if len(errors) > 0 else "passed" |
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.
"status": "failed" | |
if len(errors) > 0 else "passed" | |
"status": "failed" if errors else "passed" |
app/main.py
Outdated
} \ | ||
if len(error) > 0 else {} |
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.
} \ | |
if len(error) > 0 else {} | |
} |
Since we are not expecting that someone will call this function with wrong data. Otherwise, you need to check if all keys exist in this dict, but this is not needed to be implemented in scope of this task.
app/main.py
Outdated
if | ||
len(error) > 0 and "line_number" in error.keys() | ||
and "column_number" in error.keys() | ||
and "text" in error.keys() and "code" in error.keys() | ||
else {} |
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.
no need make this checking
app/main.py
Outdated
# write your code here | ||
pass | ||
return [format_single_linter_file(file_path=key, errors=errors) | ||
for key, errors in linter_report.items()] |
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.
Please use proper variable names. Instead of key
use something like report_path
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.
Good Job!
No description provided.