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

Add autocorrect for style cops #743

Closed
8 tasks done
sferik opened this issue Jan 17, 2014 · 14 comments
Closed
8 tasks done

Add autocorrect for style cops #743

sferik opened this issue Jan 17, 2014 · 14 comments

Comments

@sferik
Copy link
Contributor

sferik commented Jan 17, 2014

Specifically, I noticed the following cops are missing auto-correction:

  • NumericLiterals
  • WordArray
  • AccessModifierIndentation
  • SingleLineMethods
  • EmptyLineBetweenDefs
  • IndentationWidth
  • IndentationConsistency
  • Proc

There may be others but these are the ones that affect me most frequently. I may contribute some of these patches myself but wanted to open an issue to document the defect. Ideally, after running rubocop --auto-correct, the only remaining offenses be things like ClassLength, MethodLength, CyclomaticComplexity, etc., which cannot be programmatically fixed.

@bbatsov
Copy link
Collaborator

bbatsov commented Jan 17, 2014

Indeed we should autocorrections for all of those. Btw, auto-correction for NumericLiterals was recently added in master. I'll convert the items in your ticket to a list so we can cross them off after they're implemented.

@bbatsov
Copy link
Collaborator

bbatsov commented Jan 17, 2014

@jonas054 @yujinakayama Feel free to add more items to the list. I'm fairly sure there are other cops that are missing auto-correct functionality, for which it's possible to implement it. I guess it might be a good idea to have a table in the wiki that keeps track of this (and possibly other cop features).

@jonas054
Copy link
Collaborator

Just off the top of my head, I know that I recently split IndentationWidth into two cops, so I've added IndentationConsistency to the list. Will add more later if I find any.

@jonas054
Copy link
Collaborator

I've added a wiki page. Please make additions, deletions and changes as you see fit. It's just my opinions and guesses; something to get a discussion started.

@bbatsov
Copy link
Collaborator

bbatsov commented Jan 19, 2014

@jonas054 Nice work on the wiki page. I guess we should start by implementing auto-correct where it's easier to do so and move to the tougher cases down the road.

@jonas054
Copy link
Collaborator

I'll do WordArray.

jonas054 added a commit to jonas054/rubocop that referenced this issue Jan 26, 2014
@jonas054
Copy link
Collaborator

I'll do AccessModifierIndentation next.

@jonas054
Copy link
Collaborator

jonas054 commented Feb 4, 2014

I'll do SingleLineMethods next.

@jonas054
Copy link
Collaborator

I'll do IndentationWidth and IndentationConsistency next.

@sferik
Copy link
Contributor Author

sferik commented Aug 16, 2014

I’ve updated this issue with some more candidates for auto-correction.

@jonas054
Copy link
Collaborator

Good! I'll try to tackle some of them. Anyone is of course welcome to help out.

@bbatsov
Copy link
Collaborator

bbatsov commented Aug 16, 2014

By the way, I'm not overly fond of long-lived issues with lots of bullets. Tickets with smaller scope are generally easier to track, discuss and close.

@sferik
Copy link
Contributor Author

sferik commented Aug 16, 2014

Fair enough. I’m happy to close this issue and open new issues for all the unchecked boxes.

@bbatsov
Copy link
Collaborator

bbatsov commented Aug 16, 2014

Great! Let's do this then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants