Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,16 @@ jobs:
bundle exec erb_lint --lint-all
env:
RAILS_VERSION: '~> 8'
yard-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 4.0
bundler-cache: true
- name: YARD Lint
run: bundle exec yard-lint lib/
106 changes: 106 additions & 0 deletions .yard-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# YARD-Lint Configuration
# See https://github.com/mensfeld/yard-lint for documentation

AllValidators:
YardOptions:
- --plugin
- activesupport-concern

Exclude:
- 'vendor/**/*'
- 'spec/**/*'
- 'test/**/*'
- 'performance/**/*'

FailOnSeverity: error

Documentation/UndocumentedObjects:
Enabled: false

Documentation/UndocumentedMethodArguments:
Enabled: false

Documentation/UndocumentedBooleanMethods:
Enabled: true

Documentation/UndocumentedOptions:
Enabled: false

Documentation/MissingReturn:
Enabled: false

Documentation/MarkdownSyntax:
Enabled: true

Documentation/EmptyCommentLine:
Enabled: true

Documentation/BlankLineBeforeDefinition:
Enabled: false

Tags/Order:
Enabled: true

Tags/InvalidTypes:
Enabled: true

Tags/TypeSyntax:
Enabled: true

Tags/MeaninglessTag:
Enabled: true

Tags/CollectionType:
Enabled: true

Tags/TagTypePosition:
Enabled: true

Tags/ApiTags:
Enabled: false

Tags/OptionTags:
Enabled: false

Tags/ExampleSyntax:
Enabled: true

Tags/ExampleStyle:
Enabled: true

Tags/RedundantParamDescription:
Enabled: true

Tags/InformalNotation:
Enabled: true

Tags/NonAsciiType:
Enabled: true

Tags/TagGroupSeparator:
Enabled: false

Tags/ForbiddenTags:
Enabled: true

Warnings/UnknownTag:
Enabled: true
Severity: error

Warnings/UnknownDirective:
Enabled: true

Warnings/InvalidTagFormat:
Enabled: true

Warnings/InvalidDirectiveFormat:
Enabled: true

Warnings/DuplicatedParameterName:
Enabled: true

Warnings/UnknownParameterName:
Enabled: true

Semantic/AbstractMethods:
Enabled: true
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,6 @@ group :development, :test do
gem "turbo-rails"
gem "warning"
gem "yard-activesupport-concern", "< 1"
gem "yard-lint", "~> 1.5"
gem "yard", "< 1"
end
5 changes: 5 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,9 @@ GEM
yard (0.9.43)
yard-activesupport-concern (0.0.1)
yard (>= 0.8)
yard-lint (1.5.1)
yard (~> 0.9)
zeitwerk (~> 2.6)
zeitwerk (2.7.5)

PLATFORMS
Expand Down Expand Up @@ -460,6 +463,7 @@ DEPENDENCIES
warning
yard (< 1)
yard-activesupport-concern (< 1)
yard-lint (~> 1.5)

CHECKSUMS
action_text-trix (2.1.18) sha256=3fdb83f8bff4145d098be283cdd47ac41caf5110bfa6df4695ed7127d7fb3642
Expand Down Expand Up @@ -621,6 +625,7 @@ CHECKSUMS
xpath (3.2.0) sha256=6dfda79d91bb3b949b947ecc5919f042ef2f399b904013eb3ef6d20dd3a4082e
yard (0.9.43) sha256=cf8733a8f0485df2a162927e9b5f182215a61f6d22de096b8f402c726a1c5821
yard-activesupport-concern (0.0.1) sha256=be790cb0efc23e2e87677063598ac8b743586154657bbd9655a7f03ce78390ef
yard-lint (1.5.1) sha256=41d194855b4f54aa957a0337720c6f48e252e4a31d7412c46cc94a12399c0149
zeitwerk (2.7.5) sha256=d8da92128c09ea6ec62c949011b00ed4a20242b255293dd66bf41545398f73dd

RUBY VERSION
Expand Down
4 changes: 4 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ nav_order: 6

## main

* Add `yard-lint` to CI.

*Joel Hawksley*

## 4.8.0

* Add `compile.view_component` ActiveSupport::Notifications event for eager compilation at boot time.
Expand Down
3 changes: 1 addition & 2 deletions lib/view_component/compiler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,8 @@ def compile(raise_errors: false, force: false)
end
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
#
# @param [ActionView::TemplateDetails::Requested] requested_details i.e. locales, formats, variants
def find_templates_for(requested_details)
filtered_templates = @templates.select do |template|
template.details.matches?(requested_details)
Expand Down
1 change: 0 additions & 1 deletion lib/view_component/slot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ def to_s
# end
# end
# end
#
def method_missing(symbol, *args, **kwargs, &block)
@__vc_component_instance.public_send(symbol, *args, **kwargs, &block)
end
Expand Down
17 changes: 8 additions & 9 deletions lib/view_component/test_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,16 @@ def rendered_json
# assert_text("Hello, World!")
# ```
#
# Note: `#rendered_preview` expects a preview to be defined with the same class
# name as the calling test, but with `Test` replaced with `Preview`:
#
# MyComponentTest -> MyComponentPreview etc.
#
# In RSpec, `Preview` is appended to `described_class`.
#
# @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`:
#
# MyComponentTest -> MyComponentPreview etc.
#
# In RSpec, `Preview` is appended to `described_class`.
def render_preview(name, from: __vc_test_helpers_preview_class, params: {})
previews_controller = __vc_test_helpers_build_controller(Rails.application.config.view_component.previews.controller.constantize)

Expand Down Expand Up @@ -125,7 +124,7 @@ def render_in_view_context(...)
# end
# ```
#
# @param variants [Symbol[]] The variants to be set for the provided block.
# @param variants [Array<Symbol>] The variants to be set for the provided block.
def with_variant(*variants)
old_variants = vc_test_controller.view_context.lookup_context.variants

Expand Down Expand Up @@ -162,7 +161,7 @@ def with_controller_class(klass)
# end
# ```
#
# @param formats [Symbol[]] The format(s) to be set for the provided block.
# @param formats [Array<Symbol>] The format(s) to be set for the provided block.
def with_format(*formats)
old_formats = vc_test_controller.view_context.lookup_context.formats

Expand Down
Loading