From f34e4545ec20953267ee187227116756562c6e8a Mon Sep 17 00:00:00 2001 From: Ash McKenzie Date: Fri, 6 Sep 2019 07:14:30 +0000 Subject: Revert "Merge branch '66596-allow-danger-to-be-run-locally' into 'master'" This reverts merge request !32196 --- danger/database/Dangerfile | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) (limited to 'danger/database') diff --git a/danger/database/Dangerfile b/danger/database/Dangerfile index 5cdad09db6e..3550cb7eabf 100644 --- a/danger/database/Dangerfile +++ b/danger/database/Dangerfile @@ -1,13 +1,7 @@ # frozen_string_literal: true -gitlab_danger = GitlabDanger.new(helper.gitlab_helper) - -SCHEMA_NOT_UPDATED_MESSAGE_SHORT = <<~MSG -New %s added but %s wasn't updated. -MSG - -SCHEMA_NOT_UPDATED_MESSAGE_FULL = <<~MSG -**#{SCHEMA_NOT_UPDATED_MESSAGE_SHORT}** +SCHEMA_NOT_UPDATED_MESSAGE = <<~MSG +**New %s added but %s wasn't updated.** Usually, when adding new %s, %s should be updated too (unless the migration isn't changing the DB schema @@ -35,18 +29,14 @@ geo_db_schema_updated = !git.modified_files.grep(%r{\Aee/db/geo/schema\.rb}).emp non_geo_migration_created = !git.added_files.grep(%r{\A(db/(post_)?migrate)/}).empty? geo_migration_created = !git.added_files.grep(%r{\Aee/db/geo/(post_)?migrate/}).empty? -format_str = gitlab_danger.ci? ? SCHEMA_NOT_UPDATED_MESSAGE_FULL : SCHEMA_NOT_UPDATED_MESSAGE_SHORT - if non_geo_migration_created && !non_geo_db_schema_updated - warn format(format_str, migrations: 'migrations', schema: gitlab_danger.html_link("db/schema.rb")) + warn format(SCHEMA_NOT_UPDATED_MESSAGE, migrations: 'migrations', schema: gitlab.html_link("db/schema.rb")) end if geo_migration_created && !geo_db_schema_updated - warn format(format_str, migrations: 'Geo migrations', schema: gitlab_danger.html_link("ee/db/geo/schema.rb")) + warn format(SCHEMA_NOT_UPDATED_MESSAGE, migrations: 'Geo migrations', schema: gitlab.html_link("ee/db/geo/schema.rb")) end -return unless gitlab_danger.ci? - db_paths_to_review = helper.changes_by_category[:database] if gitlab.mr_labels.include?('database') || db_paths_to_review.any? -- cgit v1.2.3