Last active
January 10, 2019 10:37
-
-
Save wojtha/f97f45a6a09f14a58e5721fb178f2d3f to your computer and use it in GitHub Desktop.
Ruby script to migrate Rubocop settings from Style to Layout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Fixes complains such as: | |
# .rubocop.yml: Style/IndentationConsistency has the wrong namespace - should be Layout | |
# .rubocop.yml: Style/IndentationWidth has the wrong namespace - should be Layout | |
# .rubocop.yml: Style/DotPosition has the wrong namespace - should be Layout | |
layouts = %w[ | |
AccessModifierIndentation | |
AlignArray | |
AlignHash | |
AlignParameters | |
ClosingParenthesisIndentation | |
CommentIndentation | |
DotPosition | |
EmptyLineBetweenDefs | |
EmptyLinesAroundBlockBody | |
EmptyLinesAroundClassBody | |
EmptyLinesAroundModuleBody | |
ExtraSpacing | |
FirstParameterIndentation | |
IndentArray | |
IndentationConsistency | |
IndentationWidth | |
IndentHash | |
LeadingCommentSpace | |
MultilineMethodCallIndentation | |
MultilineOperationIndentation | |
SpaceAfterComma | |
SpaceAroundEqualsInParameterDefault | |
SpaceAroundOperators | |
SpaceBeforeBlockBraces | |
SpaceBeforeComma | |
SpaceInsideBlockBraces | |
SpaceInsideBrackets | |
SpaceInsideHashLiteralBraces | |
SpaceInsideParens | |
SpaceInsideStringInterpolation | |
TrailingBlankLines | |
] | |
path = '.rubocop.yml' | |
legacy_content = File.read(path) | |
new_content = legacy_content.gsub(/Style\/(#{ layouts.join('|') })/, 'Layout/\1') | |
File.write(path, new_content) |
Forked with further missing replacement keys
https://gist.github.com/Korayem/86060ae7642fa246e657380a39e34bdb
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
had to add
CaseIndentation
as well