Skip to content

Conversation

@cocoahero
Copy link

Hopefully a straight-forward proposal to enable Lint/EmptyBlock, in an effort to prevent situations like this:

field :my_graphql_field, :string, null: true do |f|
  # something was here but removed by rudimentary automation
end

cocoahero and others added 2 commits December 1, 2025 10:26
This automated commit dumps the contents of the full RuboCop config.

[dependabot skip]
@cocoahero cocoahero requested a review from a team as a code owner December 1, 2025 15:33
@github-actions github-actions bot added the config change Changes the Rubocop config by enabling, disabling, or reconfiguring one or many cops label Dec 1, 2025
Copy link
Contributor

@sambostock sambostock left a comment

Choose a reason for hiding this comment

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

Ironically, your example in the PR description would be allowed, because it contains a comment (but I think that is what we want, for cases where for some reason passing an empty block is required).

@rafaelfranca
Copy link
Member

I'm pretty sure I didn't enable this because of legit reasons. I need to run against our codebase to check.

Copy link
Member

@rafaelfranca rafaelfranca left a comment

Choose a reason for hiding this comment

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

As I suspected, there are method that are today expected to use empty blocks, so we can't enable this rule.

One example is the on_mutation in graphql-easy-testing. You not always want to provide a block, but the library requires a block to be passed. So while we don't fix those requirement for empty blocks, being they legit or not, we can't enable this rule.

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

Labels

config change Changes the Rubocop config by enabling, disabling, or reconfiguring one or many cops

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants