Skip to content

Fix usage documentation for Inheriting all rules and cops #136

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
Dec 6, 2022

Conversation

codeminator
Copy link
Contributor

This PR just updating the documentation for Inheriting all rules and cops

background

According to the current documentation, I need to do the following to bring all of the rules

# .rubocop.yml
inherit_from:
  rubocop-github:
    - config/default.yml # generic Ruby rules and cops
    - config/rails.yml # Rails-specific rules and cops

When I tried to add these lines at .rubocop.yml, I got the following error:

➜   git:(add-github-rubocop) ✗ bundle exec rubocop
no implicit conversion of Array into String
/Users/codeminator/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-1.39.0/lib/rubocop/config_loader_resolver.rb:239:in `match?'
/Users/codeminator/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-1.39.0/lib/rubocop/config_loader_resolver.rb:239:in `remote_file?'
/Users/codeminator/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-1.39.0/lib/rubocop/config_loader_resolver.rb:217:in `inherited_file'
/Users/codeminator/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-1.39.0/lib/rubocop/config_loader_resolver.rb:210:in `block in base_configs'
...
...

But when I tried the changed code introduced at this PR, it works fine.

@codeminator codeminator requested a review from a team as a code owner December 5, 2022 12:06
Copy link
Member

@issyl0 issyl0 left a comment

Choose a reason for hiding this comment

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

Thanks! https://docs.rubocop.org/rubocop/configuration.html#inheriting-configuration-from-a-remote-url explains the difference between inherit_from and inherit_gem. We do need inherit_gem in this usage example.

@bensheldon bensheldon merged commit 030479a into github:main Dec 6, 2022
@bensheldon
Copy link
Contributor

Thank you!! 💖

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.

3 participants