Skip to content

Commit

Permalink
Marks .bundle/ files out of project (#420)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cawllec authored and kattrali committed Jan 26, 2018
1 parent fb71a8f commit 44c6ab1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/bugsnag/stacktrace.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Stacktrace
JAVA_BACKTRACE_REGEX = /^(.*)\((.*)(?::([0-9]+))?\)$/

# Path to vendored code. Used to mark file paths as out of project.
VENDOR_PATH = 'vendor/'
VENDOR_PATH = /^(vendor\/|\.bundle\/)/

def initialize(backtrace, configuration)
@configuration = configuration
Expand Down Expand Up @@ -44,7 +44,7 @@ def initialize(backtrace, configuration)
if defined?(@configuration.project_root) && @configuration.project_root.to_s != ''
trace_hash[:inProject] = true if file.start_with?(@configuration.project_root.to_s)
file.sub!(/#{@configuration.project_root}\//, "")
trace_hash.delete(:inProject) if file.start_with?(VENDOR_PATH)
trace_hash.delete(:inProject) if file.match(VENDOR_PATH)
end


Expand Down
10 changes: 9 additions & 1 deletion spec/report_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,10 @@ def gloops
File.join(project_root, "lib/helpers/string.rb:32:in `splice'"),
File.join(project_root, "lib/vendor/lib/article.rb:158:in `initialize'"),
File.join(project_root, "lib/prog.rb:158:in `read_articles'"),
File.join(project_root, ".bundle/strutils/lib.string.rb:508:in `splice'"),
File.join(project_root, "abundle/article.rb:158:in `initialize'"),
File.join(project_root, ".bundles/strutils/lib.string.rb:508:in `splice'"),
File.join(project_root, "lib/.bundle/article.rb:158:in `initialize'"),
"app.rb:10:in `main'",
"(pry):3:in `__pry__'"
]}
Expand All @@ -549,7 +553,11 @@ def gloops
expect(exception["stacktrace"][3]["inProject"]).to be true
expect(exception["stacktrace"][4]["inProject"]).to be true
expect(exception["stacktrace"][5]["inProject"]).to be_nil
expect(exception["stacktrace"][6]["inProject"]).to be_nil
expect(exception["stacktrace"][6]["inProject"]).to be true
expect(exception["stacktrace"][7]["inProject"]).to be true
expect(exception["stacktrace"][8]["inProject"]).to be true
expect(exception["stacktrace"][9]["inProject"]).to be_nil
expect(exception["stacktrace"][10]["inProject"]).to be_nil
}
end

Expand Down

0 comments on commit 44c6ab1

Please sign in to comment.