-
-
Notifications
You must be signed in to change notification settings - Fork 398
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
DocstringParser warnings improvements #1488
base: main
Are you sure you want to change the base?
Conversation
…ed params; does warn on duplicate unknown params
e2bf8e5
to
8ae1ea7
Compare
This is incomplete, it should handle argument forwarding with |
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 hope you don't mind some random reviewing your PR. I'm using Yard a lot lately and am invested in helping out.
else | ||
param_tags << tag | ||
end | ||
end |
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.
You can flatten down this if
and improve readability IMO by using .filter_map
to iterate here. Consider:
param_tags = parser.tags.filter_map do |tag|
next unless tag.tag_name == "param"
next tag if !tag.is_a?(Tags::RefTagList) || tag.name
tag.tags unless CodeObjects::Proxy === tag.owner
end
filter_map
is Ruby 2.7+ and I'm not sure about Yard's current minimum Ruby version, so if it's lower you can use map{ ... }.compact
instead.
Several improvements:
The first one was what motivated this work, I wanted to get rid of warnings about delegated params. The rest were changes I made along the way.
Completed Tasks
bundle exec rake
locally (if code is attached to PR).