Skip to content

Migration/UpdateColumnInBatches: Invalidate RuboCop's cache

What does this MR do and why?

If specs change in {,ee/}/spec/migrations/**/*_spec.rb change RuboCop's cache should be invalidated for this cop to avoid flaky results in CI.

See

This MR also refactor specs and resolves all pending RuboCop TODOs. See individual commits for more information.

How to set up and validate locally

bundle exec rubocop --only Migration/UpdateColumnInBatches db/migrate/20230322151605_rerun_remove_invalid_deploy_access_level.rb
.

1 file inspected, no offenses detected

rm spec/migrations/rerun_remove_invalid_deploy_access_level_spec.rb

bundle exec rubocop -C false --only Migration/UpdateColumnInBatches db/migrate/20230322151605_rerun_remove_invalid_deploy_a
ccess_level.rb
Inspecting 1 file
C

Offenses:

db/migrate/20230322151605_rerun_remove_invalid_deploy_access_level.rb:10:5: C: Migration/UpdateColumnInBatches: Migration running update_column_in_batches must have a spec file at spec/migrations/rerun_remove_invalid_deploy_access_level_spec.rb.
    update_column_in_batches(:protected_environment_deploy_access_levels, :access_level, nil) do |table, query|
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
db/migrate/20230322151605_rerun_remove_invalid_deploy_access_level.rb:16:5: C: Migration/UpdateColumnInBatches: Migration running update_column_in_batches must have a spec file at spec/migrations/rerun_remove_invalid_deploy_access_level_spec.rb.
    update_column_in_batches(:protected_environment_deploy_access_levels, :group_id, nil) do |table, query|
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

1 file inspected, 2 offenses detected

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 Peter Leitzen

Merge request reports