yard
yard copied to clipboard
rubocop-yard: Add support for multiple & nested Hash keys definition
Description
Follow-up on https://github.com/lsegal/yard/pull/1628 (omit first 2 commits when reviewing)
Adds support for multiple and nested hash keys - example from specs:
"Hash{:key_one, :key_two => String; :key_three => Symbol; :key_four => Hash{:sub_key_one => String}}" => "a Hash with keys made of (a literal value :key_one or a literal value :key_two) and values of (Strings) and keys made of (a literal value :key_three) and values of (Symbols) and keys made of (a literal value :key_four) and values of (a Hash with keys made of (a literal value :sub_key_one) and values of (Strings))",
"Hash{:key_one => String, Number; :key_two => String}" => "a Hash with keys made of (a literal value :key_one) and values of (Strings or Numbers) and keys made of (a literal value :key_two) and values of (Strings)"
NOTE: These changes probably only impact on https://github.com/ksss/rubocop-yard and have no effect elsewhere.
PS. I think this alongside the base PR, will open up a lot of opportunities for better Hash completion/typechecking for solargraph gem.
Completed Tasks
- [x] I have read the Contributing Guide.
- [x] The pull request is complete (implemented / written).
- [x] Git commits have been cleaned up (squash WIP / revert commits).
- [x] I wrote tests and ran
bundle exec rakelocally (if code is attached to PR).
FYI: this change is hard to review with #1628 merged in here.