Skip to content

Support more advanced glob matching for CODEOWNERS

Ash McKenzie requested to merge ashmckenzie/codeowners-update into master

What does this MR do and why?

This MR updates the CODEOWNERS parsing logic to support more complex patterns.

Previous app/**/*token* pattern didn't match

flags = ::File::FNM_DOTMATCH | ::File::FNM_PATHNAME | ::File::FNM_EXTGLOB
path = 'app/assets/javascripts/access_tokens/index.js'
pattern = 'app/**/*token*'
::File.fnmatch?(pattern, path, flags)
=> false

New app/**/{*token*/**/*,*token*} pattern does match

flags = ::File::FNM_DOTMATCH | ::File::FNM_PATHNAME | ::File::FNM_EXTGLOB
path = 'app/assets/javascripts/access_tokens/index.js'
pattern = 'app/**/{*token*/**/*,*token*}'
::File.fnmatch?(pattern, path, flags)
=> true

Related: !84141 (merged)

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Ash McKenzie

Merge request reports

Loading