Skip to content

ref: Move language_parsers to source_code_management #89571

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

Merged
merged 1 commit into from
Apr 15, 2025
Merged
Show file tree
Hide file tree
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
3 changes: 0 additions & 3 deletions src/sentry/integrations/github/constants.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
ISSUE_LOCKED_ERROR_MESSAGE = "Unable to create comment because issue is locked."

RATE_LIMITED_MESSAGE = "API rate limit exceeded"

# Number of stackframes to check for filename + function combo, starting from the top
STACKFRAME_COUNT = 4
9 changes: 3 additions & 6 deletions src/sentry/integrations/github/tasks/open_pr_comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,7 @@

from sentry.constants import EXTENSION_LANGUAGE_MAP, ObjectStatus
from sentry.integrations.github.client import GitHubApiClient
from sentry.integrations.github.constants import (
ISSUE_LOCKED_ERROR_MESSAGE,
RATE_LIMITED_MESSAGE,
STACKFRAME_COUNT,
)
from sentry.integrations.github.tasks.language_parsers import PATCH_PARSERS
from sentry.integrations.github.constants import ISSUE_LOCKED_ERROR_MESSAGE, RATE_LIMITED_MESSAGE
from sentry.integrations.github.tasks.pr_comment import format_comment_url
from sentry.integrations.github.tasks.utils import (
GithubAPIErrorType,
Expand All @@ -38,6 +33,8 @@
from sentry.integrations.models.repository_project_path_config import RepositoryProjectPathConfig
from sentry.integrations.services.integration import integration_service
from sentry.integrations.source_code_management.commit_context import CommitContextIntegration
from sentry.integrations.source_code_management.constants import STACKFRAME_COUNT
from sentry.integrations.source_code_management.language_parsers import PATCH_PARSERS
from sentry.models.group import Group, GroupStatus
from sentry.models.organization import Organization
from sentry.models.project import Project
Expand Down
2 changes: 2 additions & 0 deletions src/sentry/integrations/source_code_management/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Number of stackframes to check for filename + function combo, starting from the top
STACKFRAME_COUNT = 4
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from snuba_sdk import BooleanCondition, BooleanOp, Column, Condition, Function, Op

from sentry.integrations.github.constants import STACKFRAME_COUNT
from sentry.integrations.source_code_management.constants import STACKFRAME_COUNT

stackframe_function_name = lambda i: Function(
"arrayElement",
Expand Down
2 changes: 1 addition & 1 deletion src/sentry/seer/fetch_issues/more_parsing.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import re

from sentry.integrations.github.tasks.language_parsers import (
from sentry.integrations.source_code_management.language_parsers import (
PATCH_PARSERS,
LanguageParser,
PythonParser,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
from django.utils import timezone

from sentry.constants import ObjectStatus
from sentry.integrations.github.constants import STACKFRAME_COUNT
from sentry.integrations.github.tasks.language_parsers import PATCH_PARSERS
from sentry.integrations.github.tasks.open_pr_comment import (
format_issue_table,
format_open_pr_comment,
Expand All @@ -20,6 +18,8 @@
)
from sentry.integrations.github.tasks.utils import PullRequestFile, PullRequestIssue
from sentry.integrations.models.integration import Integration
from sentry.integrations.source_code_management.constants import STACKFRAME_COUNT
from sentry.integrations.source_code_management.language_parsers import PATCH_PARSERS
from sentry.models.group import Group, GroupStatus
from sentry.models.pullrequest import CommentType, PullRequest, PullRequestComment
from sentry.shared_integrations.exceptions import ApiError
Expand Down Expand Up @@ -825,7 +825,7 @@ def test_comment_format_missing_language(self):
"sentry.integrations.github.tasks.open_pr_comment.get_projects_and_filenames_from_source_file"
)
@patch(
"sentry.integrations.github.tasks.language_parsers.PythonParser.extract_functions_from_patch"
"sentry.integrations.source_code_management.language_parsers.PythonParser.extract_functions_from_patch"
)
@patch("sentry.integrations.github.tasks.open_pr_comment.get_top_5_issues_by_count_for_file")
@patch("sentry.integrations.github.tasks.open_pr_comment.safe_for_comment")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from unittest import TestCase

from sentry.integrations.github.tasks.language_parsers import (
from sentry.integrations.source_code_management.language_parsers import (
JavascriptParser,
PHPParser,
PythonParser,
Expand Down
Loading