Skip running RuboCop if there's no existing changed files

Unexpected behaviour

We're running RuboCop for everything if there's no existing changed files in a merge request, by this command:

bundle exec rubocop --parallel --force-exclusion $(cat tmp/rubocop_target_files.txt)

In .gitlab/ci/static-analysis.gitlab-ci.yml. This is because tmp/rubocop_target_files.txt can be empty.

Expected behaviour

Skip running it because there's nothing interesting. The actual change was only deleting a file, and we don't need to run anything against deleted files.

Background

The following discussion from !101453 (merged) should be addressed:

  • @engwan started a discussion: (+3 comments)

    Hmm.. looks like we have a failing rubocop on master?