Added Rubocop config for background migrations
This adds a Rubocop configuration file specific to lib/gitlab/background_migrations. This configuration will be used to (hopefully) make reviewing background migrations easier by enforcing stricter rules compared to the rest of GitLab. Because this configuration is directory specific it will only affect background migrations.
This commit is contained in:
parent
904a625edd
commit
b3331cf3df
|
@ -0,0 +1,52 @@
|
||||||
|
# For background migrations we define a custom set of rules to make it less
|
||||||
|
# difficult to review these migrations. To reduce the complexity of these
|
||||||
|
# migrations some rules may be stricter than the defaults set in the root
|
||||||
|
# .rubocop.yml file.
|
||||||
|
---
|
||||||
|
inherit_from: ../../../.rubocop.yml
|
||||||
|
|
||||||
|
Metrics/AbcSize:
|
||||||
|
Enabled: true
|
||||||
|
Max: 30
|
||||||
|
Details: >
|
||||||
|
Code that involves a lot of branches can be very hard to wrap your head
|
||||||
|
around.
|
||||||
|
|
||||||
|
Metrics/PerceivedComplexity:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
Metrics/LineLength:
|
||||||
|
Enabled: true
|
||||||
|
Details: >
|
||||||
|
Long lines are very hard to read and make it more difficult to review
|
||||||
|
changes.
|
||||||
|
|
||||||
|
Metrics/MethodLength:
|
||||||
|
Enabled: true
|
||||||
|
Max: 30
|
||||||
|
Details: >
|
||||||
|
Long methods can be very hard to review. Consider splitting this method up
|
||||||
|
into separate methods.
|
||||||
|
|
||||||
|
Metrics/ClassLength:
|
||||||
|
Enabled: true
|
||||||
|
Details: >
|
||||||
|
Long classes can be very hard to review. Consider splitting this class up
|
||||||
|
into multiple classes.
|
||||||
|
|
||||||
|
Metrics/BlockLength:
|
||||||
|
Enabled: true
|
||||||
|
Details: >
|
||||||
|
Long blocks can be hard to read. Consider splitting the code into separate
|
||||||
|
methods.
|
||||||
|
|
||||||
|
Style/Documentation:
|
||||||
|
Enabled: true
|
||||||
|
Details: >
|
||||||
|
Adding documentation makes it easier to figure out what a migration is
|
||||||
|
supposed to do.
|
||||||
|
|
||||||
|
Style/FrozenStringLiteralComment:
|
||||||
|
Enabled: true
|
||||||
|
Details: >-
|
||||||
|
This removes the need for calling "freeze", reducing noise in the code.
|
|
@ -1,3 +1,7 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
# rubocop:disable Metrics/LineLength
|
||||||
|
# rubocop:disable Style/Documentation
|
||||||
|
|
||||||
module Gitlab
|
module Gitlab
|
||||||
module BackgroundMigration
|
module BackgroundMigration
|
||||||
class CreateForkNetworkMembershipsRange
|
class CreateForkNetworkMembershipsRange
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
# rubocop:disable Metrics/LineLength
|
||||||
|
# rubocop:disable Style/Documentation
|
||||||
|
|
||||||
class Gitlab::BackgroundMigration::CreateGpgKeySubkeysFromGpgKeys
|
class Gitlab::BackgroundMigration::CreateGpgKeySubkeysFromGpgKeys
|
||||||
class GpgKey < ActiveRecord::Base
|
class GpgKey < ActiveRecord::Base
|
||||||
self.table_name = 'gpg_keys'
|
self.table_name = 'gpg_keys'
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
# rubocop:disable Metrics/LineLength
|
||||||
|
# rubocop:disable Style/Documentation
|
||||||
|
|
||||||
module Gitlab
|
module Gitlab
|
||||||
module BackgroundMigration
|
module BackgroundMigration
|
||||||
class DeleteConflictingRedirectRoutesRange
|
class DeleteConflictingRedirectRoutesRange
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
# rubocop:disable Metrics/MethodLength
|
||||||
|
# rubocop:disable Metrics/LineLength
|
||||||
|
# rubocop:disable Metrics/AbcSize
|
||||||
|
# rubocop:disable Style/Documentation
|
||||||
|
|
||||||
module Gitlab
|
module Gitlab
|
||||||
module BackgroundMigration
|
module BackgroundMigration
|
||||||
class DeserializeMergeRequestDiffsAndCommits
|
class DeserializeMergeRequestDiffsAndCommits
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
# rubocop:disable Style/Documentation
|
||||||
|
|
||||||
module Gitlab
|
module Gitlab
|
||||||
module BackgroundMigration
|
module BackgroundMigration
|
||||||
class MigrateBuildStageIdReference
|
class MigrateBuildStageIdReference
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
# rubocop:disable Metrics/LineLength
|
||||||
|
# rubocop:disable Style/Documentation
|
||||||
|
|
||||||
module Gitlab
|
module Gitlab
|
||||||
module BackgroundMigration
|
module BackgroundMigration
|
||||||
# Class that migrates events for the new push event payloads setup. All
|
# Class that migrates events for the new push event payloads setup. All
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
# rubocop:disable Metrics/AbcSize
|
||||||
|
# rubocop:disable Style/Documentation
|
||||||
|
|
||||||
module Gitlab
|
module Gitlab
|
||||||
module BackgroundMigration
|
module BackgroundMigration
|
||||||
class MigrateStageStatus
|
class MigrateStageStatus
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
# rubocop:disable Metrics/LineLength
|
||||||
|
# rubocop:disable Style/Documentation
|
||||||
|
|
||||||
module Gitlab
|
module Gitlab
|
||||||
module BackgroundMigration
|
module BackgroundMigration
|
||||||
class MigrateSystemUploadsToNewFolder
|
class MigrateSystemUploadsToNewFolder
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
# rubocop:disable Metrics/LineLength
|
||||||
|
# rubocop:disable Style/Documentation
|
||||||
|
|
||||||
module Gitlab
|
module Gitlab
|
||||||
module BackgroundMigration
|
module BackgroundMigration
|
||||||
class MovePersonalSnippetFiles
|
class MovePersonalSnippetFiles
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
# rubocop:disable Metrics/MethodLength
|
||||||
|
# rubocop:disable Metrics/LineLength
|
||||||
|
# rubocop:disable Metrics/ClassLength
|
||||||
|
# rubocop:disable Metrics/BlockLength
|
||||||
|
# rubocop:disable Style/Documentation
|
||||||
|
|
||||||
module Gitlab
|
module Gitlab
|
||||||
module BackgroundMigration
|
module BackgroundMigration
|
||||||
class NormalizeLdapExternUidsRange
|
class NormalizeLdapExternUidsRange
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
# rubocop:disable Metrics/MethodLength
|
||||||
|
# rubocop:disable Metrics/LineLength
|
||||||
|
# rubocop:disable Style/Documentation
|
||||||
|
|
||||||
module Gitlab
|
module Gitlab
|
||||||
module BackgroundMigration
|
module BackgroundMigration
|
||||||
class PopulateForkNetworksRange
|
class PopulateForkNetworksRange
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
# rubocop:disable Style/Documentation
|
||||||
|
|
||||||
module Gitlab
|
module Gitlab
|
||||||
module BackgroundMigration
|
module BackgroundMigration
|
||||||
class PopulateMergeRequestsLatestMergeRequestDiffId
|
class PopulateMergeRequestsLatestMergeRequestDiffId
|
||||||
|
|
Loading…
Reference in New Issue