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

Fix comparison with NoneType logical error #3009

Merged
merged 2 commits into from
Feb 22, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions augur/tasks/github/pull_requests/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
from augur.application.db.models import PullRequest, Message, PullRequestReview, PullRequestLabel, PullRequestReviewer, PullRequestMeta, PullRequestAssignee, PullRequestReviewMessageRef, Contributor, Repo
from augur.tasks.github.util.github_task_session import GithubTaskManifest
from augur.tasks.github.util.github_random_key_auth import GithubRandomKeyAuth
from augur.application.db.lib import get_session, get_repo_by_repo_git, bulk_insert_dicts, get_pull_request_reviews_by_repo_id

Check warning on line 14 in augur/tasks/github/pull_requests/tasks.py

View workflow job for this annotation

GitHub Actions / runner / pylint

[pylint] reported by reviewdog 🐶 W0611: Unused get_session imported from augur.application.db.lib (unused-import) Raw Output: augur/tasks/github/pull_requests/tasks.py:14:0: W0611: Unused get_session imported from augur.application.db.lib (unused-import)
from augur.application.db.util import execute_session_query
from ..messages import process_github_comment_contributors
from augur.application.db.lib import get_secondary_data_last_collected, get_updated_prs, get_core_data_last_collected

from typing import Generator, List, Dict

Check warning on line 19 in augur/tasks/github/pull_requests/tasks.py

View workflow job for this annotation

GitHub Actions / runner / pylint

[pylint] reported by reviewdog 🐶 W0611: Unused Generator imported from typing (unused-import) Raw Output: augur/tasks/github/pull_requests/tasks.py:19:0: W0611: Unused Generator imported from typing (unused-import)

Check warning on line 19 in augur/tasks/github/pull_requests/tasks.py

View workflow job for this annotation

GitHub Actions / runner / pylint

[pylint] reported by reviewdog 🐶 W0611: Unused Dict imported from typing (unused-import) Raw Output: augur/tasks/github/pull_requests/tasks.py:19:0: W0611: Unused Dict imported from typing (unused-import)


platform_id = 1
Expand Down Expand Up @@ -52,11 +52,11 @@
total_count += len(all_data)
all_data.clear()

if len(all_data):

Check warning on line 55 in augur/tasks/github/pull_requests/tasks.py

View workflow job for this annotation

GitHub Actions / runner / pylint

[pylint] reported by reviewdog 🐶 C1802: Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty (use-implicit-booleaness-not-len) Raw Output: augur/tasks/github/pull_requests/tasks.py:55:11: C1802: Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty (use-implicit-booleaness-not-len)
process_pull_requests(all_data, f"{owner}/{repo}: Github Pr task", repo_id, logger, augur_db)
total_count += len(all_data)

if total_count > 0:

Check warning on line 59 in augur/tasks/github/pull_requests/tasks.py

View workflow job for this annotation

GitHub Actions / runner / pylint

[pylint] reported by reviewdog 🐶 R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return) Raw Output: augur/tasks/github/pull_requests/tasks.py:59:8: R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
return total_count
else:
logger.debug(f"{owner}/{repo} has no pull requests")
Expand Down Expand Up @@ -231,9 +231,14 @@
repo_id = get_repo_by_repo_git(repo_git).repo_id

if not full_collection:
# subtract 2 days to ensure all data is collected
core_data_last_collected = (get_core_data_last_collected(repo_id) - timedelta(days=2)).replace(tzinfo=timezone.utc)
review_msg_url += f"?since={core_data_last_collected.isoformat()}"
last_collected_date = get_secondary_data_last_collected(repo_id)

if last_collected_date:
# subtract 2 days to ensure all data is collected
core_data_last_collected = (last_collected_date - timedelta(days=2)).replace(tzinfo=timezone.utc)
review_msg_url += f"?since={core_data_last_collected.isoformat()}"
else:
logger.warning(f"core_data_last_collected is NULL for recollection on repo: {repo_git}")

pr_reviews = get_pull_request_reviews_by_repo_id(repo_id)

Expand Down