Skip to content

Cop Rails/LexicallyScopedActionFilter conflicts with Lint/UselessMethodDefinition #343

@jafuentest

Description

@jafuentest

This started when I updated rubocop to 0.90.0

When I add before_action callback in a child controller for an action that is defined in the parent controller, example:

class PostsController < ApplicationController
  def update
    logic
  end
end

class StoriesController < PostsController
  before_action :do_something, only: [:update]
end

I get the following recommendation:
Rails/LexicallyScopedActionFilter: update is not explicitly defined on the class.

But if I change StoriesController to

class StoriesController < PostsController
  before_action :do_something, only: [:update]

  def update
    super
  end
end

Then I get Lint/UselessMethodDefinition: Useless method definition detected.

I'm not sure it would be possible to detect that the method is defined in a parent class

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions