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

Style/MethodName error on camel-cased class method #2285

Closed
matthewd opened this issue Sep 30, 2015 · 4 comments
Closed

Style/MethodName error on camel-cased class method #2285

matthewd opened this issue Sep 30, 2015 · 4 comments

Comments

@matthewd
Copy link

0.34.2 (using Parser 2.2.2.6, running on ruby 2.2.2 x86_64-darwin14)

Style/MethodName doesn't seem to like:

class X
  def self.fooBar
  end
end
@matthewd matthewd changed the title Style/MethodName error Style/MethodName error on camel-cased class method Sep 30, 2015
@bbatsov
Copy link
Collaborator

bbatsov commented Oct 7, 2015

That's the expected behaviour. I'm not sure why do you think this is a problem. Could you elaborate?

@matthewd
Copy link
Author

matthewd commented Oct 7, 2015

Sorry, this was indeed unclear. With autocorrect enabled, it errors:

An error occurred while Style/MethodName cop was inspecting ../x.rb.
undefined method `class_type?' for nil:NilClass

@bbatsov
Copy link
Collaborator

bbatsov commented Oct 7, 2015

Hmm, I can't reproduce this.

@matthewd
Copy link
Author

matthewd commented Oct 7, 2015

Weird. It doesn't seem environment-specific for me... I'm not using any local config, and I just installed rubocop on a random box:

bravo:~% ruby -v
ruby 2.1.2p95 (2014-05-08) [x86_64-linux-gnu]
bravo:~% sudo gem install rubocop
[..]
Successfully installed rubocop-0.34.2
bravo:~% > x.rb <<EOF     
class X
  def self.fooBar
  end
end
EOF
bravo:~% rubocop --only MethodName -a ./x.rb
warning: parser/current is loading parser/ruby21, which recognizes
warning: 2.1.7-compliant syntax, but you are running 2.1.2.
Inspecting 1 file
An error occurred while Style/MethodName cop was inspecting /home/matthew/x.rb.
To see the complete backtrace run rubocop -d.
.

1 file inspected, no offenses detected

1 error occurred:
An error occurred while Style/MethodName cop was inspecting /home/matthew/x.rb.
Errors are usually caused by RuboCop bugs.
Please, report your problems to RuboCop's issue tracker.
Mention the following information in the issue report:
0.34.2 (using Parser 2.3.0.pre.2, running on ruby 2.1.2 x86_64-linux-gnu)
bravo:~%

@bbatsov bbatsov closed this as completed in 29aa10d Oct 8, 2015
bbatsov added a commit that referenced this issue Oct 8, 2015
[Fix #2285] Fix ConfigurableNaming error with singleton methods
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

No branches or pull requests

2 participants