File: Dangerfile

package info (click to toggle)
gitlab 17.6.5-19
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 629,368 kB
  • sloc: ruby: 1,915,304; javascript: 557,307; sql: 60,639; xml: 6,509; sh: 4,567; makefile: 1,239; python: 406
file content (22 lines) | stat: -rw-r--r-- 735 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# 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/') &&
      !has_matching_story?(file)
  end
end

vue_shared_candidates = get_vue_shared_files(helper.all_changed_files)

return if vue_shared_candidates.empty?

documentation_url = 'https://docs.gitlab.com/ce/development/fe_guide/storybook'
file_list = "- #{vue_shared_candidates.map { |path| "`#{path}`" }.join("\n- ")}"

warn "This merge request changed undocumented Vue components in `vue_shared/`. Please consider [creating Stories](#{documentation_url}) for these components:\n#{file_list}"