Skip to content

Commit

Permalink
ref(sdk-crashes): Rename cocoa crash detector file (#59407)
Browse files Browse the repository at this point in the history
Rename cocoa_sdk_crash_detector to sdk_crash_detector_configs to prepare
to have all SDK configs in one file.
  • Loading branch information
philipphofmann committed Nov 7, 2023
1 parent 6480e22 commit 365f2ab
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from sentry.utils.sdk_crashes.sdk_crash_detector import SDKCrashDetectorConfig

_cocoa_sdk_crash_detector_config = SDKCrashDetectorConfig(
cocoa_sdk_crash_detector_config = SDKCrashDetectorConfig(
# Explicitly use an allow list to avoid detecting SDK crashes for SDK names we don't know.
sdk_names=[
"sentry.cocoa",
Expand Down
4 changes: 2 additions & 2 deletions src/sentry/utils/sdk_crashes/sdk_crash_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from sentry.eventstore.models import Event
from sentry.issues.grouptype import GroupCategory
from sentry.utils.safe import get_path, set_path
from sentry.utils.sdk_crashes.cocoa_sdk_crash_detector import _cocoa_sdk_crash_detector_config
from sentry.utils.sdk_crashes.configs import cocoa_sdk_crash_detector_config
from sentry.utils.sdk_crashes.event_stripper import strip_event_data
from sentry.utils.sdk_crashes.sdk_crash_detection_config import SDKCrashDetectionConfig, SdkName
from sentry.utils.sdk_crashes.sdk_crash_detector import SDKCrashDetector
Expand Down Expand Up @@ -125,6 +125,6 @@ def detect_sdk_crash(


_crash_reporter = SDKCrashReporter()
_cocoa_sdk_crash_detector = SDKCrashDetector(config=_cocoa_sdk_crash_detector_config)
_cocoa_sdk_crash_detector = SDKCrashDetector(config=cocoa_sdk_crash_detector_config)

sdk_crash_detection = SDKCrashDetection(_crash_reporter, {SdkName.Cocoa: _cocoa_sdk_crash_detector})
12 changes: 6 additions & 6 deletions tests/sentry/utils/sdk_crashes/test_event_stripper.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
)
from sentry.testutils.pytest.fixtures import django_db_all
from sentry.utils.safe import get_path, set_path
from sentry.utils.sdk_crashes.cocoa_sdk_crash_detector import _cocoa_sdk_crash_detector_config
from sentry.utils.sdk_crashes.configs import cocoa_sdk_crash_detector_config
from sentry.utils.sdk_crashes.event_stripper import strip_event_data
from sentry.utils.sdk_crashes.sdk_crash_detector import SDKCrashDetector

Expand All @@ -24,7 +24,7 @@ def inner(data):

@pytest.fixture
def store_and_strip_event(store_event):
def inner(data, config=_cocoa_sdk_crash_detector_config):
def inner(data, config=cocoa_sdk_crash_detector_config):
event = store_event(data=data)
return strip_event_data(event.data, SDKCrashDetector(config=config))

Expand Down Expand Up @@ -91,7 +91,7 @@ def test_strip_event_data_strips_value_if_not_simple_type(store_event):
event.data["type"] = {"foo": "bar"}

stripped_event_data = strip_event_data(
event.data, SDKCrashDetector(config=_cocoa_sdk_crash_detector_config)
event.data, SDKCrashDetector(config=cocoa_sdk_crash_detector_config)
)

assert stripped_event_data.get("type") is None
Expand All @@ -107,7 +107,7 @@ def test_strip_event_data_keeps_simple_types(store_event):
event.data["platform"] = "cocoa"

stripped_event_data = strip_event_data(
event.data, SDKCrashDetector(config=_cocoa_sdk_crash_detector_config)
event.data, SDKCrashDetector(config=cocoa_sdk_crash_detector_config)
)

assert stripped_event_data.get("type") is True
Expand Down Expand Up @@ -148,7 +148,7 @@ def test_strip_event_data_keeps_exception_mechanism(store_event):
)

stripped_event_data = strip_event_data(
event.data, SDKCrashDetector(config=_cocoa_sdk_crash_detector_config)
event.data, SDKCrashDetector(config=cocoa_sdk_crash_detector_config)
)

mechanism = get_path(stripped_event_data, "exception", "values", 0, "mechanism")
Expand Down Expand Up @@ -314,7 +314,7 @@ def test_strip_frames_sdk_frames_multiple_replacement_names(store_and_strip_even

event_data = get_crash_event_with_frames(frames)

config = copy.deepcopy(_cocoa_sdk_crash_detector_config)
config = copy.deepcopy(cocoa_sdk_crash_detector_config)
config.sdk_frame_path_replacement_names = {
r"*Package*": "SentryPackage",
r"*Module*": "SentryModule",
Expand Down

0 comments on commit 365f2ab

Please sign in to comment.