diff options
author | Ash McKenzie <amckenzie@gitlab.com> | 2019-09-06 07:14:30 +0000 |
---|---|---|
committer | Ash McKenzie <amckenzie@gitlab.com> | 2019-09-06 07:14:30 +0000 |
commit | f34e4545ec20953267ee187227116756562c6e8a (patch) | |
tree | 32326de09418e404ac74b2b05398bd5449ba8b6c /danger | |
parent | 351d72cbed57c5b117e6b2239dffabcedbc45046 (diff) | |
download | gitlab-ce-f34e4545ec20953267ee187227116756562c6e8a.tar.gz |
Revert "Merge branch '66596-allow-danger-to-be-run-locally' into 'master'"revert-351d72cb
This reverts merge request !32196
Diffstat (limited to 'danger')
-rw-r--r-- | danger/database/Dangerfile | 18 | ||||
-rw-r--r-- | danger/documentation/Dangerfile | 22 | ||||
-rw-r--r-- | danger/duplicate_yarn_dependencies/Dangerfile | 24 | ||||
-rw-r--r-- | danger/eslint/Dangerfile | 22 | ||||
-rw-r--r-- | danger/frozen_string/Dangerfile | 12 | ||||
-rw-r--r-- | danger/gemfile/Dangerfile | 19 | ||||
-rw-r--r-- | danger/prettier/Dangerfile | 26 |
7 files changed, 55 insertions, 88 deletions
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 %<migrations>s added but %<schema>s wasn't updated. -MSG - -SCHEMA_NOT_UPDATED_MESSAGE_FULL = <<~MSG -**#{SCHEMA_NOT_UPDATED_MESSAGE_SHORT}** +SCHEMA_NOT_UPDATED_MESSAGE = <<~MSG +**New %<migrations>s added but %<schema>s wasn't updated.** Usually, when adding new %<migrations>s, %<schema>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? diff --git a/danger/documentation/Dangerfile b/danger/documentation/Dangerfile index ad64c3a6c60..96c0d9b7478 100644 --- a/danger/documentation/Dangerfile +++ b/danger/documentation/Dangerfile @@ -6,22 +6,20 @@ unless docs_paths_to_review.empty? message 'This merge request adds or changes files that require a review ' \ 'from the Technical Writing team.' - if GitlabDanger.new(helper.gitlab_helper).ci? - markdown(<<~MARKDOWN) - ## Documentation review + markdown(<<~MARKDOWN) +## Documentation review - The following files require a review from a technical writer: +The following files require a review from a technical writer: - * #{docs_paths_to_review.map { |path| "`#{path}`" }.join("\n* ")} +* #{docs_paths_to_review.map { |path| "`#{path}`" }.join("\n* ")} - The review does not need to block merging this merge request. See the: +The review does not need to block merging this merge request. See the: - - [DevOps stages](https://about.gitlab.com/handbook/product/categories/#devops-stages) for the appropriate technical writer for this review. - - [Documentation workflows](https://docs.gitlab.com/ee/development/documentation/workflow.html) for information on when to assign a merge request for review. - MARKDOWN +- [DevOps stages](https://about.gitlab.com/handbook/product/categories/#devops-stages) for the appropriate technical writer for this review. +- [Documentation workflows](https://docs.gitlab.com/ee/development/documentation/workflow.html) for information on when to assign a merge request for review. + MARKDOWN - unless gitlab.mr_labels.include?('Documentation') - warn 'This merge request is missing the ~Documentation label.' - end + unless gitlab.mr_labels.include?('Documentation') + warn 'This merge request is missing the ~Documentation label.' end end diff --git a/danger/duplicate_yarn_dependencies/Dangerfile b/danger/duplicate_yarn_dependencies/Dangerfile index 492b888d00e..25f81ec86a4 100644 --- a/danger/duplicate_yarn_dependencies/Dangerfile +++ b/danger/duplicate_yarn_dependencies/Dangerfile @@ -1,6 +1,6 @@ # frozen_string_literal: true -return unless helper.all_changed_files.include?('yarn.lock') +return unless helper.all_changed_files.include? 'yarn.lock' duplicate = `node_modules/.bin/yarn-deduplicate --list --strategy fewer yarn.lock` .split(/$/) @@ -11,19 +11,17 @@ return if duplicate.empty? warn 'This merge request has introduced duplicated yarn dependencies.' -if GitlabDanger.new(helper.gitlab_helper).ci? - markdown(<<~MARKDOWN) - ## Duplicate yarn dependencies +markdown(<<~MARKDOWN) + ## Duplicate yarn dependencies - The following dependencies should be de-duplicated: + The following dependencies should be de-duplicated: - * #{duplicate.map { |path| "`#{path}`" }.join("\n* ")} + * #{duplicate.map { |path| "`#{path}`" }.join("\n* ")} - Please run the following command and commit the changes to `yarn.lock`: + Please run the following command and commit the changes to `yarn.lock`: - ``` - node_modules/.bin/yarn-deduplicate --strategy fewer yarn.lock \\ - && yarn install - ``` - MARKDOWN -end + ``` + node_modules/.bin/yarn-deduplicate --strategy fewer yarn.lock \\ + && yarn install + ``` +MARKDOWN diff --git a/danger/eslint/Dangerfile b/danger/eslint/Dangerfile index 92830bd7706..4916cacfd7e 100644 --- a/danger/eslint/Dangerfile +++ b/danger/eslint/Dangerfile @@ -13,19 +13,17 @@ return if eslint_candidates.empty? warn 'This merge request changed files with disabled eslint rules. Please consider fixing them.' -if GitlabDanger.new(helper.gitlab_helper).ci? - markdown(<<~MARKDOWN) - ## Disabled eslint rules +markdown(<<~MARKDOWN) + ## Disabled eslint rules - The following files have disabled `eslint` rules. Please consider fixing them: + The following files have disabled `eslint` rules. Please consider fixing them: - * #{eslint_candidates.map { |path| "`#{path}`" }.join("\n* ")} + * #{eslint_candidates.map { |path| "`#{path}`" }.join("\n* ")} - Run the following command for more details + Run the following command for more details - ``` - node_modules/.bin/eslint --report-unused-disable-directives --no-inline-config \\ - #{eslint_candidates.map { |path| " '#{path}'" }.join(" \\\n")} - ``` - MARKDOWN -end + ``` + node_modules/.bin/eslint --report-unused-disable-directives --no-inline-config \\ + #{eslint_candidates.map { |path| " '#{path}'" }.join(" \\\n")} + ``` +MARKDOWN diff --git a/danger/frozen_string/Dangerfile b/danger/frozen_string/Dangerfile index 8d3ac3dee68..b9687ef6b83 100644 --- a/danger/frozen_string/Dangerfile +++ b/danger/frozen_string/Dangerfile @@ -16,13 +16,11 @@ if files_to_fix.any? warn 'This merge request adds files that do not enforce frozen string literal. ' \ 'See https://gitlab.com/gitlab-org/gitlab-ce/issues/47424 for more information.' - if GitlabDanger.new(helper.gitlab_helper).ci? - markdown(<<~MARKDOWN) - ## Enable Frozen String Literal + markdown(<<~MARKDOWN) + ## Enable Frozen String Literal - The following files should have `#{MAGIC_COMMENT}` on the first line: + The following files should have `#{MAGIC_COMMENT}` on the first line: - * #{files_to_fix.map { |path| "`#{path}`" }.join("\n* ")} - MARKDOWN - end + * #{files_to_fix.map { |path| "`#{path}`" }.join("\n* ")} + MARKDOWN end diff --git a/danger/gemfile/Dangerfile b/danger/gemfile/Dangerfile index 07c4c07cfe8..dfe64f79d7b 100644 --- a/danger/gemfile/Dangerfile +++ b/danger/gemfile/Dangerfile @@ -1,9 +1,5 @@ -GEMFILE_LOCK_NOT_UPDATED_MESSAGE_SHORT = <<~MSG.freeze -%<gemfile>s was updated but %<gemfile_lock>s wasn't updated. -MSG - -GEMFILE_LOCK_NOT_UPDATED_MESSAGE_FULL = <<~MSG.freeze -**#{GEMFILE_LOCK_NOT_UPDATED_MESSAGE_SHORT}** +GEMFILE_LOCK_NOT_UPDATED_MESSAGE = <<~MSG.freeze +**%<gemfile>s was updated but %<gemfile_lock>s wasn't updated.** Usually, when %<gemfile>s is updated, you should run ``` @@ -23,14 +19,5 @@ gemfile_modified = git.modified_files.include?("Gemfile") gemfile_lock_modified = git.modified_files.include?("Gemfile.lock") if gemfile_modified && !gemfile_lock_modified - gitlab_danger = GitlabDanger.new(helper.gitlab_helper) - - format_str = gitlab_danger.ci? ? GEMFILE_LOCK_NOT_UPDATED_MESSAGE_FULL : GEMFILE_LOCK_NOT_UPDATED_MESSAGE_SHORT - - message = format(format_str, - gemfile: gitlab_danger.html_link("Gemfile"), - gemfile_lock: gitlab_danger.html_link("Gemfile.lock") - ) - - warn(message) + warn format(GEMFILE_LOCK_NOT_UPDATED_MESSAGE, gemfile: gitlab.html_link("Gemfile"), gemfile_lock: gitlab.html_link("Gemfile.lock")) end diff --git a/danger/prettier/Dangerfile b/danger/prettier/Dangerfile index 0be75db8baa..37c4b78a213 100644 --- a/danger/prettier/Dangerfile +++ b/danger/prettier/Dangerfile @@ -19,23 +19,21 @@ return if unpretty.empty? warn 'This merge request changed frontend files without pretty printing them.' -if GitlabDanger.new(helper.gitlab_helper).ci? - markdown(<<~MARKDOWN) - ## Pretty print Frontend files +markdown(<<~MARKDOWN) + ## Pretty print Frontend files - The following files should have been pretty printed with `prettier`: + The following files should have been pretty printed with `prettier`: - * #{unpretty.map { |path| "`#{path}`" }.join("\n* ")} + * #{unpretty.map { |path| "`#{path}`" }.join("\n* ")} - Please run + Please run - ``` - node_modules/.bin/prettier --write \\ - #{unpretty.map { |path| " '#{path}'" }.join(" \\\n")} - ``` + ``` + node_modules/.bin/prettier --write \\ + #{unpretty.map { |path| " '#{path}'" }.join(" \\\n")} + ``` - Also consider auto-formatting [on-save]. + Also consider auto-formatting [on-save]. - [on-save]: https://docs.gitlab.com/ee/development/new_fe_guide/style/prettier.html - MARKDOWN -end + [on-save]: https://docs.gitlab.com/ee/development/new_fe_guide/style/prettier.html +MARKDOWN |