From c41fcb5d282699938f9ae34c58d59eb58c6d9f5d Mon Sep 17 00:00:00 2001 From: Sijawusz Pur Rahnama Date: Wed, 30 Dec 2020 22:13:51 +0100 Subject: [PATCH] Remove redundant Configuration#in_app_pattern --- src/backtracer/backtrace/frame.cr | 4 ++-- src/backtracer/configuration.cr | 9 ++------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/backtracer/backtrace/frame.cr b/src/backtracer/backtrace/frame.cr index ad9ae5a..e99aed2 100644 --- a/src/backtracer/backtrace/frame.cr +++ b/src/backtracer/backtrace/frame.cr @@ -91,9 +91,9 @@ module Backtracer # Returns `true` if this frame originated from the app source code, # `false` otherwise. # - # See `Configuration#in_app_pattern` + # See `Configuration#app_dirs_pattern` def in_app? : Bool - !!(path.try(&.matches?(configuration.in_app_pattern))) + !!(relative_path.try(&.matches?(configuration.app_dirs_pattern))) end # Returns a tuple consisting of 3 elements - an array of context lines diff --git a/src/backtracer/configuration.cr b/src/backtracer/configuration.cr index 19fcd47..39184fe 100644 --- a/src/backtracer/configuration.cr +++ b/src/backtracer/configuration.cr @@ -53,7 +53,7 @@ module Backtracer /^(?.+?)$/, } - # Used in `#in_app_pattern`. + # Path considered as "root" of your project. # # See `Frame#under_src_path?` property src_path : String? = {{ Process::INITIAL_PWD }} @@ -63,12 +63,7 @@ module Backtracer # to set this to something like `/(src|engines)/` # # See `Frame#in_app?` - property app_dirs_pattern = /src/ - - # `Regex` pattern matched against `Backtrace::Frame#path`. - # - # See `Frame#in_app?` - property in_app_pattern : Regex { /^(#{src_path}\/)?(#{app_dirs_pattern})/ } + property app_dirs_pattern = /^src\// # Path pattern matching directories to be recognized as your app modules. # Defaults to standard Shards setup (`lib/shard-name/...`).