Commit afee21b1 authored by Albert Salim's avatar Albert Salim

Merge branch 'vue_shared_danger_plugin' into 'master'

Add vue_shared_documentation Danger plugin

See merge request gitlab-org/gitlab!66039
parents 59ba4a51 f612a60b
# 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}"
......@@ -221,7 +221,7 @@ RSpec.describe Tooling::Danger::ProjectHelper do
describe '.local_warning_message' do
it 'returns an informational message with rules that can run' do
expect(described_class.local_warning_message).to eq('==> Only the following Danger rules can be run locally: changelog, database, documentation, duplicate_yarn_dependencies, eslint, gitaly, karma, pajamas, pipeline, prettier, product_intelligence, utility_css')
expect(described_class.local_warning_message).to eq('==> Only the following Danger rules can be run locally: changelog, database, documentation, duplicate_yarn_dependencies, eslint, gitaly, karma, pajamas, pipeline, prettier, product_intelligence, utility_css, vue_shared_documentation')
end
end
......
......@@ -16,6 +16,7 @@ module Tooling
prettier
product_intelligence
utility_css
vue_shared_documentation
].freeze
CI_ONLY_RULES ||= %w[
......
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