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

feat(integrations): Unify get_repositories signature #83921

Merged
merged 14 commits into from
Jan 24, 2025

Conversation

armenzg
Copy link
Member

@armenzg armenzg commented Jan 23, 2025

This unifies the signature of get_repositories of all SCM integrations.
It also consolidates get_repositories for GitHub.

@armenzg armenzg self-assigned this Jan 23, 2025
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Jan 23, 2025
@@ -381,6 +381,7 @@ module = [
"sentry.integrations.services.*",
"sentry.integrations.slack.threads.*",
"sentry.integrations.slack.views.*",
"sentry.integrations.source_code_management.repository",
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the list of modules with stronger typing.

@@ -3,7 +3,7 @@
import logging
from collections.abc import Mapping, Sequence
from datetime import datetime
from typing import Any, cast
Copy link
Member Author

Choose a reason for hiding this comment

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

Using cast is a bad practice, thus, removing it.

@@ -493,26 +493,6 @@ def _populate_tree(
)
return RepoTree(Repo(full_name, branch), repo_files)

def get_repositories(self, fetch_max_pages: bool = False) -> Sequence[Any]:
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm integrating this into github/integration.py.

return [
{
"name": i["name"],
"identifier": i["full_name"],
"default_branch": i.get("default_branch"),
}
for i in self.get_client().get_repositories(fetch_max_pages)
Copy link
Member Author

Choose a reason for hiding this comment

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

The added code all comes from the get_repositories I delete:
image

@armenzg armenzg marked this pull request as ready for review January 23, 2025 15:21
@armenzg armenzg requested review from a team as code owners January 23, 2025 15:21
Copy link

codecov bot commented Jan 23, 2025

Codecov Report

Attention: Patch coverage is 94.73684% with 1 line in your changes missing coverage. Please review.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...ntry/integrations/github_enterprise/integration.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #83921      +/-   ##
==========================================
+ Coverage   87.55%   87.66%   +0.11%     
==========================================
  Files        9542     9536       -6     
  Lines      540927   546135    +5208     
  Branches    21282    21206      -76     
==========================================
+ Hits       473623   478786    +5163     
- Misses      66949    66983      +34     
- Partials      355      366      +11     

@armenzg armenzg removed request for a team January 23, 2025 15:59
@armenzg armenzg marked this pull request as draft January 23, 2025 15:59
@armenzg
Copy link
Member Author

armenzg commented Jan 23, 2025

I need to fix the tests first.

@armenzg armenzg requested a review from cathteng January 23, 2025 17:23
@armenzg armenzg marked this pull request as ready for review January 23, 2025 17:23
Copy link
Member

@cathteng cathteng left a comment

Choose a reason for hiding this comment

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

thanks for doing this!

Copy link
Member

@asottile-sentry asottile-sentry left a comment

Choose a reason for hiding this comment

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

@armenzg armenzg merged commit af20b71 into master Jan 24, 2025
49 checks passed
@armenzg armenzg deleted the type/github_client/integrations/armenzg branch January 24, 2025 14:35
Copy link

sentry-io bot commented Jan 26, 2025

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ ApiError: {"detail":"Internal Error","errorId":"e3c712c446ae4eb58f08be0782d7a0df"} sentry.tasks.auto_enable_codecov.enable_for_org View Issue

Did you find this useful? React with a 👍 or 👎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants