Skip to content

ci: Only run RuboCop on changed files

Rémy Coutable requested to merge only-run-rubocop-on-changed-files into master

What does this MR do and why?

This makes the rubocop job only run on changed files, unless on master or if RUN_ALL_RUBOCOP == "true", which is set when any RuboCop config file is touched.

This implements the idea from #370975 (comment 1070335109).

Testing

In !96203 (closed):

  1. When I touched .rubocop.yml, and the rubocop job indeed ran for all files: https://gitlab.com/gitlab-org/gitlab/-/jobs/2930622456
  2. When I touched app/models/user.rb, rubocop only ran for a subset of files: https://gitlab.com/gitlab-org/gitlab/-/jobs/2935400951

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Rémy Coutable

Merge request reports

Loading