Skip to content
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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Solution #1641

wants to merge 5 commits into from

Conversation

sashasyrota
Copy link

No description provided.

app/main.py Outdated
Comment on lines 2 to 4
return {"line": error["line_number"], "column": error["column_number"],
"message": error["text"], "name": error["code"],
"source": "flake8"} if len(error) > 0 else {}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

Copy link

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
Copy link

@LLkaia LLkaia Sep 17, 2024

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
Comment on lines 9 to 16
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"}
Copy link

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
Comment on lines 21 to 27
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()]
Copy link

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
Comment on lines 16 to 17
"status": "failed"
if len(errors) > 0 else "passed"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"status": "failed"
if len(errors) > 0 else "passed"
"status": "failed" if errors else "passed"

app/main.py Outdated
Comment on lines 8 to 9
} \
if len(error) > 0 else {}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
} \
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
Comment on lines 8 to 12
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 {}

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

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

Copy link

@vsmutok vsmutok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good Job!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants