File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11PATH
22 remote: .
33 specs:
4- code_ownership (1.32.12 )
4+ code_ownership (1.32.13 )
55 code_teams (~> 1.0 )
66 packs
77 sorbet-runtime
Original file line number Diff line number Diff line change 11Gem ::Specification . new do |spec |
22 spec . name = 'code_ownership'
3- spec . version = '1.32.12 '
3+ spec . version = '1.32.13 '
44 spec . authors = [ 'Gusto Engineers' ]
55 spec . email = [ 'dev@gusto.com' ]
66 spec . summary = 'A gem to help engineering teams declare ownership of code'
Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ def self.file_tracked?(file)
9292 File . fnmatch? ( owned_glob , file , File ::FNM_PATHNAME | File ::FNM_EXTGLOB )
9393 end
9494
95- in_unowned_globs = configuration . unowned_globs . all ? do |unowned_glob |
95+ in_unowned_globs = configuration . unowned_globs . any ? do |unowned_glob |
9696 File . fnmatch? ( unowned_glob , file , File ::FNM_PATHNAME | File ::FNM_EXTGLOB )
9797 end
9898
Original file line number Diff line number Diff line change 6666 end
6767 end
6868 end
69+
70+ context 'file is unowned' do
71+ before do
72+ write_file ( 'config/teams/bar.yml' , <<~CONTENTS )
73+ name: Bar
74+ CONTENTS
75+
76+ write_configuration
77+
78+ write_file ( 'app/services/autogenerated_code/some_unowned_file.rb' , '' )
79+ end
80+
81+ it 'has no validation errors' do
82+ expect { CodeOwnership . validate! ( files : [ 'app/services/autogenerated_code/some_unowned_file.rb' ] ) } . to raise_error do |e |
83+ expect ( e . message ) . to eq <<~MSG . chomp
84+ Some files are missing ownership:
85+
86+ - app/services/autogenerated_code/some_unowned_file.rb
87+
88+ See https://github.com/rubyatscale/code_ownership#README.md for more details
89+ MSG
90+ end
91+ end
92+
93+ context 'ignored file passed in that is ignored' do
94+ before do
95+ write_configuration ( 'unowned_globs' => [ 'app/services/autogenerated_code/**/**' , 'vendor/bundle/**/**' ] )
96+ end
97+
98+ it 'has no validation errors' do
99+ expect { CodeOwnership . validate! ( files : [ 'app/services/autogenerated_code/some_unowned_file.rb' ] ) } . to_not raise_error
100+ end
101+ end
102+ end
69103 end
70104
71105 # See tests for individual ownership_mappers to understand behavior for each mapper
You can’t perform that action at this time.
0 commit comments