Skip to content

Commit 3937ba7

Browse files
authored
ref: Move language_parsers to source_code_management (#89571)
1 parent 63c5dc2 commit 3937ba7

File tree

7 files changed

+11
-15
lines changed

7 files changed

+11
-15
lines changed
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
ISSUE_LOCKED_ERROR_MESSAGE = "Unable to create comment because issue is locked."
22

33
RATE_LIMITED_MESSAGE = "API rate limit exceeded"
4-
5-
# Number of stackframes to check for filename + function combo, starting from the top
6-
STACKFRAME_COUNT = 4

src/sentry/integrations/github/tasks/open_pr_comment.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,7 @@
2323

2424
from sentry.constants import EXTENSION_LANGUAGE_MAP, ObjectStatus
2525
from sentry.integrations.github.client import GitHubApiClient
26-
from sentry.integrations.github.constants import (
27-
ISSUE_LOCKED_ERROR_MESSAGE,
28-
RATE_LIMITED_MESSAGE,
29-
STACKFRAME_COUNT,
30-
)
31-
from sentry.integrations.github.tasks.language_parsers import PATCH_PARSERS
26+
from sentry.integrations.github.constants import ISSUE_LOCKED_ERROR_MESSAGE, RATE_LIMITED_MESSAGE
3227
from sentry.integrations.github.tasks.pr_comment import format_comment_url
3328
from sentry.integrations.github.tasks.utils import (
3429
GithubAPIErrorType,
@@ -38,6 +33,8 @@
3833
from sentry.integrations.models.repository_project_path_config import RepositoryProjectPathConfig
3934
from sentry.integrations.services.integration import integration_service
4035
from sentry.integrations.source_code_management.commit_context import CommitContextIntegration
36+
from sentry.integrations.source_code_management.constants import STACKFRAME_COUNT
37+
from sentry.integrations.source_code_management.language_parsers import PATCH_PARSERS
4138
from sentry.models.group import Group, GroupStatus
4239
from sentry.models.organization import Organization
4340
from sentry.models.project import Project
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Number of stackframes to check for filename + function combo, starting from the top
2+
STACKFRAME_COUNT = 4

src/sentry/integrations/github/tasks/language_parsers.py renamed to src/sentry/integrations/source_code_management/language_parsers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

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

9-
from sentry.integrations.github.constants import STACKFRAME_COUNT
9+
from sentry.integrations.source_code_management.constants import STACKFRAME_COUNT
1010

1111
stackframe_function_name = lambda i: Function(
1212
"arrayElement",

src/sentry/seer/fetch_issues/more_parsing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import re
22

3-
from sentry.integrations.github.tasks.language_parsers import (
3+
from sentry.integrations.source_code_management.language_parsers import (
44
PATCH_PARSERS,
55
LanguageParser,
66
PythonParser,

tests/sentry/integrations/github/tasks/test_open_pr_comment.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
from django.utils import timezone
77

88
from sentry.constants import ObjectStatus
9-
from sentry.integrations.github.constants import STACKFRAME_COUNT
10-
from sentry.integrations.github.tasks.language_parsers import PATCH_PARSERS
119
from sentry.integrations.github.tasks.open_pr_comment import (
1210
format_issue_table,
1311
format_open_pr_comment,
@@ -20,6 +18,8 @@
2018
)
2119
from sentry.integrations.github.tasks.utils import PullRequestFile, PullRequestIssue
2220
from sentry.integrations.models.integration import Integration
21+
from sentry.integrations.source_code_management.constants import STACKFRAME_COUNT
22+
from sentry.integrations.source_code_management.language_parsers import PATCH_PARSERS
2323
from sentry.models.group import Group, GroupStatus
2424
from sentry.models.pullrequest import CommentType, PullRequest, PullRequestComment
2525
from sentry.shared_integrations.exceptions import ApiError
@@ -825,7 +825,7 @@ def test_comment_format_missing_language(self):
825825
"sentry.integrations.github.tasks.open_pr_comment.get_projects_and_filenames_from_source_file"
826826
)
827827
@patch(
828-
"sentry.integrations.github.tasks.language_parsers.PythonParser.extract_functions_from_patch"
828+
"sentry.integrations.source_code_management.language_parsers.PythonParser.extract_functions_from_patch"
829829
)
830830
@patch("sentry.integrations.github.tasks.open_pr_comment.get_top_5_issues_by_count_for_file")
831831
@patch("sentry.integrations.github.tasks.open_pr_comment.safe_for_comment")

tests/sentry/integrations/github/tasks/test_language_parsers.py renamed to tests/sentry/integrations/source_code_management/test_language_parsers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from unittest import TestCase
22

3-
from sentry.integrations.github.tasks.language_parsers import (
3+
from sentry.integrations.source_code_management.language_parsers import (
44
JavascriptParser,
55
PHPParser,
66
PythonParser,

0 commit comments

Comments
 (0)