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

Lint/UnusedMethodArgument offense ignored with comment body #4850

Closed
garettarrowood opened this issue Oct 9, 2017 · 1 comment
Closed

Lint/UnusedMethodArgument offense ignored with comment body #4850

garettarrowood opened this issue Oct 9, 2017 · 1 comment
Labels

Comments

@garettarrowood
Copy link
Contributor

Expected behavior

I expect to see a Lint/UnusedMethodArgument offense in the following code snippet:

# frozen_string_literal: true

# A Fooy example
class Foo
  def unused_arg(arg)
    # Fooy comment
  end
end

Interestingly, when the method is called on self, the offense is correctly raised.

# frozen_string_literal: true

# A Fooy example
class Foo
  def self.unused_arg(arg)
    # Fooy comment
  end
end

This may be related to #4677 , simply because it deals with the same cop.

Actual behavior

No offense is raised by first example.

Steps to reproduce the problem

Run rubocop on this snippet:

# frozen_string_literal: true

# A Fooy example
class Foo
  def unused_arg(arg)
    # Fooy comment
  end
end

RuboCop version

0.50.0 (using Parser 2.4.0.0, running on ruby 2.3.3 x86_64-darwin15)
@Drenmi
Copy link
Collaborator

Drenmi commented Oct 11, 2017

There's a configuration option, IgnoreEmptyMethods, which defaults to true. If you set this to false, it will report an offense on the method definition.

The disparity between an instance method- and class method definition looks like a bug though.

@Drenmi Drenmi added the bug label Oct 11, 2017
jmks added a commit to jmks/rubocop that referenced this issue Oct 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants