Commit f612a60b authored by Tom Quirk's avatar Tom Quirk

Make vue_shared danger message more concise

parent c521bc97
# frozen_string_literal: true
def has_matching_story?(file)
File.file?(file.dup.sub!(/\.vue$/, '.stories.js'))
end
def get_vue_shared_files(files)
files.select do |file|
file.end_with?('.vue') &&
file.include?('vue_shared/') &&
!File.file?(file.dup.sub!(/\.vue$/, '.stories.js'))
!has_matching_story?(file)
end
end
......@@ -12,14 +16,7 @@ vue_shared_candidates = get_vue_shared_files(helper.all_changed_files)
return if vue_shared_candidates.empty?
warn 'This merge request changed undocumented Vue components in `vue_shared/`. Please consider [adding documention](https://docs.gitlab.com/ce/development/fe_guide/storybook).'
if helper.ci?
markdown(<<~MARKDOWN)
## Undocumented Vue components
documentation_url = 'https://docs.gitlab.com/ce/development/fe_guide/storybook'
file_list = "- #{vue_shared_candidates.map { |path| "`#{path}`" }.join("\n- ")}"
The following Vue components don't have associated stories. Please consider [creating them](https://docs.gitlab.com/ce/development/fe_guide/storybook):
* #{vue_shared_candidates.map { |path| "`#{path}`" }.join("\n* ")}
MARKDOWN
end
warn "This merge request changed undocumented Vue components in `vue_shared/`. Please consider [creating Stories](#{documentation_url}) for these components:\n#{file_list}"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment