-
Notifications
You must be signed in to change notification settings - Fork 0
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
Sourcery refactored main branch #1
Conversation
token = os.getenv("GH_TOKEN") | ||
if token: | ||
if token := os.getenv("GH_TOKEN"): |
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.
Function auth_to_github
refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression
)
time_to_first_response = None | ||
return None |
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.
Function measure_time_to_first_response
refactored with the following changes:
- Lift return into if (
lift-return-into-if
)
time_to_close = closed_at - created_at | ||
|
||
return time_to_close | ||
return closed_at - created_at |
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.
Function measure_time_to_close
refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable
)
[issue.time_to_close for issue in issues_with_time_to_close], timedelta() | ||
(issue.time_to_close for issue in issues_with_time_to_close), | ||
timedelta(), |
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.
Function get_average_time_to_close
refactored with the following changes:
- Replace unneeded comprehension with generator (
comprehension-to-generator
)
if issue.state == "open": # type: ignore | ||
num_issues_open += 1 | ||
if issue.state == "closed": # type: ignore | ||
if issue.state == "closed": | ||
num_issues_closed += 1 |
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.
Function main
refactored with the following changes:
- Simplify conditional into switch-like form (
switch
)
repo_url = os.getenv("REPOSITORY_URL") | ||
if not repo_url: | ||
if repo_url := os.getenv("REPOSITORY_URL"): | ||
return search_query, repo_url | ||
else: | ||
raise ValueError("REPOSITORY_URL environment variable not set") | ||
return search_query, repo_url |
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.
Function get_env_vars
refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression
) - Lift code into else after jump in control flow (
reintroduce-else
) - Swap if/else branches (
swap-if-else-branches
)
Branch
main
refactored by Sourcery.If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.
See our documentation here.
Run Sourcery locally
Reduce the feedback loop during development by using the Sourcery editor plugin:
Review changes via command line
To manually merge these changes, make sure you're on the
main
branch, then run:Help us improve this pull request!