Rubocop for migrations are skipped ?
It seems that even though there are lots of cops for migrations (see rubocop/cop/migration/
), they don't seem to be checked by rubocop ie. bundle exec rubocop
The checks only seem to trigger when we specify the files (which is normal behaviour for rubocop, it ignores exclusions if you explicitly pass in files)
For example, based on an MR I'm working on:
tkgl:gitlab tkuah$ be rubocop --only Migration/UpdateColumnInBatches db/migrate/*.rb
Inspecting 823 files
..............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................CCCC.....
Offenses:
db/migrate/20180725004652_null_out_clusters_application_ingress_version.rb:12:5: C: Migration/UpdateColumnInBatches: Migration running update_column_in_batches must have a spec file at spec/migrations/null_out_clusters_application_ingress_version_spec.rb.
update_column_in_batches(:clusters_applications_ingress, :version, nil)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
db/migrate/20180725005445_null_out_clusters_applications_jupyter_version.rb:12:5: C: Migration/UpdateColumnInBatches: Migration running update_column_in_batches must have a spec file at spec/migrations/null_out_clusters_applications_jupyter_version_spec.rb.
update_column_in_batches(:clusters_applications_jupyter, :version, nil)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
db/migrate/20180725010623_null_out_clusters_applications_runners_version.rb:12:5: C: Migration/UpdateColumnInBatches: Migration running update_column_in_batches must have a spec file at spec/migrations/null_out_clusters_applications_runners_version_spec.rb.
update_column_in_batches(:clusters_applications_runners, :version, nil)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
db/migrate/20180725011345_null_out_clusters_applications_prometheus_version.rb:12:5: C: Migration/UpdateColumnInBatches: Migration running update_column_in_batches must have a spec file at spec/migrations/null_out_clusters_applications_prometheus_version_spec.rb.
update_column_in_batches(:clusters_applications_prometheus, :version, nil) do |table, query|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
823 files inspected, 4 offenses detected
Edited by Thong Kuah