|
2 | 2 |
|
3 | 3 | # typed: strict |
4 | 4 |
|
5 | | -require 'set' |
6 | 5 | require 'code_teams' |
7 | 6 | require 'sorbet-runtime' |
8 | 7 | require 'json' |
9 | 8 | require 'packs-specification' |
10 | | -require 'code_ownership/mapper' |
11 | | -require 'code_ownership/validator' |
12 | | -require 'code_ownership/private' |
13 | | -require 'code_ownership/cli' |
14 | | -require 'code_ownership/configuration' |
| 9 | +require 'zeitwerk' |
| 10 | + |
| 11 | +loader = Zeitwerk::Loader.for_gem |
| 12 | +loader.setup |
15 | 13 |
|
16 | 14 | if defined?(Packwerk) |
17 | | - require 'code_ownership/private/permit_pack_owner_top_level_key' |
| 15 | + require 'code_ownership/private/pack_ownership_validator' |
18 | 16 | end |
19 | 17 |
|
20 | 18 | module CodeOwnership |
@@ -137,22 +135,22 @@ def backtrace_with_ownership(backtrace) |
137 | 135 | # ./app/controllers/some_controller.rb:43:in `block (3 levels) in create' |
138 | 136 | # |
139 | 137 | backtrace_line = if RUBY_VERSION >= '3.4.0' |
140 | | - %r{\A(#{Pathname.pwd}/|\./)? |
141 | | - (?<file>.+) # Matches 'app/controllers/some_controller.rb' |
142 | | - : |
143 | | - (?<line>\d+) # Matches '43' |
144 | | - :in\s |
145 | | - '(?<function>.*)' # Matches "`block (3 levels) in create'" |
146 | | - \z}x |
147 | | - else |
148 | | - %r{\A(#{Pathname.pwd}/|\./)? |
149 | | - (?<file>.+) # Matches 'app/controllers/some_controller.rb' |
150 | | - : |
151 | | - (?<line>\d+) # Matches '43' |
152 | | - :in\s |
153 | | - `(?<function>.*)' # Matches "`block (3 levels) in create'" |
154 | | - \z}x |
155 | | - end |
| 138 | + %r{\A(#{Pathname.pwd}/|\./)? |
| 139 | + (?<file>.+) # Matches 'app/controllers/some_controller.rb' |
| 140 | + : |
| 141 | + (?<line>\d+) # Matches '43' |
| 142 | + :in\s |
| 143 | + '(?<function>.*)' # Matches "`block (3 levels) in create'" |
| 144 | + \z}x |
| 145 | + else |
| 146 | + %r{\A(#{Pathname.pwd}/|\./)? |
| 147 | + (?<file>.+) # Matches 'app/controllers/some_controller.rb' |
| 148 | + : |
| 149 | + (?<line>\d+) # Matches '43' |
| 150 | + :in\s |
| 151 | + `(?<function>.*)' # Matches "`block (3 levels) in create'" |
| 152 | + \z}x |
| 153 | + end |
156 | 154 |
|
157 | 155 | backtrace.lazy.filter_map do |line| |
158 | 156 | match = line.match(backtrace_line) |
|
0 commit comments