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

Cop to check the space before dot #7273

Closed
fidalgo opened this issue Aug 8, 2019 · 3 comments
Closed

Cop to check the space before dot #7273

fidalgo opened this issue Aug 8, 2019 · 3 comments
Labels
feature request good first issue Easy task, suitable for newcomers to the project

Comments

@fidalgo
Copy link

fidalgo commented Aug 8, 2019

This code "a" .class despite of being a valid ruby code, can be improved by removing the space.

I've searched the documentation in order to find something already implementing this, but haven't found nothing, just the style cops for dot position in the method chain.

Input:
"a" .class"
Expected:
"a".class"

@buehmann
Copy link
Contributor

buehmann commented Aug 9, 2019

Weird that something basic like this is not covered already.

The space after the dot seems not to be covered either. Same goes for the other method call operators:

$ cat 7273.rb 
# frozen_string_literal: true

puts 42 . to_s
puts 42 &. to_s
puts 42 :: to_s # rubocop:disable Style/ColonMethodCall
$ rubocop 7273.rb 
Inspecting 1 file
.

1 file inspected, no offenses detected

@bbatsov bbatsov added the good first issue Easy task, suitable for newcomers to the project label Sep 16, 2019
timothyjosefik added a commit to timothyjosefik/rubocop that referenced this issue Oct 8, 2019
This will throw a new offense anytime a space is around a dot call except
when the dot is the first thing on a line.

Note: This only works for dot calls and does not work with &. or ::
@mwolman
Copy link

mwolman commented May 25, 2020

Is someone working on this or can I start with this new cop?

@marcandre
Copy link
Contributor

@mwolman I believe it's already done #7826 but it needs to improved if you want to check it out: #8021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request good first issue Easy task, suitable for newcomers to the project
Projects
None yet
Development

No branches or pull requests

6 participants