Rubocop inconsistent results

Rubocop fails on travis but passes locally.

I’m using ubuntu 16.04 xenial, ruby 2.4.4, and rubocop 0.57.2 both locally and on travis. Rubocop passes locally but fails on travis. The only environment difference I can think of is that I’m using rbenv while travis uses rvm, but I don’t think that should affect this.

The error I’m getting is Style/MutableConstant: Freeze mutable objects assigned to constants.
I have a magic comment # frozen_string_literal: true at the top of my files, which should ensure I don’t have this error.

My .travis.yml looks like this:

os: linux
dist: xenial
language: ruby
sudo: false
cache: bundler
rvm:
  - 2.2.0
  - 2.3.0
  - 2.4.0
  - 2.5.0
env:
  - CI=true
install:
  - bundle install
before_script:
  - bundle exec rake db:test:prepare
script:
  - bundle exec rspec
matrix:
  # finish build even if rubocop is still running
  fast_finish: true
  include:
    - rvm: 2.4.4
      gemfile: Gemfile.lint
      script:
        - bundle info rubocop
        - bundle exec rubocop
  # allow rubocop to fail
  allow_failures:
    - rvm: 2.4.4

Has anyone come across something like this before?

Do the builds fail if you restart them? Also, please include build log URLs.

Yeah I get the same problem if I restart the build.

https://travis-ci.org/ConorSheehan1/ld_cheat/jobs/470130939