From bcca3cd8ebaeb6e9fe2000426b847ece4202d382 Mon Sep 17 00:00:00 2001 From: Joshua Pinter Date: Sun, 8 Jan 2023 13:04:41 -0700 Subject: [PATCH] Break cache if `Gemfile.lock` or `.rubocop.yml` change. --- lib/erb_lint/cache.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/erb_lint/cache.rb b/lib/erb_lint/cache.rb index 7746765..818e1c4 100644 --- a/lib/erb_lint/cache.rb +++ b/lib/erb_lint/cache.rb @@ -9,6 +9,8 @@ def initialize(config, cache_dir = nil) @cache_dir = cache_dir || CACHE_DIRECTORY @hits = [] @new_results = [] + @gemfile_lock = File.read("Gemfile.lock") if File.exist?("Gemfile.lock") + @rubocop_config = File.read(".rubocop.yml") if File.exist?(".rubocop.yml") puts "Cache mode is on" end @@ -76,7 +78,7 @@ def checksum(filename, file_content) mode = File.stat(filename).mode digester.update( - "#{mode}#{config.to_hash}#{ERBLint::VERSION}#{file_content}", + "#{mode}#{config.to_hash}#{ERBLint::VERSION}#{@rubocop_config}#{@gemfile_lock}#{file_content}", ) digester.hexdigest rescue Errno::ENOENT