repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/correctors/parentheses_corrector.rb | lib/rubocop/cop/correctors/parentheses_corrector.rb | # frozen_string_literal: true
module RuboCop
module Cop
# This autocorrects parentheses
class ParenthesesCorrector
class << self
include RangeHelp
COMMA_REGEXP = /(?<=\))\s*,/.freeze
def correct(corrector, node)
buffer = node.source_range.source_buffer
corr... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/correctors/percent_literal_corrector.rb | lib/rubocop/cop/correctors/percent_literal_corrector.rb | # frozen_string_literal: true
module RuboCop
module Cop
# This autocorrects percent literals
class PercentLiteralCorrector
include Util
attr_reader :config, :preferred_delimiters
def initialize(config, preferred_delimiters)
@config = config
@preferred_delimiters = preferre... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/correctors/punctuation_corrector.rb | lib/rubocop/cop/correctors/punctuation_corrector.rb | # frozen_string_literal: true
module RuboCop
module Cop
# This autocorrects punctuation
class PunctuationCorrector
class << self
def remove_space(corrector, space_before)
corrector.remove(space_before)
end
def add_space(corrector, token)
corrector.replace(to... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/correctors/unused_arg_corrector.rb | lib/rubocop/cop/correctors/unused_arg_corrector.rb | # frozen_string_literal: true
module RuboCop
module Cop
# This autocorrects unused arguments.
class UnusedArgCorrector
extend RangeHelp
class << self
attr_reader :processed_source
def correct(corrector, processed_source, node)
return if %i[kwarg kwoptarg].include?(node... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/correctors/each_to_for_corrector.rb | lib/rubocop/cop/correctors/each_to_for_corrector.rb | # frozen_string_literal: true
module RuboCop
module Cop
# This class autocorrects `#each` enumeration to `for` iteration.
class EachToForCorrector
extend NodePattern::Macros
CORRECTION_WITH_ARGUMENTS = 'for %<variables>s in %<collection>s do'
CORRECTION_WITHOUT_ARGUMENTS = 'for _ in %<enum... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/correctors/string_literal_corrector.rb | lib/rubocop/cop/correctors/string_literal_corrector.rb | # frozen_string_literal: true
module RuboCop
module Cop
# This autocorrects string literals
class StringLiteralCorrector
extend Util
class << self
def correct(corrector, node, style)
return if node.dstr_type?
str = node.str_content
if style == :single_quote... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/correctors/for_to_each_corrector.rb | lib/rubocop/cop/correctors/for_to_each_corrector.rb | # frozen_string_literal: true
module RuboCop
module Cop
# This class autocorrects `for` iteration to `#each` enumeration.
class ForToEachCorrector
extend NodePattern::Macros
CORRECTION = '%<collection>s%<dot>seach do |%<argument>s|'
def initialize(for_node)
@for_node = for_... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/correctors/line_break_corrector.rb | lib/rubocop/cop/correctors/line_break_corrector.rb | # frozen_string_literal: true
module RuboCop
module Cop
# This class handles autocorrection for code that needs to be moved
# to new lines.
class LineBreakCorrector
extend Alignment
extend TrailingBody
extend Util
class << self
attr_reader :processed_source
def c... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/correctors/if_then_corrector.rb | lib/rubocop/cop/correctors/if_then_corrector.rb | # frozen_string_literal: true
module RuboCop
module Cop
# This class autocorrects `if...then` structures to a multiline `if` statement
class IfThenCorrector
DEFAULT_INDENTATION_WIDTH = 2
def initialize(if_node, indentation: nil)
@if_node = if_node
@indentation = indentation || DE... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/correctors/multiline_literal_brace_corrector.rb | lib/rubocop/cop/correctors/multiline_literal_brace_corrector.rb | # frozen_string_literal: true
module RuboCop
module Cop
# Autocorrection logic for the closing brace of a literal either
# on the same line as the last contained elements, or a new line.
class MultilineLiteralBraceCorrector
include MultilineLiteralBraceLayout
include RangeHelp
def self... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/correctors/lambda_literal_to_method_corrector.rb | lib/rubocop/cop/correctors/lambda_literal_to_method_corrector.rb | # frozen_string_literal: true
module RuboCop
module Cop
# This class autocorrects lambda literal to method notation.
class LambdaLiteralToMethodCorrector
def initialize(block_node)
@block_node = block_node
@method = block_node.send_node
@arguments = block_node.arguments
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/correctors/require_library_corrector.rb | lib/rubocop/cop/correctors/require_library_corrector.rb | # frozen_string_literal: true
module RuboCop
module Cop
# This class ensures a require statement is present for a standard library
# determined by the variable library_name
class RequireLibraryCorrector
extend RangeHelp
class << self
def correct(corrector, node, library_name)
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/correctors/condition_corrector.rb | lib/rubocop/cop/correctors/condition_corrector.rb | # frozen_string_literal: true
module RuboCop
module Cop
# This class does condition autocorrection
class ConditionCorrector
class << self
def correct_negative_condition(corrector, node)
condition = negated_condition(node)
corrector.replace(node.loc.keyword, node.inverse_key... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/utils/format_string.rb | lib/rubocop/cop/utils/format_string.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Utils
# Parses {Kernel#sprintf} format strings.
class FormatString
# Escaping the `#` in `INTERPOLATION` and `TEMPLATE_NAME` is necessary to
# avoid a bug in Ruby 3.2.0
# See: https://bugs.ruby-lang.org/issues/1937... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/end_alignment.rb | lib/rubocop/cop/layout/end_alignment.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks whether the end keywords are aligned properly.
#
# Three modes are supported through the `EnforcedStyleAlignWith`
# configuration parameter:
#
# If it's set to `keyword` (which is the default), the ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/first_hash_element_line_break.rb | lib/rubocop/cop/layout/first_hash_element_line_break.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks for a line break before the first element in a
# multi-line hash.
#
# @example
#
# # bad
# { a: 1,
# b: 2}
#
# # good
# {
# a: 1,
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/leading_empty_lines.rb | lib/rubocop/cop/layout/leading_empty_lines.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks for unnecessary leading blank lines at the beginning
# of a file.
#
# @example
#
# # bad
# # (start of file)
#
# class Foo
# end
#
# # bad
# # (... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/first_method_argument_line_break.rb | lib/rubocop/cop/layout/first_method_argument_line_break.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks for a line break before the first argument in a
# multi-line method call.
#
# @example
#
# # bad
# method(foo, bar,
# baz)
#
# # good
# method(
# ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/argument_alignment.rb | lib/rubocop/cop/layout/argument_alignment.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Check that the arguments on a multi-line method call are aligned.
#
# @example EnforcedStyle: with_first_argument (default)
# # good
#
# foo :bar,
# :baz,
# key: value
#
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb | lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks that braces used for hash literals have or don't have
# surrounding space depending on configuration.
#
# Hash pattern matching is handled in the same way.
#
# @example EnforcedStyle: space (default... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/empty_lines_around_module_body.rb | lib/rubocop/cop/layout/empty_lines_around_module_body.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks if empty lines around the bodies of modules match
# the configuration.
#
# @example EnforcedStyle: no_empty_lines (default)
# # good
#
# module Foo
# def bar
# # ...
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/space_before_first_arg.rb | lib/rubocop/cop/layout/space_before_first_arg.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks that exactly one space is used between a method name and the
# first argument for method calls without parentheses.
#
# Alternatively, extra spaces can be added to align the argument with
# something on a... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/class_structure.rb | lib/rubocop/cop/layout/class_structure.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks if the code style follows the `ExpectedOrder` configuration:
#
# `Categories` allows us to map macro names into a category.
#
# Consider an example of code style that covers the following order:
#
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/assignment_indentation.rb | lib/rubocop/cop/layout/assignment_indentation.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks the indentation of the first line of the
# right-hand-side of a multi-line assignment.
#
# The indentation of the remaining lines can be corrected with
# other cops such as `Layout/IndentationConsistency`... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb | lib/rubocop/cop/layout/empty_line_after_guard_clause.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Enforces empty line after guard clause.
#
# This cop allows `# :nocov:` directive after guard clause because
# SimpleCov excludes code from the coverage report by wrapping it in `# :nocov:`:
#
# [source,ru... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/block_end_newline.rb | lib/rubocop/cop/layout/block_end_newline.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks whether the end statement of a do..end block
# is on its own line.
#
# @example
# # bad
# blah do |i|
# foo(i) end
#
# # good
# blah do |i|
# foo(i)
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/closing_parenthesis_indentation.rb | lib/rubocop/cop/layout/closing_parenthesis_indentation.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks the indentation of hanging closing parentheses in
# method calls, method definitions, and grouped expressions. A hanging
# closing parenthesis means `)` preceded by a line break.
#
# @example
#
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/indentation_width.rb | lib/rubocop/cop/layout/indentation_width.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks for indentation that doesn't use the specified number of spaces.
# The indentation width can be configured using the `Width` setting. The default width is 2.
#
# See also the `Layout/IndentationConsistency` cop... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/space_inside_array_percent_literal.rb | lib/rubocop/cop/layout/space_inside_array_percent_literal.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks for unnecessary additional spaces inside array percent literals
# (i.e. %i/%w).
#
# Note that blank percent literals (e.g. `%i( )`) are checked by
# `Layout/SpaceInsidePercentLiteralDelimiters`.
#
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/access_modifier_indentation.rb | lib/rubocop/cop/layout/access_modifier_indentation.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Bare access modifiers (those not applying to specific methods) should be
# indented as deep as method definitions, or as deep as the `class`/`module`
# keyword, depending on configuration.
#
# @example EnforcedS... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/redundant_line_break.rb | lib/rubocop/cop/layout/redundant_line_break.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks whether certain expressions, e.g. method calls, that could fit
# completely on a single line, are broken up into multiple lines unnecessarily.
#
# @example
# # bad
# foo(
# a,
# ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/empty_lines_after_module_inclusion.rb | lib/rubocop/cop/layout/empty_lines_after_module_inclusion.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks for an empty line after a module inclusion method (`extend`,
# `include` and `prepend`), or a group of them.
#
# @example
# # bad
# class Foo
# include Bar
# attr_reader :baz... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/multiline_method_definition_brace_layout.rb | lib/rubocop/cop/layout/multiline_method_definition_brace_layout.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks that the closing brace in a method definition is either
# on the same line as the last method parameter, or a new line.
#
# When using the `symmetrical` (default) style:
#
# If a method definition's... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/space_before_comma.rb | lib/rubocop/cop/layout/space_before_comma.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks for comma (`,`) preceded by space.
#
# @example
# # bad
# [1 , 2 , 3]
# a(1 , 2)
# each { |a , b| }
#
# # good
# [1, 2, 3]
# a(1, 2)
# each { |a, ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/def_end_alignment.rb | lib/rubocop/cop/layout/def_end_alignment.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks whether the end keywords of method definitions are
# aligned properly.
#
# Two modes are supported through the EnforcedStyleAlignWith configuration
# parameter. If it's set to `start_of_line` (which is th... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/first_argument_indentation.rb | lib/rubocop/cop/layout/first_argument_indentation.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks the indentation of the first argument in a method call.
# Arguments after the first one are checked by `Layout/ArgumentAlignment`,
# not by this cop.
#
# For indenting the first parameter of method _defin... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/multiline_method_parameter_line_breaks.rb | lib/rubocop/cop/layout/multiline_method_parameter_line_breaks.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Ensures that each parameter in a multi-line method definition
# starts on a separate line.
#
# NOTE: This cop does not move the first argument, if you want that to
# be on a separate line, see `Layout/FirstMetho... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/first_array_element_indentation.rb | lib/rubocop/cop/layout/first_array_element_indentation.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks the indentation of the first element in an array literal
# where the opening bracket and the first element are on separate lines.
# The other elements' indentations are handled by `Layout/ArrayAlignment` cop.
#... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/empty_lines_around_begin_body.rb | lib/rubocop/cop/layout/empty_lines_around_begin_body.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks if empty lines exist around the bodies of begin-end
# blocks.
#
# @example
#
# # bad
# begin
#
# # ...
#
# end
#
# # good
# begin
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/space_after_method_name.rb | lib/rubocop/cop/layout/space_after_method_name.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks for space between a method name and a left parenthesis in defs.
#
# @example
#
# # bad
# def func (x) end
# def method= (y) end
#
# # good
# def func(x) end
#... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/multiline_hash_key_line_breaks.rb | lib/rubocop/cop/layout/multiline_hash_key_line_breaks.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Ensures that each key in a multi-line hash
# starts on a separate line.
#
# @example
#
# # bad
# {
# a: 1, b: 2,
# c: 3
# }
#
# # good
# {
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/space_before_semicolon.rb | lib/rubocop/cop/layout/space_before_semicolon.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks for semicolon (`;`) preceded by space.
#
# @example
# # bad
# x = 1 ; y = 2
#
# # good
# x = 1; y = 2
class SpaceBeforeSemicolon < Base
include SpaceBeforePunctuati... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/space_inside_block_braces.rb | lib/rubocop/cop/layout/space_inside_block_braces.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks that block braces have or don't have surrounding space inside
# them on configuration. For blocks taking parameters, it checks that the
# left brace has or doesn't have trailing space depending on
# configurati... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/space_after_not.rb | lib/rubocop/cop/layout/space_after_not.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks for space after `!`.
#
# @example
# # bad
# ! something
#
# # good
# !something
class SpaceAfterNot < Base
include RangeHelp
extend AutoCorrector
M... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/comment_indentation.rb | lib/rubocop/cop/layout/comment_indentation.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks the indentation of comments.
#
# @example
# # bad
# # comment here
# def method_name
# end
#
# # comment here
# a = 'hello'
#
# # yet another co... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/space_around_keyword.rb | lib/rubocop/cop/layout/space_around_keyword.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks the spacing around the keywords.
#
# @example
#
# # bad
# something 'test'do|x|
# end
#
# while(something)
# end
#
# something = 123if test
#
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/initial_indentation.rb | lib/rubocop/cop/layout/initial_indentation.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks for indentation of the first non-blank non-comment
# line in a file.
#
# @example
# # bad
# class A
# def foo; end
# end
#
# # good
# class A
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb | lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Access modifiers should be surrounded by blank lines.
#
# @example EnforcedStyle: around (default)
#
# # bad
# class Foo
# def bar; end
# private
# def baz; end
# ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/extra_spacing.rb | lib/rubocop/cop/layout/extra_spacing.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks for extra/unnecessary whitespace.
#
# @example
#
# # good if AllowForAlignment is true
# name = "RuboCop"
# # Some comment and an empty line
#
# website += "/rubocop/... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/empty_lines_around_block_body.rb | lib/rubocop/cop/layout/empty_lines_around_block_body.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks if empty lines around the bodies of blocks match
# the configuration.
#
# @example EnforcedStyle: no_empty_lines (default)
# # good
#
# foo do |bar|
# # ...
# end
#... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/space_around_block_parameters.rb | lib/rubocop/cop/layout/space_around_block_parameters.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks the spacing inside and after block parameters pipes. Line breaks
# inside parameter pipes are checked by `Layout/MultilineBlockLayout` and
# not by this cop.
#
# @example EnforcedStyleInsidePipes: no_spac... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/trailing_whitespace.rb | lib/rubocop/cop/layout/trailing_whitespace.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Looks for trailing whitespace in the source code.
#
# @example
# # The line in this example contains spaces after the 0.
# # bad
# x = 0
#
# # The line in this example ends directly aft... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/multiline_array_brace_layout.rb | lib/rubocop/cop/layout/multiline_array_brace_layout.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks that the closing brace in an array literal is either
# on the same line as the last array element or on a new line.
#
# When using the `symmetrical` (default) style:
#
# If an array's opening brace ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/space_in_lambda_literal.rb | lib/rubocop/cop/layout/space_in_lambda_literal.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks for spaces between `->` and opening parameter
# parenthesis (`(`) in lambda literals.
#
# @example EnforcedStyle: require_no_space (default)
# # bad
# a = -> (x, y) { x + y }
#
#... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb | lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks if empty lines exist around the bodies of `begin`
# sections. This cop doesn't check empty lines at `begin` body
# beginning/end and around method definition body.
# `Layout/EmptyLinesAroundBeginBody` or `Layou... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/line_continuation_spacing.rb | lib/rubocop/cop/layout/line_continuation_spacing.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks that the backslash of a line continuation is separated from
# preceding text by exactly one space (default) or zero spaces.
#
# @example EnforcedStyle: space (default)
# # bad
# 'a'\
# '... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/space_inside_string_interpolation.rb | lib/rubocop/cop/layout/space_inside_string_interpolation.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks for whitespace within string interpolations.
#
# @example EnforcedStyle: no_space (default)
# # bad
# var = "This is the #{ space } example"
#
# # good
# var = "This is the... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/single_line_block_chain.rb | lib/rubocop/cop/layout/single_line_block_chain.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks if method calls are chained onto single line blocks. It considers that a
# line break before the dot improves the readability of the code.
#
# @example
# # bad
# example.select { |item| item.con... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/space_before_brackets.rb | lib/rubocop/cop/layout/space_before_brackets.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks for space between the name of a receiver and a left
# brackets.
#
# @example
#
# # bad
# collection [index_or_key]
#
# # good
# collection[index_or_key]
#
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/condition_position.rb | lib/rubocop/cop/layout/condition_position.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks for conditions that are not on the same line as
# if/while/until.
#
# @example
#
# # bad
# if
# some_condition
# do_something
# end
#
# # good
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/line_continuation_leading_space.rb | lib/rubocop/cop/layout/line_continuation_leading_space.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks that strings broken over multiple lines (by a backslash) contain
# trailing spaces instead of leading spaces (default) or leading spaces
# instead of trailing spaces.
#
# @example EnforcedStyle: trailing ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/space_after_comma.rb | lib/rubocop/cop/layout/space_after_comma.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks for comma (`,`) not followed by some kind of space.
#
# @example
#
# # bad
# [1,2]
# { foo:bar,}
#
# # good
# [1, 2]
# { foo:bar, }
class SpaceAfterCo... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/empty_line_after_multiline_condition.rb | lib/rubocop/cop/layout/empty_line_after_multiline_condition.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Enforces empty line after multiline condition.
#
# @example
# # bad
# if multiline &&
# condition
# do_something
# end
#
# # good
# if multiline &&
# ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/heredoc_indentation.rb | lib/rubocop/cop/layout/heredoc_indentation.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks the indentation of the here document bodies. The bodies
# are indented one step.
#
# NOTE: When ``Layout/LineLength``'s `AllowHeredoc` is false (not default),
# this cop does not add any offenses fo... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/block_alignment.rb | lib/rubocop/cop/layout/block_alignment.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks whether the end keywords are aligned properly for do
# end blocks.
#
# Three modes are supported through the `EnforcedStyleAlignWith`
# configuration parameter:
#
# `start_of_block` : the `end... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/empty_lines_around_method_body.rb | lib/rubocop/cop/layout/empty_lines_around_method_body.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks if empty lines exist around the bodies of methods.
#
# @example
#
# # good
#
# def foo
# # ...
# end
#
# # bad
#
# def bar
#
# ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/space_before_comment.rb | lib/rubocop/cop/layout/space_before_comment.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks for missing space between a token and a comment on the
# same line.
#
# @example
# # bad
# 1 + 1# this operation does ...
#
# # good
# 1 + 1 # this operation does ...
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/space_around_method_call_operator.rb | lib/rubocop/cop/layout/space_around_method_call_operator.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks method call operators to not have spaces around them.
#
# @example
# # bad
# foo. bar
# foo .bar
# foo . bar
# foo. bar .buzz
# foo
# . bar
# . buzz... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/end_of_line.rb | lib/rubocop/cop/layout/end_of_line.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks for Windows-style line endings in the source code.
#
# @example EnforcedStyle: native (default)
# # The `native` style means that CR+LF (Carriage Return + Line Feed) is
# # enforced on Windows, and LF... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/multiline_array_line_breaks.rb | lib/rubocop/cop/layout/multiline_array_line_breaks.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Ensures that each item in a multi-line array
# starts on a separate line.
#
# @example
#
# # bad
# [
# a, b,
# c
# ]
#
# # good
# [
# a... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/space_inside_reference_brackets.rb | lib/rubocop/cop/layout/space_inside_reference_brackets.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks that reference brackets have or don't have
# surrounding space depending on configuration.
#
# @example EnforcedStyle: no_space (default)
# # The `no_space` style enforces that reference brackets have
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/space_after_colon.rb | lib/rubocop/cop/layout/space_after_colon.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks for colon (`:`) not followed by some kind of space.
# N.B. this cop does not handle spaces after a ternary operator, which are
# instead handled by `Layout/SpaceAroundOperators`.
#
# @example
# # ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/hash_alignment.rb | lib/rubocop/cop/layout/hash_alignment.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Check that the keys, separators, and values of a multi-line hash
# literal are aligned according to configuration. The configuration
# options are:
#
# * key (left align keys, one space before hash rockets and v... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/line_length.rb | lib/rubocop/cop/layout/line_length.rb | # frozen_string_literal: true
require 'uri'
module RuboCop
module Cop
module Layout
# Checks the length of lines in the source code.
# The maximum length is configurable.
# The tab size is configured in the `IndentationWidth`
# of the `Layout/IndentationStyle` cop.
# It also ignore... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/array_alignment.rb | lib/rubocop/cop/layout/array_alignment.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Check that the elements of a multi-line array literal are
# aligned.
#
# @example EnforcedStyle: with_first_element (default)
# # good
#
# array = [1, 2, 3,
# 4, 5, 6]
# ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/space_around_equals_in_parameter_default.rb | lib/rubocop/cop/layout/space_around_equals_in_parameter_default.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks that the equals signs in parameter default assignments
# have or don't have surrounding space depending on configuration.
#
# @example EnforcedStyle: space (default)
# # bad
# def some_method(ar... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/empty_line_after_magic_comment.rb | lib/rubocop/cop/layout/empty_line_after_magic_comment.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks for a newline after the final magic comment.
#
# @example
# # good
# # frozen_string_literal: true
#
# # Some documentation for Person
# class Person
# # Some code
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb | lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks for the placement of the closing parenthesis
# in a method call that passes a HEREDOC string as an argument.
# It should be placed at the end of the line containing the
# opening HEREDOC tag.
#
# @e... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/first_parameter_indentation.rb | lib/rubocop/cop/layout/first_parameter_indentation.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks the indentation of the first parameter in a method
# definition. Parameters after the first one are checked by
# `Layout/ParameterAlignment`, not by this cop.
#
# For indenting the first argument of metho... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/case_indentation.rb | lib/rubocop/cop/layout/case_indentation.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks how the `when` and ``in``s of a `case` expression
# are indented in relation to its `case` or `end` keyword.
#
# It will register a separate offense for each misaligned `when` and `in`.
#
# @example... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/closing_heredoc_indentation.rb | lib/rubocop/cop/layout/closing_heredoc_indentation.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks the indentation of here document closings.
#
# @example
#
# # bad
# class Foo
# def bar
# <<~SQL
# 'Hi'
# SQL
# end
# end
#
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/else_alignment.rb | lib/rubocop/cop/layout/else_alignment.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks the alignment of else keywords. Normally they should
# be aligned with an if/unless/while/until/begin/def/rescue keyword, but there
# are special cases when they should follow the same rules as the
# alignment ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/multiline_block_layout.rb | lib/rubocop/cop/layout/multiline_block_layout.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks whether the multiline do end blocks have a newline
# after the start of the block. Additionally, it checks whether the block
# arguments, if any, are on the same line as the start of the
# block. Putting block ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/first_hash_element_indentation.rb | lib/rubocop/cop/layout/first_hash_element_indentation.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks the indentation of the first key in a hash literal
# where the opening brace and the first key are on separate lines. The
# other keys' indentations are handled by the HashAlignment cop.
#
# By default, `... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/multiline_method_argument_line_breaks.rb | lib/rubocop/cop/layout/multiline_method_argument_line_breaks.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Ensures that each argument in a multi-line method call
# starts on a separate line.
#
# NOTE: This cop does not move the first argument, if you want that to
# be on a separate line, see `Layout/FirstMethodArgume... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/empty_lines.rb | lib/rubocop/cop/layout/empty_lines.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks for two or more consecutive blank lines.
#
# @example
#
# # bad - It has two empty lines.
# some_method
# # one empty line
# # two empty lines
# some_method
#
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/line_end_string_concatenation_indentation.rb | lib/rubocop/cop/layout/line_end_string_concatenation_indentation.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks the indentation of the next line after a line that ends with a string
# literal and a backslash.
#
# If `EnforcedStyle: aligned` is set, the concatenated string parts shall be aligned with the
# first par... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/space_inside_percent_literal_delimiters.rb | lib/rubocop/cop/layout/space_inside_percent_literal_delimiters.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks for unnecessary additional spaces inside the delimiters of
# %i/%w/%x literals.
#
# @example
#
# # bad
# %i( foo bar baz )
#
# # good
# %i(foo bar baz)
#
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb | lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks that brackets used for array literals have or don't have
# surrounding space depending on configuration.
#
# Array pattern matching is handled in the same way.
#
# @example EnforcedStyle: no_space (... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/leading_comment_space.rb | lib/rubocop/cop/layout/leading_comment_space.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks whether comments have a leading space after the
# `#` denoting the start of the comment. The leading space is not
# required for some RDoc special syntax, like `#++`, `#--`,
# `#:nodoc`, `=begin`- and `=end` co... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/parameter_alignment.rb | lib/rubocop/cop/layout/parameter_alignment.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Check that the parameters on a multi-line method call or definition are aligned.
#
# To set the alignment of the first argument, use the
# `Layout/FirstParameterIndentation` cop.
#
# @example EnforcedStyle... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/space_before_block_braces.rb | lib/rubocop/cop/layout/space_before_block_braces.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks that block braces have or don't have a space before the opening
# brace depending on configuration.
#
# @example EnforcedStyle: space (default)
# # bad
# foo.map{ |a|
# a.bar.to_s
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/multiline_method_call_brace_layout.rb | lib/rubocop/cop/layout/multiline_method_call_brace_layout.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks that the closing brace in a method call is either
# on the same line as the last method argument, or a new line.
#
# When using the `symmetrical` (default) style:
#
# If a method call's opening brac... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/dot_position.rb | lib/rubocop/cop/layout/dot_position.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks the . position in multi-line method calls.
#
# @example EnforcedStyle: leading (default)
# # bad
# something.
# method
#
# # good
# something
# .method
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/space_after_semicolon.rb | lib/rubocop/cop/layout/space_after_semicolon.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks for semicolon (`;`) not followed by some kind of space.
#
# @example
# # bad
# x = 1;y = 2
#
# # good
# x = 1; y = 2
class SpaceAfterSemicolon < Base
include SpaceA... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/empty_lines_around_class_body.rb | lib/rubocop/cop/layout/empty_lines_around_class_body.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks if empty lines around the bodies of classes match
# the configuration.
#
# @example EnforcedStyle: no_empty_lines (default)
# # good
#
# class Foo
# def bar
# # ...
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/space_inside_parens.rb | lib/rubocop/cop/layout/space_inside_parens.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks for spaces inside ordinary round parentheses.
#
# @example EnforcedStyle: no_space (default)
# # The `no_space` style enforces that parentheses do not have spaces.
#
# # bad
# f( 3)
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/indentation_style.rb | lib/rubocop/cop/layout/indentation_style.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks that the indentation method is consistent.
# Either tabs only or spaces only are used for indentation.
#
# @example EnforcedStyle: spaces (default)
# # bad
# # This example uses a tab to indent ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/multiline_operation_indentation.rb | lib/rubocop/cop/layout/multiline_operation_indentation.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks the indentation of the right hand side operand in binary operations that
# span more than one line.
#
# The `aligned` style checks that operators are aligned if they are part of an `if` or `while`
# condi... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/first_array_element_line_break.rb | lib/rubocop/cop/layout/first_array_element_line_break.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Layout
# Checks for a line break before the first element in a
# multi-line array.
#
# @example
#
# # bad
# [ :a,
# :b]
#
# # good
# [
# :a,
# :b]
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.