Skip to content

Commit

Permalink
Fix cache to avoid encoding exception.
Browse files Browse the repository at this point in the history
  • Loading branch information
marcandre committed Sep 10, 2020
1 parent 92d3fc6 commit 02d68db
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -27,6 +27,7 @@
* [#8642](https://github.com/rubocop-hq/rubocop/issues/8642): Fix a false negative for `Style/SpaceInsideHashLiteralBraces` when a correct empty hash precedes the incorrect hash. ([@dvandersluis][])
* [#8683](https://github.com/rubocop-hq/rubocop/issues/8683): Make naming cops work with non-ascii characters. ([@tejasbubane][])
* [#8626](https://github.com/rubocop-hq/rubocop/issues/8626): Fix false negatives for `Lint/UselessMethodDefinition`. ([@marcandre][])
* [#8698](https://github.com/rubocop-hq/rubocop/pull/8698): Fix cache to avoid encoding exception. ([@marcandre][])

### Changes

Expand Down
5 changes: 4 additions & 1 deletion lib/rubocop/result_cache.rb
Expand Up @@ -176,7 +176,10 @@ def rubocop_checksum
rubocop_extra_features
.select { |path| File.file?(path) }
.sort!
.each { |path| digest << Zlib.crc32(IO.read(path)).to_s } # mtime not reliable
.each do |path|
content = File.open(path, 'rb', &:read)
digest << Zlib.crc32(content).to_s # mtime not reliable
end
digest << RuboCop::Version::STRING << RuboCop::AST::Version::STRING
digest.hexdigest
end
Expand Down

0 comments on commit 02d68db

Please sign in to comment.