lib/code_ownership/private.rb in code_ownership-1.36.2 vs lib/code_ownership/private.rb in code_ownership-1.36.3

- old
+ new

@@ -90,11 +90,11 @@ # Another way to accomplish this is # (Dir.glob(configuration.owned_globs) - Dir.glob(configuration.unowned_globs)).include?(file) # However, globbing out can take 5 or more seconds on a large repository, dramatically slowing down # invocations to `bin/codeownership validate --diff`. # Using `File.fnmatch?` is a lot faster! - in_owned_globs = configuration.owned_globs.all? do |owned_glob| + in_owned_globs = configuration.owned_globs.any? do |owned_glob| File.fnmatch?(owned_glob, file, File::FNM_PATHNAME | File::FNM_EXTGLOB) end in_unowned_globs = configuration.unowned_globs.any? do |unowned_glob| File.fnmatch?(unowned_glob, file, File::FNM_PATHNAME | File::FNM_EXTGLOB) @@ -113,16 +113,14 @@ end sig { returns(GlobCache) } def self.glob_cache @glob_cache ||= T.let(@glob_cache, T.nilable(GlobCache)) - @glob_cache ||= begin - if CodeownersFile.use_codeowners_cache? - CodeownersFile.to_glob_cache - else - Mapper.to_glob_cache - end - end + @glob_cache ||= if CodeownersFile.use_codeowners_cache? + CodeownersFile.to_glob_cache + else + Mapper.to_glob_cache + end end end private_constant :Private end