Skip to content
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

Introduce rubocop-on-rbs #608

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

Introduce rubocop-on-rbs #608

wants to merge 9 commits into from

Conversation

ksss
Copy link
Collaborator

@ksss ksss commented Jun 17, 2024

Introduce rubocop-on-rbs
Implements of #601

As an introduction, we automated the pointing out by rubocop-on-rbs to activesupport.

.rubocop.yml

Root

I have included common settings in the project root .rubocop.yml, but disabled all Cop.

Each gems

I have enabled RBS/Layout and RBS/Lint only in activesupport.
With other gems, rubocop detection does not work depending on the route configuration.
This means that the owner of the gem can optionally set .rubocop.yml to enable the check.

CI

By running RuboCop in CI, automatic feedback can be displayed on PRs. This frees reviewers from pointing out trivial issues and allows them to focus on essential reviews.

Operation check

You can see that RBS/Layout is enabled and RBS/Style is not.

image

When Updating rubocop-on-rbs

When New Cops Are Added via gem Update

New Cops are disabled by default. There is no burden from the gem update. If you want to enable new Cops, you need to do so for each gem.

When the Behavior of Existing Cops Changes

You need to make sure that RuboCop passes for all gems (this is assumed to be a rare case).

When Adding a New gem

Use init_new_gem to add a .rubocop.yml file. If unnecessary, simply delete this file. This file enables most Cops by default.

@ksss ksss marked this pull request as ready for review June 17, 2024 14:01
@ksss ksss requested a review from pocke as a code owner June 17, 2024 14:01
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

activesupport

You changed RBS files for an existing gem.
You can merge this PR yourself because you are a reviewer of this gem.
Just comment /merge to merge this PR.

You can also request a review from other reviewers if you want.


You changed non-gem files.

@pocke, please review and approve the changes.

@pocke
Copy link
Member

pocke commented Jun 24, 2024

Thanks for your pull request.

Decreasing development speed is my main concern when introducing RuboCop. But probably this opt-in approach can reduce the negative impact because RuboCop is enabled only for maintainer who want to use it.

By the way, we can probably update the init_new_gem script to create a boilerplate of .rubocop.yml.

@ksss
Copy link
Collaborator Author

ksss commented Jun 24, 2024

@pocke Good idea. I updated init_new_gem.
And to facilitate the update of rubocop-on-rbs, I have rewritten the settings on a per-cop basis.

@ksss
Copy link
Collaborator Author

ksss commented Jun 28, 2024

@pocke
I also thought about the operation of updating rubocop-on-rbs.
Do you have any concerns?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants