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

Change log statements in contributor resolution to match new policy #2862

Merged
merged 1 commit into from
Jul 9, 2024

Conversation

IsaacMilarky
Copy link
Contributor

Description
Make logging statements in the contributor resolution logic follow new policy: #2848

This PR fixes #2856

Signed commits

  • Yes, I signed my commits.

continue

#logger.info(f"Returned dict: {response_data}")
success = True
break
elif type(response_data) == list:
Copy link

Choose a reason for hiding this comment

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

[pylint] reported by reviewdog 🐶
C0123: Use isinstance() rather than type() for a typecheck. (unidiomatic-typecheck)

success = True
break
elif type(response_data) == list:
logger.warning("Wrong type returned, trying again...")
logger.info(f"Returned list: {response_data}")
logger.debug(f"Returned list: {response_data}")
elif type(response_data) == str:
Copy link

Choose a reason for hiding this comment

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

[pylint] reported by reviewdog 🐶
C0123: Use isinstance() rather than type() for a typecheck. (unidiomatic-typecheck)

@@ -25,8 +25,6 @@
# Returns None on failure.
# NOTE: This function is being deprecated in favor of retrieve_dict_from_endpoint
def request_dict_from_endpoint(logger, session, url, timeout_wait=10):
Copy link

Choose a reason for hiding this comment

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

[pylint] reported by reviewdog 🐶
R0912: Too many branches (14/12) (too-many-branches)

@@ -95,7 +92,6 @@ def request_dict_from_endpoint(logger, session, url, timeout_wait=10):


def create_endpoint_from_email(email):
#self.logger.info(f"Trying to resolve contributor from email: {email}")
# Note: I added "+type:user" to avoid having user owned organizations be returned
# Also stopped splitting per note above.
url = 'https://api.github.com/search/users?q={}+in:email+type:user'.format(
Copy link

Choose a reason for hiding this comment

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

[pylint] reported by reviewdog 🐶
C0209: Formatting a regular string which could be an f-string (consider-using-f-string)

@@ -215,8 +206,6 @@ def resolve_if_login_existing(logger, contributor):
return True

# If not found, return false
logger.info(
f"Contributor not found in contributors table but can be added. Adding...")
return False
"""
Copy link

Choose a reason for hiding this comment

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

[pylint] reported by reviewdog 🐶
W0105: String statement has no effect (pointless-string-statement)

@@ -293,9 +281,9 @@ def fetch_username_from_email(logger, auth, commit):

# Check if the email result got anything, if it failed try a name search.
if login_json is None or 'total_count' not in login_json or login_json['total_count'] == 0:
Copy link

Choose a reason for hiding this comment

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

[pylint] reported by reviewdog 🐶
R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)

@@ -57,7 +57,7 @@ def process_commit_metadata(logger, auth, contributorQueue, repo_id, platform_id
login = get_login_with_commit_hash(logger, auth, contributor, repo_id)

if login == None or login == "":
Copy link

Choose a reason for hiding this comment

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

[pylint] reported by reviewdog 🐶
R1714: Consider merging these comparisons with 'in' by using 'login in (None, '')'. Use a set instead if elements are hashable. (consider-using-in)

@@ -57,7 +57,7 @@ def process_commit_metadata(logger, auth, contributorQueue, repo_id, platform_id
login = get_login_with_commit_hash(logger, auth, contributor, repo_id)

if login == None or login == "":
Copy link

Choose a reason for hiding this comment

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

[pylint] reported by reviewdog 🐶
C0121: Comparison 'login == None' should be 'login is None' (singleton-comparison)

@IsaacMilarky IsaacMilarky linked an issue Jul 8, 2024 that may be closed by this pull request
@ABrain7710 ABrain7710 merged commit 5e2b747 into dev Jul 9, 2024
9 checks passed
@IsaacMilarky IsaacMilarky deleted the isaac-logging-changes branch October 15, 2024 23:25
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.

Improve Contributor Resolution Logging
2 participants