Skip to content

Conversation

lekemula
Copy link

@lekemula lekemula commented Sep 28, 2025

Description

Follow-up on #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

  • I have read the Contributing Guide.
  • The pull request is complete (implemented / written).
  • Git commits have been cleaned up (squash WIP / revert commits).
  • I wrote tests and ran bundle exec rake locally (if code is attached to PR).

lekemula and others added 3 commits September 13, 2025 19:15
- Add LITERALMATCH regex constant to match symbol (:symbol) and string ('string', "string") literals
- Update TypesExplainer parser to recognize symbol and string literal types
- Format literal values as "a literal value :symbol" for better readability
- Add comprehensive test coverage for LITERALMATCH constant and literal type parsing
- Fixes parsing inconsistency between YARD TypesExplainer and online parser

Resolves lsegal#1627

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
This could be useful for solargraph gem
@lekemula lekemula force-pushed the add-string-symbol-literal-code-objects branch from b0f014c to ddddd34 Compare September 28, 2025 14:55
@lekemula lekemula changed the title Add support for multiple & nested Hash keys definition rubocop-yard: Add support for multiple & nested Hash keys definition Sep 28, 2025
@lekemula lekemula marked this pull request as ready for review September 28, 2025 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant