From 55c4f7f8bedc213f690914a15d2c2813ff29efa5 Mon Sep 17 00:00:00 2001 From: Joel Hawksley Date: Fri, 8 May 2026 11:00:05 -0600 Subject: [PATCH 1/3] Enable yard-lint Documentation/BlankLineBeforeDefinition rule Remove blank line between `# :nocov:` comment and method definition in docs_builder_component.rb. directives in separate comment blocks conflict with the InvalidTagOrder rule. --- .yard-lint.yml | 4 +++- lib/docs/docs_builder_component.rb | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.yard-lint.yml b/.yard-lint.yml index 9578a58c1..f2e0b1cb2 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 diff --git a/lib/docs/docs_builder_component.rb b/lib/docs/docs_builder_component.rb index a3a839049..8fbfc6a36 100644 --- a/lib/docs/docs_builder_component.rb +++ b/lib/docs/docs_builder_component.rb @@ -68,7 +68,6 @@ def deprecation_text @method.tag(:deprecated)&.text end # :nocov: - def docstring_and_deprecation_text <<~DOCS.strip.html_safe #{docstring} From a6d1fa96d54ff939cb838326ceec1e227fe1ba2f Mon Sep 17 00:00:00 2001 From: Joel Hawksley Date: Fri, 8 May 2026 11:03:54 -0600 Subject: [PATCH 2/3] Enable yard-lint Tags/TagGroupSeparator rule MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add blank lines between different YARD tag groups (@param → @return, config.rb, system_test_helpers.rb, and test_helpers.rb. --- .yard-lint.yml | 2 +- lib/view_component/base.rb | 1 + lib/view_component/compiler.rb | 1 + lib/view_component/config.rb | 4 ++++ lib/view_component/system_test_helpers.rb | 1 + lib/view_component/test_helpers.rb | 3 +++ 6 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.yard-lint.yml b/.yard-lint.yml index f2e0b1cb2..0889cdd10 100644 --- a/.yard-lint.yml +++ b/.yard-lint.yml @@ -80,7 +80,7 @@ Tags/NonAsciiType: Enabled: true Tags/TagGroupSeparator: - Enabled: false + Enabled: true Tags/ForbiddenTags: Enabled: true 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`: # From 63fdc5ae5cec107f674805d6056fe4b8f7e50d70 Mon Sep 17 00:00:00 2001 From: Joel Hawksley Date: Fri, 8 May 2026 13:17:57 -0600 Subject: [PATCH 3/3] spacing --- lib/docs/docs_builder_component.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/docs/docs_builder_component.rb b/lib/docs/docs_builder_component.rb index 8fbfc6a36..8c4384a98 100644 --- a/lib/docs/docs_builder_component.rb +++ b/lib/docs/docs_builder_component.rb @@ -67,6 +67,7 @@ def docstring def deprecation_text @method.tag(:deprecated)&.text end + # :nocov: def docstring_and_deprecation_text <<~DOCS.strip.html_safe