summaryrefslogtreecommitdiff
path: root/danger
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-03-16 18:18:33 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-03-16 18:18:33 +0000
commitf64a639bcfa1fc2bc89ca7db268f594306edfd7c (patch)
treea2c3c2ebcc3b45e596949db485d6ed18ffaacfa1 /danger
parentbfbc3e0d6583ea1a91f627528bedc3d65ba4b10f (diff)
downloadgitlab-ce-f64a639bcfa1fc2bc89ca7db268f594306edfd7c.tar.gz
Add latest changes from gitlab-org/gitlab@13-10-stable-eev13.10.0-rc40
Diffstat (limited to 'danger')
-rw-r--r--danger/changelog/Dangerfile16
-rw-r--r--danger/changes_size/Dangerfile4
-rw-r--r--danger/ci_templates/Dangerfile6
-rw-r--r--danger/commit_messages/Dangerfile20
-rw-r--r--danger/database/Dangerfile12
-rw-r--r--danger/documentation/Dangerfile17
-rw-r--r--danger/duplicate_yarn_dependencies/Dangerfile2
-rw-r--r--danger/eslint/Dangerfile2
-rw-r--r--danger/feature_flag/Dangerfile2
-rw-r--r--danger/karma/Dangerfile4
-rw-r--r--danger/metadata/Dangerfile2
-rw-r--r--danger/plugins/changelog.rb2
-rw-r--r--danger/plugins/project_helper.rb (renamed from danger/plugins/helper.rb)8
-rw-r--r--danger/plugins/roulette.rb10
-rw-r--r--danger/plugins/sidekiq_queues.rb2
-rw-r--r--danger/prettier/Dangerfile2
-rw-r--r--danger/product_intelligence/Dangerfile49
-rw-r--r--danger/roulette/Dangerfile8
-rw-r--r--danger/specialization_labels/Dangerfile6
19 files changed, 88 insertions, 86 deletions
diff --git a/danger/changelog/Dangerfile b/danger/changelog/Dangerfile
index c8474157fa5..444303d4b9e 100644
--- a/danger/changelog/Dangerfile
+++ b/danger/changelog/Dangerfile
@@ -17,8 +17,8 @@ def check_changelog_yaml(path)
raw_file = File.read(path)
yaml = YAML.safe_load(raw_file)
- fail "`title` should be set, in #{gitlab.html_link(path)}! #{SEE_DOC}" if yaml["title"].nil?
- fail "`type` should be set, in #{gitlab.html_link(path)}! #{SEE_DOC}" if yaml["type"].nil?
+ fail "`title` should be set, in #{helper.html_link(path)}! #{SEE_DOC}" if yaml["title"].nil?
+ fail "`type` should be set, in #{helper.html_link(path)}! #{SEE_DOC}" if yaml["type"].nil?
return if helper.security_mr?
@@ -30,23 +30,23 @@ def check_changelog_yaml(path)
if mr_line
markdown(format(SUGGEST_MR_COMMENT, mr_iid: gitlab.mr_json["iid"]), file: path, line: mr_line.succ)
else
- message "Consider setting `merge_request` to #{gitlab.mr_json["iid"]} in #{gitlab.html_link(path)}. #{SEE_DOC}"
+ message "Consider setting `merge_request` to #{gitlab.mr_json["iid"]} in #{helper.html_link(path)}. #{SEE_DOC}"
end
elsif yaml["merge_request"] != gitlab.mr_json["iid"] && !cherry_pick_against_stable_branch
fail "Merge request ID was not set to #{gitlab.mr_json["iid"]}! #{SEE_DOC}"
end
rescue Psych::Exception
# YAML could not be parsed, fail the build.
- fail "#{gitlab.html_link(path)} isn't valid YAML! #{SEE_DOC}"
+ fail "#{helper.html_link(path)} isn't valid YAML! #{SEE_DOC}"
rescue StandardError => e
warn "There was a problem trying to check the Changelog. Exception: #{e.class.name} - #{e.message}"
end
def check_changelog_path(path)
- ee_changes = helper.all_ee_changes.dup
+ ee_changes = project_helper.all_ee_changes.dup
ee_changes.delete(path)
- if ee_changes.any? && !changelog.ee_changelog? && !changelog.db_changes?
+ if ee_changes.any? && !changelog.ee_changelog? && !changelog.required?
warn "This MR has a Changelog file outside `ee/`, but code changes in `ee/`. Consider moving the Changelog file into `ee/`."
end
@@ -54,7 +54,7 @@ def check_changelog_path(path)
warn "This MR has a Changelog file in `ee/`, but no code changes in `ee/`. Consider moving the Changelog file outside `ee/`."
end
- if ee_changes.any? && changelog.ee_changelog? && changelog.db_changes?
+ if ee_changes.any? && changelog.ee_changelog? && changelog.required_reasons.include?(:db_changes)
warn "This MR has a Changelog file inside `ee/`, but there are database changes which [requires](https://docs.gitlab.com/ee/development/changelog.html#what-warrants-a-changelog-entry) the Changelog placement to be outside of `ee/`. Consider moving the Changelog file outside `ee/`."
end
end
@@ -69,7 +69,7 @@ if changelog_found
check_changelog_yaml(changelog_found)
check_changelog_path(changelog_found)
elsif changelog.required?
- fail changelog.required_text
+ changelog.required_texts.each { |_, text| fail(text) } # rubocop:disable Lint/UnreachableLoop
elsif changelog.optional?
message changelog.optional_text
end
diff --git a/danger/changes_size/Dangerfile b/danger/changes_size/Dangerfile
index f37632ced33..52e6cb65d04 100644
--- a/danger/changes_size/Dangerfile
+++ b/danger/changes_size/Dangerfile
@@ -13,7 +13,7 @@
# end
if git.lines_of_code > 2_000
- warn "This merge request is definitely too big (more than #{git.lines_of_code} lines changed), please split it into multiple merge requests."
+ warn "This merge request is definitely too big (#{git.lines_of_code} lines changed), please split it into multiple merge requests."
elsif git.lines_of_code > 500
- warn "This merge request is quite big (more than #{git.lines_of_code} lines changed), please consider splitting it into multiple merge requests."
+ warn "This merge request is quite big (#{git.lines_of_code} lines changed), please consider splitting it into multiple merge requests."
end
diff --git a/danger/ci_templates/Dangerfile b/danger/ci_templates/Dangerfile
index 34b4bbff7a5..fcd9080e7d1 100644
--- a/danger/ci_templates/Dangerfile
+++ b/danger/ci_templates/Dangerfile
@@ -1,7 +1,5 @@
# frozen_string_literal: true
-gitlab_danger = GitlabDanger.new(helper.gitlab_helper)
-
TEMPLATE_MESSAGE = <<~MSG
This merge request requires a CI/CD Template review. To make sure these
changes are reviewed, take the following steps:
@@ -17,9 +15,9 @@ TEMPLATE_FILES_MESSAGE = <<~MSG
The following files require a review from the CI/CD Templates maintainers:
MSG
-return unless gitlab_danger.ci?
+return unless helper.ci?
-template_paths_to_review = helper.changes_by_category[:ci_template]
+template_paths_to_review = project_helper.changes_by_category[:ci_template]
if gitlab.mr_labels.include?('ci::templates') || template_paths_to_review.any?
message 'This merge request adds or changes files that require a ' \
diff --git a/danger/commit_messages/Dangerfile b/danger/commit_messages/Dangerfile
index 96a0c08c184..b4a0b6ad8cb 100644
--- a/danger/commit_messages/Dangerfile
+++ b/danger/commit_messages/Dangerfile
@@ -1,7 +1,7 @@
# frozen_string_literal: true
-require_relative File.expand_path('../../tooling/danger/commit_linter', __dir__)
-require_relative File.expand_path('../../tooling/danger/merge_request_linter', __dir__)
+require 'gitlab/dangerfiles/commit_linter'
+require 'gitlab/dangerfiles/merge_request_linter'
COMMIT_MESSAGE_GUIDELINES = "https://docs.gitlab.com/ee/development/contributing/merge_request_workflow.html#commit-messages-guidelines"
MORE_INFO = "For more information, take a look at our [Commit message guidelines](#{COMMIT_MESSAGE_GUIDELINES})."
@@ -18,10 +18,6 @@ This merge request includes more than %<max_commits_count>d commits. Each commit
If this merge request contains commits that do not meet this criteria and/or contains intermediate work, please rebase these commits into a smaller number of commits or split this merge request into multiple smaller merge requests.
MSG
-def gitlab_danger
- @gitlab_danger ||= GitlabDanger.new(helper.gitlab_helper)
-end
-
def fail_commit(commit, message, more_info: true)
self.fail(build_message(commit, message, more_info: more_info))
end
@@ -39,22 +35,22 @@ end
def squash_mr?
# Locally, we assume the MR is set to be squashed so that the user only sees warnings instead of errors.
- gitlab_danger.ci? ? gitlab.mr_json['squash'] : true
+ helper.ci? ? gitlab.mr_json['squash'] : true
end
def wip_mr?
- gitlab_danger.ci? ? gitlab.mr_json['work_in_progress'] : false
+ helper.ci? ? gitlab.mr_json['work_in_progress'] : false
end
def danger_job_link
- gitlab_danger.ci? ? "[#{THE_DANGER_JOB_TEXT}](#{ENV['CI_JOB_URL']})" : THE_DANGER_JOB_TEXT
+ helper.ci? ? "[#{THE_DANGER_JOB_TEXT}](#{ENV['CI_JOB_URL']})" : THE_DANGER_JOB_TEXT
end
# Perform various checks against commits. We're not using
# https://github.com/jonallured/danger-commit_lint because its output is not
# very helpful, and it doesn't offer the means of ignoring merge commits.
def lint_commit(commit)
- linter = Tooling::Danger::CommitLinter.new(commit)
+ linter = Gitlab::Dangerfiles::CommitLinter.new(commit)
# For now we'll ignore merge commits, as getting rid of those is a problem
# separate from enforcing good commit messages.
@@ -93,7 +89,7 @@ end
def lint_mr_title(mr_title)
commit = Struct.new(:message, :sha).new(mr_title)
- Tooling::Danger::MergeRequestLinter.new(commit).lint
+ Gitlab::Dangerfiles::MergeRequestLinter.new(commit).lint
end
def count_non_fixup_commits(commit_linters)
@@ -109,7 +105,7 @@ def lint_commits(commits)
if multi_line_commit_linter && multi_line_commit_linter.failed?
warn_or_fail_commits(multi_line_commit_linter)
commit_linters.delete(multi_line_commit_linter) # Don't show an error (here) and a warning (below)
- elsif gitlab_danger.ci? # We don't have access to the MR title locally
+ elsif helper.ci? # We don't have access to the MR title locally
title_linter = lint_mr_title(gitlab.mr_json['title'])
if title_linter.failed?
warn_or_fail_commits(title_linter)
diff --git a/danger/database/Dangerfile b/danger/database/Dangerfile
index 67a9b53fe3a..af4d6ed513d 100644
--- a/danger/database/Dangerfile
+++ b/danger/database/Dangerfile
@@ -1,7 +1,5 @@
# frozen_string_literal: true
-gitlab_danger = GitlabDanger.new(helper.gitlab_helper)
-
SCHEMA_NOT_UPDATED_MESSAGE_SHORT = "New %<migrations>s added but %<schema>s wasn't updated"
SCHEMA_NOT_UPDATED_MESSAGE_FULL = <<~MSG
@@ -35,20 +33,20 @@ 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
+format_str = helper.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/structure.sql"))
+ warn format(format_str, migrations: 'migrations', schema: helper.html_link("db/structure.sql"))
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(format_str, migrations: 'Geo migrations', schema: helper.html_link("ee/db/geo/schema.rb"))
end
-return unless gitlab_danger.ci?
+return unless helper.ci?
return if gitlab.mr_labels.include?(DATABASE_APPROVED_LABEL)
-db_paths_to_review = helper.changes_by_category[:database]
+db_paths_to_review = project_helper.changes_by_category[:database]
if gitlab.mr_labels.include?('database') || db_paths_to_review.any?
message 'This merge request adds or changes files that require a ' \
diff --git a/danger/documentation/Dangerfile b/danger/documentation/Dangerfile
index 240c374435c..9bf425a5815 100644
--- a/danger/documentation/Dangerfile
+++ b/danger/documentation/Dangerfile
@@ -1,13 +1,7 @@
# frozen_string_literal: true
-def gitlab_danger
- @gitlab_danger ||= GitlabDanger.new(helper.gitlab_helper)
-end
-
def feature_mr?
- return false unless helper.gitlab_helper&.mr_labels
-
- (helper.gitlab_helper.mr_labels & %w[feature::addition feature::enhancement]).any?
+ (helper.mr_labels & %w[feature::addition feature::enhancement]).any?
end
DOCUMENTATION_UPDATE_MISSING = <<~MSG
@@ -15,11 +9,11 @@ DOCUMENTATION_UPDATE_MISSING = <<~MSG
For more information, see:
-- The Handbook page on [throughput implementation](https://about.gitlab.com/handbook/engineering/management/throughput/#implementation).
+- The Handbook page on [merge request types](https://about.gitlab.com/handbook/engineering/metrics/#data-classification).
- The [definition of done](https://docs.gitlab.com/ee/development/contributing/merge_request_workflow.html#definition-of-done) documentation.
MSG
-docs_paths_to_review = helper.changes_by_category[:docs]
+docs_paths_to_review = project_helper.changes_by_category[:docs]
# Documentation should be updated for feature::addition and feature::enhancement
if docs_paths_to_review.empty?
@@ -30,7 +24,7 @@ end
message 'This merge request adds or changes documentation files. A review from the Technical Writing team before you merge is **recommended**. Reviews can happen after you merge.'
-return unless gitlab_danger.ci?
+return unless helper.ci?
markdown(<<~MARKDOWN)
## Documentation review
@@ -41,6 +35,7 @@ markdown(<<~MARKDOWN)
The review does not need to block merging this merge request. See the:
- - [Technical Writers assignments](https://about.gitlab.com/handbook/engineering/technical-writing/#designated-technical-writers) for the appropriate technical writer for this review.
+ - [Metadata for the `*.md` files](https://docs.gitlab.com/ee/development/documentation/#metadata) that you've changed. The first few lines of each `*.md` file identify the stage and group most closely associated with your docs change.
+ - The [Technical Writer assigned](https://about.gitlab.com/handbook/engineering/technical-writing/#designated-technical-writers) for that stage and group.
- [Documentation workflows](https://docs.gitlab.com/ee/development/documentation/workflow.html) for information on when to assign a merge request for review.
MARKDOWN
diff --git a/danger/duplicate_yarn_dependencies/Dangerfile b/danger/duplicate_yarn_dependencies/Dangerfile
index 492b888d00e..7d4294ce959 100644
--- a/danger/duplicate_yarn_dependencies/Dangerfile
+++ b/danger/duplicate_yarn_dependencies/Dangerfile
@@ -11,7 +11,7 @@ return if duplicate.empty?
warn 'This merge request has introduced duplicated yarn dependencies.'
-if GitlabDanger.new(helper.gitlab_helper).ci?
+if helper.ci?
markdown(<<~MARKDOWN)
## Duplicate yarn dependencies
diff --git a/danger/eslint/Dangerfile b/danger/eslint/Dangerfile
index 92830bd7706..6564c83188e 100644
--- a/danger/eslint/Dangerfile
+++ b/danger/eslint/Dangerfile
@@ -13,7 +13,7 @@ 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?
+if helper.ci?
markdown(<<~MARKDOWN)
## Disabled eslint rules
diff --git a/danger/feature_flag/Dangerfile b/danger/feature_flag/Dangerfile
index c90f60640f2..e66ed35c9ab 100644
--- a/danger/feature_flag/Dangerfile
+++ b/danger/feature_flag/Dangerfile
@@ -1,7 +1,7 @@
# frozen_string_literal: true
# rubocop:disable Style/SignalException
-SEE_DOC = "See the [feature flag documentation](https://docs.gitlab.com/ee/development/feature_flags/development.html#feature-flag-definition-and-validation)."
+SEE_DOC = "See the [feature flag documentation](https://docs.gitlab.com/ee/development/feature_flags#feature-flag-definition-and-validation)."
SUGGEST_MR_COMMENT = <<~SUGGEST_COMMENT
```suggestion
diff --git a/danger/karma/Dangerfile b/danger/karma/Dangerfile
index cededff5f15..e05bd86313f 100644
--- a/danger/karma/Dangerfile
+++ b/danger/karma/Dangerfile
@@ -13,7 +13,7 @@ new_karma_files = get_karma_files(git.added_files.to_a)
unless new_karma_files.empty?
- if GitlabDanger.new(helper.gitlab_helper).ci?
+ if helper.ci?
markdown(<<~MARKDOWN)
## New karma spec file
@@ -36,7 +36,7 @@ return if changed_karma_files.empty?
warn 'You have edited karma spec files. Please consider migrating them to jest.'
-if GitlabDanger.new(helper.gitlab_helper).ci?
+if helper.ci?
markdown(<<~MARKDOWN)
## Edited karma files
diff --git a/danger/metadata/Dangerfile b/danger/metadata/Dangerfile
index d74c4f4a5af..a08808f674f 100644
--- a/danger/metadata/Dangerfile
+++ b/danger/metadata/Dangerfile
@@ -20,7 +20,7 @@ if gitlab.mr_body.size < 5
end
if (THROUGHPUT_LABELS & gitlab.mr_labels).empty?
- warn 'Please add a [throughput label](https://about.gitlab.com/handbook/engineering/management/throughput/#implementation) to this merge request.'
+ warn 'Please add a [merge request type](https://about.gitlab.com/handbook/engineering/metrics/#data-classification) to this merge request.'
end
unless gitlab.mr_json["assignee"]
diff --git a/danger/plugins/changelog.rb b/danger/plugins/changelog.rb
index fd2dad5932a..02ff405c410 100644
--- a/danger/plugins/changelog.rb
+++ b/danger/plugins/changelog.rb
@@ -3,7 +3,7 @@
require_relative '../../tooling/danger/changelog'
module Danger
- class Changelog < Plugin
+ class Changelog < ::Danger::Plugin
# Put the helper code somewhere it can be tested
include Tooling::Danger::Changelog
end
diff --git a/danger/plugins/helper.rb b/danger/plugins/project_helper.rb
index 8602868d817..07a9de0894a 100644
--- a/danger/plugins/helper.rb
+++ b/danger/plugins/project_helper.rb
@@ -1,12 +1,12 @@
# frozen_string_literal: true
-require_relative '../../tooling/danger/helper'
+require_relative '../../tooling/danger/project_helper'
module Danger
- # Common helper functions for our danger scripts. See Tooling::Danger::Helper
+ # Common helper functions for our danger scripts. See Tooling::Danger::ProjectHelper
# for more details
- class Helper < Plugin
+ class ProjectHelper < ::Danger::Plugin
# Put the helper code somewhere it can be tested
- include Tooling::Danger::Helper
+ include Tooling::Danger::ProjectHelper
end
end
diff --git a/danger/plugins/roulette.rb b/danger/plugins/roulette.rb
deleted file mode 100644
index 2aa0132852e..00000000000
--- a/danger/plugins/roulette.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# frozen_string_literal: true
-
-require_relative '../../tooling/danger/roulette'
-
-module Danger
- class Roulette < Plugin
- # Put the helper code somewhere it can be tested
- include Tooling::Danger::Roulette
- end
-end
diff --git a/danger/plugins/sidekiq_queues.rb b/danger/plugins/sidekiq_queues.rb
index dd436e5cb2b..d8d55f04e99 100644
--- a/danger/plugins/sidekiq_queues.rb
+++ b/danger/plugins/sidekiq_queues.rb
@@ -3,7 +3,7 @@
require_relative '../../tooling/danger/sidekiq_queues'
module Danger
- class SidekiqQueues < Plugin
+ class SidekiqQueues < ::Danger::Plugin
# Put the helper code somewhere it can be tested
include Tooling::Danger::SidekiqQueues
end
diff --git a/danger/prettier/Dangerfile b/danger/prettier/Dangerfile
index ee27aaf9228..29637986f1d 100644
--- a/danger/prettier/Dangerfile
+++ b/danger/prettier/Dangerfile
@@ -19,7 +19,7 @@ return if unpretty.empty?
warn 'This merge request changed frontend files without pretty printing them.'
-if GitlabDanger.new(helper.gitlab_helper).ci?
+if helper.ci?
markdown(<<~MARKDOWN)
## Pretty print Frontend files
diff --git a/danger/product_intelligence/Dangerfile b/danger/product_intelligence/Dangerfile
index 5fd5b962993..fe77ea5fc52 100644
--- a/danger/product_intelligence/Dangerfile
+++ b/danger/product_intelligence/Dangerfile
@@ -10,15 +10,10 @@ Please check the ~"product intelligence" [guide](https://docs.gitlab.com/ee/deve
MSG
-UPDATE_METRICS_DEFINITIONS_MESSAGE = <<~MSG
- When adding, changing, or updating metrics, please update the [Event dictionary Usage Ping table](https://about.gitlab.com/handbook/product/product-analytics-guide#event-dictionary).
-
-MSG
-
ENGINEERS_GROUP = '@gitlab-org/growth/product-intelligence/engineers'
UPDATE_DICTIONARY_MESSAGE = <<~MSG
- When updating metrics definitions, please update [Metrics Dictionary](https://docs.gitlab.com/ee/development/usage_ping/dictionary.html)
+ When adding, changing, or updating metrics, please update the [Metrics Dictionary](https://docs.gitlab.com/ee/development/usage_ping/dictionary.html)
```shell
bundle exec rake gitlab:usage_data:generate_metrics_dictionary
@@ -42,14 +37,47 @@ tracking_files = [
tracking_changed_files = all_changed_files & tracking_files
usage_data_changed_files = all_changed_files.grep(%r{(usage_data)})
-metrics_changed_files = all_changed_files.grep(%r{((ee/)?config/metrics/.*\.yml)})
dictionary_changed_file = all_changed_files.grep(%r{(doc/development/usage_ping/dictionary.md)})
+metrics_changed_files = all_changed_files.grep(%r{((ee/)?config/metrics/.*\.yml)})
+
+def matching_files?(file, extension:, pattern:)
+ return unless file.end_with?(extension)
+
+ helper.changed_lines(file).grep(pattern).any?
+end
+
+js_patterns = Regexp.union(
+ 'Tracking.event',
+ /\btrack\(/,
+ 'data-track-event'
+)
+
+dictionary_pattern = Regexp.union(
+ 'key_path:',
+ 'description:',
+ 'product_section:',
+ 'product_stage:',
+ 'product_group:',
+ 'status:',
+ 'tier:'
+)
snowplow_changed_files = all_changed_files.select do |file|
- helper.changed_lines(file).grep(%r{Gitlab::Tracking\.event}).any?
+ matching_files?(file, extension: '.rb', pattern: %r{Gitlab::Tracking\.event}) ||
+ matching_files?(file, extension: '.js', pattern: js_patterns) ||
+ matching_files?(file, extension: '.vue', pattern: js_patterns) ||
+ matching_files?(file, extension: '.haml', pattern: %r{data: \{ track})
+end
+
+required_dictionary_update_changed_files = metrics_changed_files.select do |file|
+ matching_files?(file, extension: '.yml', pattern: dictionary_pattern)
end
-matching_changed_files = usage_data_changed_files + tracking_changed_files + metrics_changed_files + dictionary_changed_file + snowplow_changed_files
+matching_changed_files = usage_data_changed_files +
+ tracking_changed_files +
+ metrics_changed_files +
+ dictionary_changed_file +
+ snowplow_changed_files
if matching_changed_files.any?
@@ -60,9 +88,8 @@ if matching_changed_files.any?
end
warn format(CHANGED_FILES_MESSAGE, changed_files: helper.markdown_list(matching_changed_files), engineers_group: mention)
- warn format(UPDATE_METRICS_DEFINITIONS_MESSAGE) if usage_data_changed_files.any?
- fail format(UPDATE_DICTIONARY_MESSAGE) if metrics_changed_files.any? && dictionary_changed_file.empty?
+ fail format(UPDATE_DICTIONARY_MESSAGE) if required_dictionary_update_changed_files.any? && dictionary_changed_file.empty?
labels = ['product intelligence']
labels << 'product intelligence::review pending' unless helper.mr_has_labels?('product intelligence::approved')
diff --git a/danger/roulette/Dangerfile b/danger/roulette/Dangerfile
index 3096ef471dd..b46220d7886 100644
--- a/danger/roulette/Dangerfile
+++ b/danger/roulette/Dangerfile
@@ -35,7 +35,7 @@ UNKNOWN_FILES_MESSAGE = <<MARKDOWN
These files couldn't be categorised, so Danger was unable to suggest a reviewer.
Please consider creating a merge request to
-[add support](https://gitlab.com/gitlab-org/gitlab/blob/master/tooling/danger/helper.rb)
+[add support](https://gitlab.com/gitlab-org/gitlab/blob/master/tooling/danger/project_helper.rb)
for them.
MARKDOWN
@@ -67,7 +67,7 @@ def markdown_row_for_spins(category, spins_array)
"| #{helper.label_for_category(category)} | #{reviewer_note} | #{maintainer_note} |"
end
-changes = helper.changes_by_category
+changes = project_helper.changes_by_category
# Ignore any files that are known but uncategorized. Prompt for any unknown files
changes.delete(:none)
@@ -76,10 +76,10 @@ changes.delete(:docs)
categories = changes.keys - [:unknown]
# Ensure to spin for database reviewer/maintainer when ~database is applied (e.g. to review SQL queries)
-categories << :database if helper.gitlab_helper&.mr_labels&.include?('database') && !categories.include?(:database)
+categories << :database if helper.mr_labels.include?('database') && !categories.include?(:database)
if changes.any?
- project = helper.project_name
+ project = project_helper.project_name
random_roulette_spins = roulette.spin(project, categories, timezone_experiment: false)
diff --git a/danger/specialization_labels/Dangerfile b/danger/specialization_labels/Dangerfile
index ac93eb4c3e1..2261fe23e4e 100644
--- a/danger/specialization_labels/Dangerfile
+++ b/danger/specialization_labels/Dangerfile
@@ -1,8 +1,6 @@
# frozen_string_literal: true
-gitlab_danger = GitlabDanger.new(helper.gitlab_helper)
-
-return unless gitlab_danger.ci?
+return unless helper.ci?
SPECIALIZATIONS = {
database: 'database',
@@ -14,7 +12,7 @@ SPECIALIZATIONS = {
ci_template: 'ci::templates'
}.freeze
-labels_to_add = helper.changes_by_category.each_with_object([]) do |(category, _changes), memo|
+labels_to_add = project_helper.changes_by_category.each_with_object([]) do |(category, _changes), memo|
label = SPECIALIZATIONS[category]
memo << label if label && !gitlab.mr_labels.include?(label)