lib/code_ownership/private.rb in code_ownership-1.32.7 vs lib/code_ownership/private.rb in code_ownership-1.32.8
- old
+ new
@@ -42,10 +42,12 @@
@glob_cache = nil
end
sig { params(files: T::Array[String], autocorrect: T::Boolean, stage_changes: T::Boolean).void }
def self.validate!(files:, autocorrect: true, stage_changes: true)
+ CodeownersFile.update_cache!(files) if CodeownersFile.use_codeowners_cache?
+
errors = Validator.all.flat_map do |validator|
validator.validation_errors(
files: files,
autocorrect: autocorrect,
stage_changes: stage_changes
@@ -90,10 +92,16 @@
end
sig { returns(GlobCache) }
def self.glob_cache
@glob_cache ||= T.let(@glob_cache, T.nilable(GlobCache))
- @glob_cache ||= Mapper.to_glob_cache
+ @glob_cache ||= begin
+ if CodeownersFile.use_codeowners_cache?
+ CodeownersFile.to_glob_cache
+ else
+ Mapper.to_glob_cache
+ end
+ end
end
end
private_constant :Private
end