Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save Korayem/86060ae7642fa246e657380a39e34bdb to your computer and use it in GitHub Desktop.

Select an option

Save Korayem/86060ae7642fa246e657380a39e34bdb to your computer and use it in GitHub Desktop.

Revisions

  1. Salem Korayem revised this gist Jan 10, 2019. 1 changed file with 0 additions and 4 deletions.
    4 changes: 0 additions & 4 deletions migrate_rubocop_style_to_layout.rb
    Original file line number Diff line number Diff line change
    @@ -29,15 +29,13 @@
    IndentationWidth
    IndentHash
    LeadingCommentSpace
    MethodName
    MultilineArrayBraceLayout
    MultilineAssignmentLayout
    MultilineHashBraceLayout
    MultilineMethodCallBraceLayout
    MultilineMethodCallIndentation
    MultilineMethodDefinitionBraceLayout
    MultilineOperationIndentation
    PredicateName
    SpaceAfterComma
    SpaceAroundBlockParameters
    SpaceAroundEqualsInParameterDefault
    @@ -52,8 +50,6 @@
    SpaceInsideParens
    SpaceInsideStringInterpolation
    TrailingBlankLines
    VariableName
    VariableNumber
    ]

    path = '.rubocop.yml'
  2. Salem Korayem revised this gist Jan 10, 2019. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion migrate_rubocop_style_to_layout.rb
    Original file line number Diff line number Diff line change
    @@ -22,7 +22,6 @@
    EndAlignment
    ExtraSpacing
    ExtraSpacing
    FileName
    FirstParameterIndentation
    IndentArray
    IndentAssignment
  3. Salem Korayem revised this gist Jan 10, 2019. 1 changed file with 9 additions and 0 deletions.
    9 changes: 9 additions & 0 deletions migrate_rubocop_style_to_layout.rb
    Original file line number Diff line number Diff line change
    @@ -9,29 +9,36 @@
    AlignArray
    AlignHash
    AlignParameters
    BlockAlignment
    CaseIndentation
    ClosingParenthesisIndentation
    CommentIndentation
    DefEndAlignment
    DotPosition
    EmptyLineBetweenDefs
    EmptyLinesAroundBlockBody
    EmptyLinesAroundClassBody
    EmptyLinesAroundModuleBody
    EndAlignment
    ExtraSpacing
    ExtraSpacing
    FileName
    FirstParameterIndentation
    IndentArray
    IndentAssignment
    IndentationConsistency
    IndentationWidth
    IndentHash
    LeadingCommentSpace
    MethodName
    MultilineArrayBraceLayout
    MultilineAssignmentLayout
    MultilineHashBraceLayout
    MultilineMethodCallBraceLayout
    MultilineMethodCallIndentation
    MultilineMethodDefinitionBraceLayout
    MultilineOperationIndentation
    PredicateName
    SpaceAfterComma
    SpaceAroundBlockParameters
    SpaceAroundEqualsInParameterDefault
    @@ -46,6 +53,8 @@
    SpaceInsideParens
    SpaceInsideStringInterpolation
    TrailingBlankLines
    VariableName
    VariableNumber
    ]

    path = '.rubocop.yml'
  4. Salem Korayem revised this gist Jan 10, 2019. 1 changed file with 49 additions and 38 deletions.
    87 changes: 49 additions & 38 deletions migrate_rubocop_style_to_layout.rb
    Original file line number Diff line number Diff line change
    @@ -1,44 +1,55 @@
    # source: https://gist.github.com/wojtha/f97f45a6a09f14a58e5721fb178f2d3f
    # 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)
    AccessModifierIndentation
    AlignArray
    AlignHash
    AlignParameters
    CaseIndentation
    ClosingParenthesisIndentation
    CommentIndentation
    DotPosition
    EmptyLineBetweenDefs
    EmptyLinesAroundBlockBody
    EmptyLinesAroundClassBody
    EmptyLinesAroundModuleBody
    ExtraSpacing
    FirstParameterIndentation
    IndentArray
    IndentAssignment
    IndentationConsistency
    IndentationWidth
    IndentHash
    LeadingCommentSpace
    MultilineArrayBraceLayout
    MultilineAssignmentLayout
    MultilineHashBraceLayout
    MultilineMethodCallBraceLayout
    MultilineMethodCallIndentation
    MultilineMethodDefinitionBraceLayout
    MultilineOperationIndentation
    SpaceAfterComma
    SpaceAroundBlockParameters
    SpaceAroundEqualsInParameterDefault
    SpaceAroundOperators
    SpaceBeforeBlockBraces
    SpaceBeforeComma
    SpaceBeforeFirstArg
    SpaceInLambdaLiteral
    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)
  5. @wojtha wojtha revised this gist Jun 6, 2017. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions migrate_rubocop_style_to_layout.rb
    Original file line number Diff line number Diff line change
    @@ -37,6 +37,8 @@
    TrailingBlankLines
    ]

    legacy_content = File.read('.rubocop.yml')
    path = '.rubocop.yml'

    legacy_content = File.read(path)
    new_content = legacy_content.gsub(/Style\/(#{ layouts.join('|') })/, 'Layout/\1')
    File.write('.rubocop.yml', new_content)
    File.write(path, new_content)
  6. @wojtha wojtha revised this gist Jun 5, 2017. 1 changed file with 23 additions and 23 deletions.
    46 changes: 23 additions & 23 deletions migrate_rubocop_style_to_layout.rb
    Original file line number Diff line number Diff line change
    @@ -4,37 +4,37 @@
    # .rubocop.yml: Style/DotPosition has the wrong namespace - should be Layout

    layouts = %w[
    IndentationConsistency
    IndentationWidth
    DotPosition
    AccessModifierIndentation
    AlignArray
    AlignHash
    AlignParameters
    ClosingParenthesisIndentation
    CommentIndentation
    DotPosition
    EmptyLineBetweenDefs
    EmptyLinesAroundBlockBody
    EmptyLinesAroundClassBody
    EmptyLinesAroundModuleBody
    ExtraSpacing
    FirstParameterIndentation
    IndentArray
    IndentationConsistency
    IndentationWidth
    IndentHash
    LeadingCommentSpace
    MultilineMethodCallIndentation
    MultilineOperationIndentation
    SpaceAroundOperators
    SpaceAfterComma
    SpaceAroundEqualsInParameterDefault
    SpaceInsideHashLiteralBraces
    SpaceInsideBlockBraces
    TrailingBlankLines
    ExtraSpacing
    SpaceAroundOperators
    SpaceBeforeBlockBraces
    SpaceBeforeComma
    SpaceInsideBlockBraces
    SpaceInsideBrackets
    SpaceInsideHashLiteralBraces
    SpaceInsideParens
    SpaceInsideStringInterpolation
    SpaceBeforeBlockBraces
    SpaceInsideBrackets
    SpaceAfterComma
    LeadingCommentSpace
    MultilineMethodCallIndentation
    EmptyLinesAroundClassBody
    EmptyLinesAroundModuleBody
    EmptyLineBetweenDefs
    EmptyLinesAroundBlockBody
    FirstParameterIndentation
    AlignParameters
    AlignArray
    AlignHash
    ClosingParenthesisIndentation
    CommentIndentation
    TrailingBlankLines
    ]

    legacy_content = File.read('.rubocop.yml')
  7. @wojtha wojtha created this gist Jun 5, 2017.
    42 changes: 42 additions & 0 deletions migrate_rubocop_style_to_layout.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,42 @@
    # 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[
    IndentationConsistency
    IndentationWidth
    DotPosition
    AccessModifierIndentation
    IndentArray
    IndentHash
    MultilineOperationIndentation
    SpaceAroundOperators
    SpaceAroundEqualsInParameterDefault
    SpaceInsideHashLiteralBraces
    SpaceInsideBlockBraces
    TrailingBlankLines
    ExtraSpacing
    SpaceBeforeComma
    SpaceInsideParens
    SpaceInsideStringInterpolation
    SpaceBeforeBlockBraces
    SpaceInsideBrackets
    SpaceAfterComma
    LeadingCommentSpace
    MultilineMethodCallIndentation
    EmptyLinesAroundClassBody
    EmptyLinesAroundModuleBody
    EmptyLineBetweenDefs
    EmptyLinesAroundBlockBody
    FirstParameterIndentation
    AlignParameters
    AlignArray
    AlignHash
    ClosingParenthesisIndentation
    CommentIndentation
    ]

    legacy_content = File.read('.rubocop.yml')
    new_content = legacy_content.gsub(/Style\/(#{ layouts.join('|') })/, 'Layout/\1')
    File.write('.rubocop.yml', new_content)