diff --git a/.yard-lint.yml b/.yard-lint.yml index 9578a58c1..0889cdd10 100644 --- a/.yard-lint.yml +++ b/.yard-lint.yml @@ -36,7 +36,9 @@ Documentation/EmptyCommentLine: Enabled: true Documentation/BlankLineBeforeDefinition: - Enabled: false + Enabled: true + Exclude: + - 'lib/view_component/config.rb' Tags/Order: Enabled: true @@ -78,7 +80,7 @@ Tags/NonAsciiType: Enabled: true Tags/TagGroupSeparator: - Enabled: false + Enabled: true Tags/ForbiddenTags: Enabled: true diff --git a/lib/docs/docs_builder_component.rb b/lib/docs/docs_builder_component.rb index a3a839049..8c4384a98 100644 --- a/lib/docs/docs_builder_component.rb +++ b/lib/docs/docs_builder_component.rb @@ -67,8 +67,8 @@ def docstring def deprecation_text @method.tag(:deprecated)&.text end - # :nocov: + # :nocov: def docstring_and_deprecation_text <<~DOCS.strip.html_safe #{docstring} diff --git a/lib/view_component/base.rb b/lib/view_component/base.rb index a4c221e2b..cd206b86d 100644 --- a/lib/view_component/base.rb +++ b/lib/view_component/base.rb @@ -82,6 +82,7 @@ def config # so helpers, etc work as expected. # # @param view_context [ActionView::Base] The original view context. + # # @return [void] def set_original_view_context(view_context) # noop diff --git a/lib/view_component/compiler.rb b/lib/view_component/compiler.rb index 9a4eecd47..1c3e65b2b 100644 --- a/lib/view_component/compiler.rb +++ b/lib/view_component/compiler.rb @@ -58,6 +58,7 @@ def compile(raise_errors: false, force: false) end # @param requested_details [ActionView::TemplateDetails::Requested] i.e. locales, formats, variants + # # @return all matching compiled templates, in priority order based on the requested details from LookupContext def find_templates_for(requested_details) filtered_templates = @templates.select do |template| diff --git a/lib/view_component/config.rb b/lib/view_component/config.rb index 204791b88..0ad336838 100644 --- a/lib/view_component/config.rb +++ b/lib/view_component/config.rb @@ -19,6 +19,7 @@ def defaults end # @!attribute generate + # # @return [ActiveSupport::OrderedOptions] # The subset of configuration options relating to generators. # @@ -95,6 +96,7 @@ def defaults # in `spec/views/components/` rather than the default `spec/components/`. # @!attribute previews + # # @return [ActiveSupport::OrderedOptions] # The subset of configuration options relating to previews. # @@ -124,6 +126,7 @@ def defaults # # @!attribute instrumentation_enabled + # # @return [Boolean] # Whether ActiveSupport notifications are enabled. # Defaults to `false`. @@ -171,6 +174,7 @@ def default_previews_options end # @!attribute current + # # @return [ViewComponent::Config] # Returns the current ViewComponent::Config. This is persisted against this # class so that config options remain accessible before the rest of diff --git a/lib/view_component/system_test_helpers.rb b/lib/view_component/system_test_helpers.rb index c5677e63b..673cf9fd4 100644 --- a/lib/view_component/system_test_helpers.rb +++ b/lib/view_component/system_test_helpers.rb @@ -7,6 +7,7 @@ module SystemTestHelpers # Returns a block that can be used to visit the path of the inline rendered component. # @param fragment [Nokogiri::Fragment] The fragment returned from `render_inline`. # @param layout [String] The (optional) layout to use. + # # @return [Proc] A block that can be used to visit the path of the inline rendered component. def with_rendered_component_path(fragment, layout: false, &block) file = Tempfile.new( diff --git a/lib/view_component/test_helpers.rb b/lib/view_component/test_helpers.rb index dcf8b0619..4825ec5fc 100644 --- a/lib/view_component/test_helpers.rb +++ b/lib/view_component/test_helpers.rb @@ -35,6 +35,7 @@ def assert_component_rendered # ``` # # @param component [ViewComponent::Base, ViewComponent::Collection] The instance of the component to be rendered. + # # @return [Nokogiri::HTML5] def render_inline(component, **args, &block) @page = nil @@ -74,7 +75,9 @@ def rendered_json # @param name [String] The name of the preview to be rendered. # @param from [ViewComponent::Preview] The class of the preview to be rendered. # @param params [Hash] Parameters to be passed to the preview. + # # @return [Nokogiri::HTML5] + # # @note `#rendered_preview` expects a preview to be defined with the same class # name as the calling test, but with `Test` replaced with `Preview`: #