class RuboCop::Runner

def file_offense_cache(file)

def file_offense_cache(file)
  config = @config_store.for_file(file)
  cache = cached_result(file, standby_team(config)) if cached_run?
  if cache&.valid?
    offenses = cache.load
    # If we're running --auto-correct and the cache says there are
    # offenses, we need to actually inspect the file. If the cache shows no
    # offenses, we're good.
    real_run_needed = @options[:auto_correct] && offenses.any?
  else
    real_run_needed = true
  end
  if real_run_needed
    offenses = yield
    save_in_cache(cache, offenses)
  end
  offenses
end