Skip to content

Commit 97d62ed

Browse files
authored
Fix regexes on Erlang/OTP 28 (#889)
1 parent 9887bd0 commit 97d62ed

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

lib/sentry/config.ex

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,6 @@ defmodule Sentry.Config do
374374
type:
375375
{:list,
376376
{:custom, __MODULE__, :__validate_struct__, [:source_code_exclude_patterns, Regex]}},
377-
default: [~r"/_build/", ~r"/deps/", ~r"/priv/", ~r"/test/"],
378377
type_doc: "list of `t:Regex.t/0`",
379378
doc: """
380379
A list of regular expressions used to determine which files to

lib/sentry/sources.ex

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,13 @@ defmodule Sentry.Sources do
105105
config = Sentry.Config.validate!(config)
106106

107107
path_pattern = Keyword.fetch!(config, :source_code_path_pattern)
108-
exclude_patterns = Keyword.fetch!(config, :source_code_exclude_patterns)
108+
109+
exclude_patterns =
110+
Keyword.get(
111+
config,
112+
:source_code_exclude_patterns,
113+
[~r"/_build/", ~r"/deps/", ~r"/priv/", ~r"/test/"]
114+
)
109115

110116
config
111117
|> Keyword.fetch!(:root_source_code_paths)

test/sentry/config_test.exs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,11 @@ defmodule Sentry.ConfigTest do
9393
end
9494

9595
test ":source_code_exclude_patterns" do
96-
assert Config.validate!(source_code_exclude_patterns: [])[:source_code_exclude_patterns] ==
97-
[]
98-
99-
assert Config.validate!([])[:source_code_exclude_patterns] == [
100-
~r"/_build/",
101-
~r"/deps/",
102-
~r"/priv/",
103-
~r"/test/"
104-
]
96+
assert Config.validate!([])[:source_code_exclude_patterns] == nil
97+
98+
regex = ~r/foo/
99+
config = [source_code_exclude_patterns: [regex]]
100+
assert Config.validate!(config)[:source_code_exclude_patterns] == [regex]
105101

106102
message = ~r/invalid list in :source_code_exclude_patterns option/
107103

0 commit comments

Comments
 (0)