ruby-grape / grape

An opinionated framework for creating REST-like APIs in Ruby.
http://www.ruby-grape.org
MIT License
9.88k stars 1.22k forks source link

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

Closed dgutov closed 6 months ago

dgutov commented 6 months ago

@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 commented 6 months ago
1 Warning
: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 :no_entry_sign: Danger

dgutov commented 6 months ago

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.

dblock commented 6 months ago

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 commented 6 months ago

Will take any improvement you want to make here.

Ok, see #2422.