Skip to content

Allow star(*) in scalar value of rubocop.yml #864

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

Merged
merged 1 commit into from
May 22, 2025

Conversation

ksss
Copy link
Collaborator

@ksss ksss commented May 21, 2025

Problem

I would like to exclude files that are no longer supported by RuboCop, but star (*) cannot be used in path specifications. (e.g. "gems/activerecord/7.2/**/*.rbs")
Since the target includes many old versions of various Rails-related gems, listing all files individually increases maintenance costs.

Proposal

I propose allowing the use of * in path specifications.
The * character is currently disallowed due to security concerns, as it can be used for YAML aliasing. However, since YAML.safe_load is already in use and does not permit aliases, this particular concern seems to be already addressed.

To further safeguard against unintentionally enabling alias functionality after allowing *, we have also added a guard clause.

Ref

https://github.com/ruby/gem_rbs_collection/actions/runs/15153815288/job/42604695763?pr=863

Run ruby .github/workflows/pr_bot/strict_rubocop_config.rb
.github/workflows/pr_bot/strict_rubocop_config.rb:66:in `validate_rubocop_yml!': Invalid characters in gems/activerecord/.rubocop.yml:7:30. (InvalidCharacters)
    - "gems/activerecord/7.2/**/*.rbs"
                             ^

	from .github/workflows/pr_bot/strict_rubocop_config.rb:9[5](https://github.com/ruby/gem_rbs_collection/actions/runs/15153815288/job/42604695763?pr=863#step:4:6):in `block in <main>'
	from .github/workflows/pr_bot/strict_rubocop_config.rb:[8](https://github.com/ruby/gem_rbs_collection/actions/runs/15153815288/job/42604695763?pr=863#step:4:9)9:in `each'
	from .github/workflows/pr_bot/strict_rubocop_config.rb:89:in `<main>'

@ksss ksss requested a review from pocke as a code owner May 21, 2025 07:23
Copy link

@ksss 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

You changed non-gem files.

@pocke, please review and approve the changes.

Copy link
Member

@pocke pocke left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!

@pocke pocke merged commit 1abdcaf into ruby:main May 22, 2025
7 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