def execute
      args = ['rubocop'] + arguments
      todo = target_directory.join('.rubocop_todo.yml')

      replacements = []

      # if adding the .rb extension is enabled, remove the extension again from
      # any output so it matches the actual files names we are linting
      replacements << [/\.erb\.rb/, '.erb'] if rb_extension_enabled

      result = Dir.chdir(target_directory) do
        replacements.unshift([/^#{Regexp.quote(Dir.pwd)}/, current_directory.to_s])
        stdout, stderr, status = Open3.capture3(*args)

        munge_output(stdout, stderr, replacements)

        status.exitstatus
      end

      # copy the todo file back for the case where we've used --auto-gen-config
      FileUtils.cp(todo, current_directory) if todo.exist?

      result
    end
def execute
      args = ['rubocop'] + arguments
      todo = target_directory.join('.rubocop_todo.yml')

      replacements = []

      # if adding the .rb extension is enabled, remove the extension again from
      # any output so it matches the actual files names we are linting
      replacements << [/\.erb\.rb/, '.erb'] if rb_extension_enabled

      result = Dir.chdir(target_directory) do
        replacements.unshift([/^#{Regexp.quote(Dir.pwd)}/, current_directory.to_s])
        stdout, stderr, status = Open3.capture3(*args)

        munge_output(stdout, stderr, replacements)

        status.exitstatus
      end

      # copy the todo file back for the case where we've used --auto-gen-config
      FileUtils.cp(todo, current_directory) if todo.exist?

      result
    end
Executes rubocop, updating filenames in the output if needed.
 @return the exit code of the rubocop process