diff options
author | Sean McGivern <sean@gitlab.com> | 2018-10-23 15:27:25 +0100 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2018-10-23 15:45:05 +0100 |
commit | 0e616d71fb5a7a13da40767e0b48d3b4ca7b5a43 (patch) | |
tree | cd4f515b7e3b6b20c9c815201bc3a6cd86699582 /danger/specs | |
parent | a84469a34596d0f3588f7ae16646489441241bc6 (diff) | |
download | gitlab-ce-0e616d71fb5a7a13da40767e0b48d3b4ca7b5a43.tar.gz |
Also count specs in new files in Danger checkconsider-added-specs-in-danger-checks
We have a Danger check that warns if you made changes in app/ but not in
spec/. However, this only checked for changed files - not new files. If
you added an app file with no specs, it wouldn't warn; and it would warn
erroneously if you added a missing spec file while changing a file in
app/.
Diffstat (limited to 'danger/specs')
-rw-r--r-- | danger/specs/Dangerfile | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/danger/specs/Dangerfile b/danger/specs/Dangerfile index 97188df8785..a526bb8adaa 100644 --- a/danger/specs/Dangerfile +++ b/danger/specs/Dangerfile @@ -1,3 +1,5 @@ +# frozen_string_literal: true + NO_SPECS_LABELS = %w[backstage Documentation QA].freeze NO_NEW_SPEC_MESSAGE = <<~MSG.freeze You've made some app changes, but didn't add any tests. @@ -9,8 +11,8 @@ def presented_no_changelog_labels NO_SPECS_LABELS.map { |label| "~#{label}" }.join(', ') end -has_app_changes = !git.modified_files.grep(%r{\A(ee/)?(app|lib|db/(geo/)?(post_)?migrate)/}).empty? -has_spec_changes = !git.modified_files.grep(%r{\A(ee/)?spec/}).empty? +has_app_changes = !helper.all_changed_files.grep(%r{\A(ee/)?(app|lib|db/(geo/)?(post_)?migrate)/}).empty? +has_spec_changes = !helper.all_changed_files.grep(%r{\A(ee/)?spec/}).empty? new_specs_needed = (gitlab.mr_labels & NO_SPECS_LABELS).empty? if has_app_changes && !has_spec_changes && new_specs_needed |