diff --git a/CHANGELOG.md b/CHANGELOG.md index 07a5b4ad50e..c22223beff7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -55,6 +55,7 @@ * [#8517](https://github.com/rubocop-hq/rubocop/pull/8517): Make `Style/HashTransformKeys` and `Style/HashTransformValues` aware of `to_h` with block. ([@eugeneius][]) * [#8529](https://github.com/rubocop-hq/rubocop/pull/8529): Mark `Lint/FrozenStringLiteralComment` as `Safe`, but with unsafe auto-correction. ([@marcandre][]) * [#8602](https://github.com/rubocop-hq/rubocop/pull/8602): Fix usage of `to_enum(:scan, regexp)` to work on TruffleRuby. ([@jaimerave][]) +* [#8629](https://github.com/rubocop-hq/rubocop/pull/8629): Fix the cache being reusable in CI by using crc32 to calculate file hashes rather than `mtime`, which changes each CI build. ([@dvandersluis][]) ## 0.89.1 (2020-08-10) diff --git a/lib/rubocop/result_cache.rb b/lib/rubocop/result_cache.rb index 2dda0c8a6fc..ebc8d7ab925 100644 --- a/lib/rubocop/result_cache.rb +++ b/lib/rubocop/result_cache.rb @@ -3,6 +3,7 @@ require 'digest/sha1' require 'find' require 'etc' +require 'zlib' module RuboCop # Provides functionality for caching rubocop runs. @@ -171,7 +172,7 @@ def rubocop_checksum rubocop_extra_features .select { |path| File.file?(path) } .sort! - .each { |path| digest << File.mtime(path).to_s } + .each { |path| digest << Zlib.crc32(IO.read(path)).to_s } digest << RuboCop::Version::STRING << RuboCop::AST::Version::STRING digest.hexdigest end