-
-
Notifications
You must be signed in to change notification settings - Fork 399
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle invalid option tag with name only #1481
base: main
Are you sure you want to change the base?
Conversation
I think "gracefully" would require at least a warning for the invalid tags. |
lib/yard/tags/default_factory.rb
Outdated
@@ -73,6 +73,9 @@ def parse_tag_with_title_and_text(tag_name, text) | |||
end | |||
|
|||
def parse_tag_with_types_name_and_default(tag_name, text) | |||
if text.nil? | |||
return nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I would expect to see a warning being generated either here or somewhere in this code path.
- You can
return
instead ofreturn nil
- I would recommend adding a newline of space after the
end
of this block (code style aesthetic)
spec/tags/default_factory_spec.rb
Outdated
@@ -164,5 +164,10 @@ def parse_options(text) | |||
expect(t.pair).to be_instance_of(Tags::DefaultTag) | |||
expect(t.pair.name).to eq "key" | |||
end | |||
|
|||
it "allows name only" do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Realistically this test should be more descriptive-- technically these aren't "allowed".
We have some of these in our codebase: ``` @option :foo ``` Handle them gracefully, even though they are invalid.
b7cb165
to
1d79952
Compare
We have some of these in our codebase:
Handle them gracefully, even though they are invalid.
These were causing errors in VSCode, via Solargraph:
Completed Tasks
bundle exec rake
locally (if code is attached to PR).