Skip to content

rubocop: add RuboCop::Options#parse signature - #1099

Merged
github-actions[bot] merged 1 commit into
ruby:mainfrom
apiology:rubocop-options-parse
Oct 20, 2026
Merged

github-actions[bot] merged 1 commit into
ruby:mainfrom
apiology:rubocop-options-parse

Conversation

@apiology

Copy link
Copy Markdown
Contributor

Claude: With this change, options, paths = RuboCop::Options.new.parse(args) type-checks with options as Hash[Symbol, untyped] and paths as Array[String]. Before it, the rubocop 1.57 RBS had no RuboCop::Options, so the result was untyped. Solargraph uses this call to run RuboCop in-process: it destructures the result and reads and writes options[:stdin].

In lib/rubocop/options.rb, both v1.57.0 and master return [@options, args] from parse. @options is a Symbol-keyed hash whose value types depend on the option; for example, parse replaces :stdin with the file contents. So the values are untyped. Options#initialize takes no arguments, so it needs no signature. RuboCop marks Options as @api private, but tools that embed RuboCop call it.

The test destructures the result, assigns options[:stdin], calls options.key? and uses paths.first. bin/test gems/rubocop/1.57 passes: no type errors and no untyped calls.

🤖 Generated with Claude Code

Callers that run RuboCop in-process, such as Solargraph, call
RuboCop::Options.new.parse(args) and destructure the result into an
options hash and a path list. Without a signature the result is
untyped. Options#parse returns [@options, args], where @options is a
Symbol-keyed hash whose values vary by option.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GgkyXKEZWpEFXo6ceA5MSw
apiology added a commit to apiology/solargraph that referenced this pull request Oct 15, 2026
The rubocop 1.57 RBS in gem_rbs_collection has no RuboCop::Options, so
parse's result was untyped and options[:stdin] was an unresolved
call. Add an RBS fill citing ruby/gem_rbs_collection#1099, which adds
the same signature upstream, and drop the three markers it clears.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GgkyXKEZWpEFXo6ceA5MSw
@apiology
apiology marked this pull request as ready for review October 19, 2026 20:02
@github-actions

Copy link
Copy Markdown

@apiology Thanks for your contribution!

Please follow the instructions below for each change.
See also: https://github.com/ruby/gem_rbs_collection/blob/main/docs/CONTRIBUTING.md

Available commands

You can use the following commands by commenting on this PR.

  • /merge: Merge this PR if CI passes

rubocop

You changed RBS files for an existing gem.
You need to get approval from the reviewers of this gem.

@kozy4324, please review this pull request.
If this change is acceptable, please make a review comment including APPROVE from here.
Screen Shot 2024-03-19 at 14 13 36

After that, the PR author or the reviewers can merge this PR.
Just comment /merge to merge this PR.

@kozy4324 kozy4324 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

APPROVE

@github-actions

Copy link
Copy Markdown

Thanks for your review, @kozy4324!

@apiology, @kozy4324 This PR is ready to be merged.
Just comment /merge to merge this PR.

@apiology

Copy link
Copy Markdown
Contributor Author

/merge

@github-actions
github-actions Bot merged commit 979bfa4 into ruby:main Oct 20, 2026
8 checks passed
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.

2 participants