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

Tweak Rubocop rules; add more exceptions to the main config #2421

Merged
merged 2 commits into from
Mar 25, 2024

Conversation

dgutov
Copy link
Contributor

@dgutov dgutov commented Mar 25, 2024

@dblock In reply to your comment in #2419:

Usually I rubocop for auto formatting and consistency. You can always rubocop -a ; rubocop --auto-gen-config.

What I ended up doing is calling bundle exec rubocop --regenerate-todo. But I think that's a problem for potential contributors - to understand which rules should be followed, and which can/should just be put into the todo.

CONTRIBUTING says this, after all:

Ruby style is enforced with Rubocop, run bundle exec rubocop and fix any style issues highlighted.

So here's an update to the default config which addresses the 3 main cops which gave me trouble.

Ultimately, it seems like you might prefer to just disable all three instead (and maybe more). But this is a more conservative change.

@grape-bot
Copy link

grape-bot commented Mar 25, 2024

1 Warning
⚠️ Unless you're refactoring existing code or improving documentation, please update CHANGELOG.md.

Here's an example of a CHANGELOG.md entry:

* [#2421](https://github.com/ruby-grape/grape/pull/2421): Tweak rubocop rules; add more exceptions to the main config - [@dgutov](https://github.com/dgutov).

Generated by 🚫 Danger

@dgutov
Copy link
Contributor Author

dgutov commented Mar 25, 2024

BTW, if I call rubocop --auto-gen-config now, it suggests additionally disabling the cops

Lint/ConstantDefinitionInBlock
Lint/EmptyBlock
RSpec/ContextWording
RSpec/LeakyConstantDeclaration
RSpec/NamedSubject

and changing a few other configuration parameters.

@dgutov dgutov changed the title Tweak Rubocop rules; add more exceptions to the mail config Tweak Rubocop rules; add more exceptions to the main config Mar 25, 2024
dgutov added 2 commits March 25, 2024 03:47
The alternative would be to use the more advanced

```yaml
inherit_mode:
  merge:
    - Exclude
```
@dgutov dgutov force-pushed the rubocop_special_cases branch from 9423413 to 03730f1 Compare March 25, 2024 01:47
@dblock dblock merged commit c81131a into ruby-grape:master Mar 25, 2024
39 checks passed
@dblock
Copy link
Member

dblock commented Mar 25, 2024

BTW, if I call rubocop --auto-gen-config now, it suggests additionally disabling the cops

Lint/ConstantDefinitionInBlock
Lint/EmptyBlock
RSpec/ContextWording
RSpec/LeakyConstantDeclaration
RSpec/NamedSubject

and changing a few other configuration parameters.

Will take any improvement you want to make here.

@dgutov dgutov deleted the rubocop_special_cases branch March 25, 2024 23:44
@dgutov
Copy link
Contributor Author

dgutov commented Mar 26, 2024

Will take any improvement you want to make here.

Ok, see #2422.

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