Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calculate rubocop_checksum by caculating a crc32 for each file rather than using mtime #8633

Merged
merged 1 commit into from Sep 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -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)

Expand Down
3 changes: 2 additions & 1 deletion lib/rubocop/result_cache.rb
Expand Up @@ -3,6 +3,7 @@
require 'digest/sha1'
require 'find'
require 'etc'
require 'zlib'

module RuboCop
# Provides functionality for caching rubocop runs.
Expand Down Expand Up @@ -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
Expand Down