diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-01 06:09:45 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-01 06:09:45 +0000 |
commit | 533ef6532ae5499b8ff2f886cbc677844c7b82e1 (patch) | |
tree | 26fdc7ca683c23bc2bc940b23fc3f11ded05fcae /danger | |
parent | 7658b09b49ce4abfc402682d446ce263017f3a57 (diff) | |
download | gitlab-ce-533ef6532ae5499b8ff2f886cbc677844c7b82e1.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'danger')
-rw-r--r-- | danger/plugins/specs.rb | 10 | ||||
-rw-r--r-- | danger/specs/Dangerfile | 15 |
2 files changed, 20 insertions, 5 deletions
diff --git a/danger/plugins/specs.rb b/danger/plugins/specs.rb new file mode 100644 index 00000000000..3188785487e --- /dev/null +++ b/danger/plugins/specs.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +require_relative '../../tooling/danger/specs' + +module Danger + class Specs < ::Danger::Plugin + # Put the helper code somewhere it can be tested + include Tooling::Danger::Specs + end +end diff --git a/danger/specs/Dangerfile b/danger/specs/Dangerfile index 35476ae645d..7cc68407170 100644 --- a/danger/specs/Dangerfile +++ b/danger/specs/Dangerfile @@ -32,11 +32,12 @@ request specs (and/or feature specs). Please add request specs under See https://gitlab.com/groups/gitlab-org/-/epics/5076 for information. MSG -has_app_changes = helper.all_changed_files.grep(%r{\A(app|lib|db/(geo/)?(post_)?migrate)/}).any? -has_ee_app_changes = helper.all_changed_files.grep(%r{\Aee/(app|lib|db/(geo/)?(post_)?migrate)/}).any? -spec_changes = helper.all_changed_files.grep(%r{\Aspec/}) +all_changed_files = helper.all_changed_files +has_app_changes = all_changed_files.grep(%r{\A(app|lib|db/(geo/)?(post_)?migrate)/}).any? +has_ee_app_changes = all_changed_files.grep(%r{\Aee/(app|lib|db/(geo/)?(post_)?migrate)/}).any? +spec_changes = specs.changed_specs_files(ee: :exclude) has_spec_changes = spec_changes.any? -has_ee_spec_changes = helper.all_changed_files.grep(%r{\Aee/spec/}).any? +has_ee_spec_changes = specs.changed_specs_files(ee: :only).any? new_specs_needed = (gitlab.mr_labels & NO_SPECS_LABELS).empty? if (has_app_changes || has_ee_app_changes) && !(has_spec_changes || has_ee_spec_changes) && new_specs_needed @@ -49,6 +50,10 @@ if has_ee_app_changes && has_spec_changes && !(has_app_changes || has_ee_spec_ch end # Forbidding a new file addition under `/spec/controllers` or `/ee/spec/controllers` -if git.added_files.grep(%r{^(ee/)?spec/controllers/}).any? +if project_helper.changes.added.files.grep(%r{^(ee/)?spec/controllers/}).any? warn CONTROLLER_SPEC_DEPRECATION_MESSAGE end + +specs.changed_specs_files.each do |filename| + specs.add_suggestions_for_match_with_array(filename) +end |