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

Extend Style/SymbolProc's AllowedMethods #779

Closed
thisismydesign opened this issue Sep 15, 2022 · 0 comments · Fixed by #806
Closed

Extend Style/SymbolProc's AllowedMethods #779

thisismydesign opened this issue Sep 15, 2022 · 0 comments · Fixed by #806

Comments

@thisismydesign
Copy link

Is your feature request related to a problem? Please describe.

Style/SymbolProc's AllowedMethods defaults to [respond_to, define_method] so that you can do

class MyController < ApplicationController
  def create
    respond_to do |format|
      format.json
    end
  end

This could be extended to ActionMailer's.mail method which works similarly:

mail(args) do |format|
  format.mjml
end

Describe the solution you'd like

AllowedMethods defaults to [respond_to, define_method, mail]

koic added a commit to koic/rubocop-rails that referenced this issue Oct 9, 2022
Fixes rubocop#779.

This PR adds `mail` to `AllowedMethods` of `Style/SymbolProc`.
koic added a commit to koic/rubocop-rails that referenced this issue Oct 9, 2022
Fixes rubocop#779.

This PR adds `mail` to `AllowedMethods` of `Style/SymbolProc`.
`define_methods` and `respond_to` inherit from RuboCop core.
@koic koic closed this as completed in #806 Oct 21, 2022
koic added a commit that referenced this issue Oct 21, 2022
…e_symbol_proc

[Fix #779] Add `mail` to `AllowedMethods` of `Style/SymbolProc`
koic added a commit to koic/rubocop that referenced this issue Dec 5, 2022
…/SymbolProc`

The commit below adds `respond_to` to the config, which looks like a Rails method.
rubocop@54ff86e

Ruby has method called `respond_to?`, not `respond_to`.
So `respond_to` is a Rails API and `respond_to?` doesn't take a block argument.

RuboCop core does not depend on Rails, so move the `respond_to` config from
RuboCop core to RuboCop Rails.

I noticed this by rubocop/rubocop-rails#779.

This removed setting was added in RuboCop Rails 2.17. Rails application developers
can get this change in the upgrade.
rubocop/rubocop-rails#806
bbatsov pushed a commit to rubocop/rubocop that referenced this issue Dec 5, 2022
…/SymbolProc`

The commit below adds `respond_to` to the config, which looks like a Rails method.
54ff86e

Ruby has method called `respond_to?`, not `respond_to`.
So `respond_to` is a Rails API and `respond_to?` doesn't take a block argument.

RuboCop core does not depend on Rails, so move the `respond_to` config from
RuboCop core to RuboCop Rails.

I noticed this by rubocop/rubocop-rails#779.

This removed setting was added in RuboCop Rails 2.17. Rails application developers
can get this change in the upgrade.
rubocop/rubocop-rails#806
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 a pull request may close this issue.

1 participant