Skip to content

Commit

Permalink
Break cache if Gemfile.lock or .rubocop.yml change.
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuapinter committed Aug 25, 2023
1 parent 38a143d commit 9403ca0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/erb_lint/cache.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 9403ca0

Please sign in to comment.