Commit c521bc97 authored by Tom Quirk's avatar Tom Quirk

Add vue_shared_documentation Danger plugin

Adds plugin to check vue_shared files without
a Story.
parent 9bd9d506
# frozen_string_literal: true
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'))
end
end
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
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
......@@ -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