source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/space_after_semicolon.rb
Ruby
mit
12,856
master
887
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/multiline_method_parameter_line_breaks.rb
Ruby
mit
12,856
master
1,680
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/space_inside_block_braces.rb
Ruby
mit
12,856
master
9,119
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/argument_alignment.rb
Ruby
mit
12,856
master
4,127
# frozen_string_literal: true module RuboCop module Cop module Layout # Checks that the arguments on a multi-line method call are aligned. # # @example EnforcedStyle: with_first_argument (default) # # good # # foo :bar, # :baz, # key: value # ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/multiline_hash_key_line_breaks.rb
Ruby
mit
12,856
master
1,630
# 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 # { ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/multiline_method_argument_line_breaks.rb
Ruby
mit
12,856
master
2,432
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/begin_end_alignment.rb
Ruby
mit
12,856
master
2,131
# frozen_string_literal: true module RuboCop module Cop module Layout # Checks whether the end keyword of `begin` is aligned properly. # # Two modes are supported through the `EnforcedStyleAlignWith` configuration # parameter. If it's set to `start_of_line` (which is the default), the ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/first_hash_element_line_break.rb
Ruby
mit
12,856
master
1,446
# 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, # b: 2...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/multiline_array_line_breaks.rb
Ruby
mit
12,856
master
1,241
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/empty_line_after_guard_clause.rb
Ruby
mit
12,856
master
6,669
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/space_inside_percent_literal_delimiters.rb
Ruby
mit
12,856
master
2,163
# 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) # ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/multiline_hash_brace_layout.rb
Ruby
mit
12,856
master
2,993
# frozen_string_literal: true module RuboCop module Cop module Layout # Checks that the closing brace in a hash literal is either # on the same line as the last hash element, or a new line. # # When using the `symmetrical` (default) style: # # If a hash's opening brace is on t...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb
Ruby
mit
12,856
master
6,724
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/space_after_comma.rb
Ruby
mit
12,856
master
698
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/indentation_consistency.rb
Ruby
mit
12,856
master
5,642
# frozen_string_literal: true module RuboCop module Cop module Layout # Checks for inconsistent indentation. # # The difference between `indented_internal_methods` and `normal` is # that the `indented_internal_methods` style prescribes that in # classes and modules the `protected` a...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/empty_lines_around_begin_body.rb
Ruby
mit
12,856
master
662
# 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 ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/end_alignment.rb
Ruby
mit
12,856
master
6,243
# 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 ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/space_around_equals_in_parameter_default.rb
Ruby
mit
12,856
master
2,588
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/comment_indentation.rb
Ruby
mit
12,856
master
5,503
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb
Ruby
mit
12,856
master
3,404
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/def_end_alignment.rb
Ruby
mit
12,856
master
2,079
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/empty_lines_around_class_body.rb
Ruby
mit
12,856
master
1,883
# 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) # # bad # class Foo # # def bar # # ... ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/parameter_alignment.rb
Ruby
mit
12,856
master
2,745
# frozen_string_literal: true module RuboCop module Cop module Layout # Checks 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 EnforcedStyl...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb
Ruby
mit
12,856
master
7,193
# 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 # ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb
Ruby
mit
12,856
master
7,770
# 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 (...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/first_array_element_line_break.rb
Ruby
mit
12,856
master
1,981
# 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] ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/empty_comment.rb
Ruby
mit
12,856
master
3,818
# frozen_string_literal: true module RuboCop module Cop module Layout # Checks empty comment. # # @example # # bad # # # # class Foo # end # # # good # # # # # Description of `Foo` class. # # # class Foo ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/redundant_line_break.rb
Ruby
mit
12,856
master
3,775
# 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, # ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/multiline_array_brace_layout.rb
Ruby
mit
12,856
master
2,998
# 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 ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/space_before_semicolon.rb
Ruby
mit
12,856
master
459
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/first_hash_element_indentation.rb
Ruby
mit
12,856
master
8,649
# 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, `...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/multiline_operation_indentation.rb
Ruby
mit
12,856
master
4,113
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/space_before_comma.rb
Ruby
mit
12,856
master
536
# 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, ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/space_inside_array_percent_literal.rb
Ruby
mit
12,856
master
1,248
# 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`. # ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/dot_position.rb
Ruby
mit
12,856
master
4,056
# 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 ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/empty_lines_around_block_body.rb
Ruby
mit
12,856
master
1,007
# 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) # # bad # foo do |bar| # # # ... # # end ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/class_structure.rb
Ruby
mit
12,856
master
12,260
# 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: # ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/space_after_not.rb
Ruby
mit
12,856
master
912
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/first_method_argument_line_break.rb
Ruby
mit
12,856
master
2,425
# 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( # ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/space_inside_parens.rb
Ruby
mit
12,856
master
5,381
# 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) ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/indentation_style.rb
Ruby
mit
12,856
master
3,187
# 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 ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/case_indentation.rb
Ruby
mit
12,856
master
5,889
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/space_around_keyword.rb
Ruby
mit
12,856
master
7,303
# 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 # ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/initial_indentation.rb
Ruby
mit
12,856
master
1,405
# 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 ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/empty_line_between_defs.rb
Ruby
mit
12,856
master
8,961
# frozen_string_literal: true module RuboCop module Cop module Layout # Checks whether class/module/method definitions are # separated by one or more empty lines. # # `NumberOfEmptyLines` can be an integer (default is 1) or # an array (e.g. [1, 2]) to specify a minimum and maximum ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/line_continuation_leading_space.rb
Ruby
mit
12,856
master
5,507
# 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 ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/first_method_parameter_line_break.rb
Ruby
mit
12,856
master
1,649
# frozen_string_literal: true module RuboCop module Cop module Layout # Checks for a line break before the first parameter in a # multi-line method parameter definition. # # @example # # # bad # def method(foo, bar, # baz) # do_something #...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/line_continuation_spacing.rb
Ruby
mit
12,856
master
3,977
# 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'\ # '...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/space_inside_range_literal.rb
Ruby
mit
12,856
master
1,129
# frozen_string_literal: true module RuboCop module Cop module Layout # Checks for spaces inside range literals. # # @example # # bad # 1 .. 3 # # # good # 1..3 # # # bad # 'a' .. 'z' # # # good # 'a'..'z' c...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/access_modifier_indentation.rb
Ruby
mit
12,856
master
2,779
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/multiline_method_call_brace_layout.rb
Ruby
mit
12,856
master
3,367
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/space_around_block_parameters.rb
Ruby
mit
12,856
master
5,185
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/space_inside_string_interpolation.rb
Ruby
mit
12,856
master
1,788
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/block_alignment.rb
Ruby
mit
12,856
master
7,897
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/hash_alignment.rb
Ruby
mit
12,856
master
11,584
# frozen_string_literal: true module RuboCop module Cop module Layout # Checks 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 ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/space_around_method_call_operator.rb
Ruby
mit
12,856
master
2,418
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/leading_empty_lines.rb
Ruby
mit
12,856
master
1,023
# 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 # # (...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/assignment_indentation.rb
Ruby
mit
12,856
master
1,517
# 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`...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/space_after_method_name.rb
Ruby
mit
12,856
master
1,017
# 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 #...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/block_end_newline.rb
Ruby
mit
12,856
master
2,161
# 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) ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/empty_line_after_multiline_condition.rb
Ruby
mit
12,856
master
3,273
# 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 && # ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/closing_parenthesis_indentation.rb
Ruby
mit
12,856
master
5,549
# 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 # ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/leading_comment_space.rb
Ruby
mit
12,856
master
5,599
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/empty_lines_around_module_body.rb
Ruby
mit
12,856
master
1,360
# 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) # # bad # module Foo # # def bar # # ... ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/empty_lines_around_method_body.rb
Ruby
mit
12,856
master
1,464
# 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 # # ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/multiline_method_definition_brace_layout.rb
Ruby
mit
12,856
master
3,338
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/rescue_ensure_alignment.rb
Ruby
mit
12,856
master
7,322
# frozen_string_literal: true module RuboCop module Cop module Layout # Checks whether the rescue and ensure keywords are aligned # properly. # # @example # # # bad # begin # something # rescue # puts 'error' # end # ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb
Ruby
mit
12,856
master
9,912
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/heredoc_indentation.rb
Ruby
mit
12,856
master
5,871
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/empty_line_after_magic_comment.rb
Ruby
mit
12,856
master
2,113
# 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 ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/first_argument_indentation.rb
Ruby
mit
12,856
master
10,048
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/line_length.rb
Ruby
mit
12,856
master
15,107
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/multiline_method_call_indentation.rb
Ruby
mit
12,856
master
14,184
# frozen_string_literal: true module RuboCop module Cop module Layout # Checks the indentation of the method name part in method calls # that span more than one line. # # @example EnforcedStyle: aligned (default) # # bad # while myvariable # .b # # do som...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/multiline_block_layout.rb
Ruby
mit
12,856
master
4,722
# 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 ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/extra_spacing.rb
Ruby
mit
12,856
master
5,906
# 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/...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/first_array_element_indentation.rb
Ruby
mit
12,856
master
6,921
# 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. #...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/space_before_comment.rb
Ruby
mit
12,856
master
870
# 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 ... ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/space_before_block_braces.rb
Ruby
mit
12,856
master
5,075
# 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 ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/empty_lines_after_module_inclusion.rb
Ruby
mit
12,856
master
2,708
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/layout/array_alignment.rb
Ruby
mit
12,856
master
2,284
# frozen_string_literal: true module RuboCop module Cop module Layout # Checks 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] # ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/mixin/surrounding_space.rb
Ruby
mit
12,856
master
4,723
# frozen_string_literal: true module RuboCop module Cop # Common functionality for checking and correcting surrounding whitespace. module SurroundingSpace include RangeHelp NO_SPACE_COMMAND = 'Do not use' SPACE_COMMAND = 'Use' SINGLE_SPACE_REGEXP = /[ \t]/.freeze private ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/mixin/check_assignment.rb
Ruby
mit
12,856
master
827
# frozen_string_literal: true module RuboCop module Cop # Common functionality for checking assignment nodes. module CheckAssignment def on_lvasgn(node) check_assignment(node, extract_rhs(node)) end alias on_ivasgn on_lvasgn alias on_cvasgn on_lvasgn alias on_gvasgn ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/mixin/multiline_expression_indentation.rb
Ruby
mit
12,856
master
7,268
# frozen_string_literal: true module RuboCop module Cop # Common functionality for checking multiline method calls and binary # operations. module MultilineExpressionIndentation # rubocop:disable Metrics/ModuleLength KEYWORD_ANCESTOR_TYPES = %i[for if while until return].freeze UNALIGNED_RHS...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/mixin/code_length.rb
Ruby
mit
12,856
master
1,779
# frozen_string_literal: true module RuboCop module Cop # Common functionality for checking length of code segments. module CodeLength extend ExcludeLimit MSG = '%<label>s has too many lines. [%<length>d/%<max>d]' exclude_limit 'Max' private def message(length, max_length) ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/mixin/range_help.rb
Ruby
mit
12,856
master
5,624
# frozen_string_literal: true module RuboCop module Cop # Methods that calculate and return Parser::Source::Ranges module RangeHelp BYTE_ORDER_MARK = 0xfeff # The Unicode codepoint NOT_GIVEN = Module.new private def source_range(source_buffer, line_number, column, length = 1) ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/mixin/uncommunicative_name.rb
Ruby
mit
12,856
master
2,997
# frozen_string_literal: true module RuboCop module Cop # Common functionality shared by Uncommunicative cops module UncommunicativeName CASE_MSG = 'Only use lowercase characters for %<name_type>s.' NUM_MSG = 'Do not end %<name_type>s with a number.' LENGTH_MSG = '%<name_type>s must be at l...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/mixin/comments_help.rb
Ruby
mit
12,856
master
2,985
# frozen_string_literal: true module RuboCop module Cop # Help methods for working with nodes containing comments. module CommentsHelp def source_range_with_comment(node) begin_pos = begin_pos_with_comment(node) end_pos = end_position_for(node) Parser::Source::Range.new(buffer,...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/mixin/multiline_element_indentation.rb
Ruby
mit
12,856
master
3,650
# frozen_string_literal: true module RuboCop module Cop # Common code for indenting the first elements in multiline # array literals, hash literals, and method definitions. module MultilineElementIndentation private def each_argument_node(node, type) left_parenthesis = node.loc.begin...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/mixin/trailing_comma.rb
Ruby
mit
12,856
master
7,155
# frozen_string_literal: true module RuboCop module Cop # Common methods shared by Style/TrailingCommaInArguments, # Style/TrailingCommaInArrayLiteral and Style/TrailingCommaInHashLiteral # rubocop:disable Metrics/ModuleLength module TrailingComma include ConfigurableEnforcedStyle include...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/mixin/method_preference.rb
Ruby
mit
12,856
master
870
# frozen_string_literal: true module RuboCop module Cop # Common code for cops that deal with preferred methods. module MethodPreference private def preferred_method(method) preferred_methods[method.to_sym] end def preferred_methods @preferred_methods ||= b...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/mixin/hash_transform_method.rb
Ruby
mit
12,856
master
4,690
# frozen_string_literal: true require_relative 'hash_transform_method/autocorrection' module RuboCop module Cop # Common functionality for Style/HashTransformKeys and # Style/HashTransformValues module HashTransformMethod extend NodePattern::Macros RESTRICT_ON_SEND = %i[[] to_h].freeze ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/mixin/visibility_help.rb
Ruby
mit
12,856
master
2,229
# frozen_string_literal: true require 'set' module RuboCop module Cop # Help methods for determining node visibility. module VisibilityHelp extend NodePattern::Macros VISIBILITY_SCOPES = ::Set[:private, :protected, :public].freeze private def node_visibility(node) node_vis...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/mixin/percent_literal.rb
Ruby
mit
12,856
master
659
# frozen_string_literal: true module RuboCop module Cop # Common functionality for handling percent literals. module PercentLiteral include RangeHelp private def percent_literal?(node) return false unless (begin_source = begin_source(node)) begin_source.start_with?('%') ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/mixin/endless_method_rewriter.rb
Ruby
mit
12,856
master
575
# frozen_string_literal: true module RuboCop module Cop # Common functionality for rewriting endless methods to normal method definitions module EndlessMethodRewriter def correct_to_multiline(corrector, node) replacement = <<~RUBY.strip def #{node.method_name}#{arguments(node)} ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/mixin/documentation_comment.rb
Ruby
mit
12,856
master
1,585
# frozen_string_literal: true module RuboCop module Cop # Common functionality for checking documentation. module DocumentationComment extend NodePattern::Macros private def documentation_comment?(node) preceding_lines = preceding_lines(node) return false unless preceding...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/mixin/rescue_node.rb
Ruby
mit
12,856
master
868
# frozen_string_literal: true module RuboCop module Cop # Common functionality for checking `rescue` nodes. module RescueNode def modifier_locations @modifier_locations ||= processed_source.tokens.select(&:rescue_modifier?).map!(&:pos) end private def rescue_modifier?(node) ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/mixin/configurable_max.rb
Ruby
mit
12,856
master
767
# frozen_string_literal: true module RuboCop module Cop # Handles `Max` configuration parameters, especially setting them to an # appropriate value with --auto-gen-config. # @deprecated Use `exclude_limit <ParameterName>` instead. module ConfigurableMax private def max=(value) wa...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/mixin/configurable_numbering.rb
Ruby
mit
12,856
master
489
# frozen_string_literal: true module RuboCop module Cop # This module provides functionality for checking if numbering match the # configured EnforcedStyle. module ConfigurableNumbering include ConfigurableFormatting implicit_param = /\A_\d+\z/ FORMATS = { snake_case: /(?:\D|_...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/mixin/safe_assignment.rb
Ruby
mit
12,856
master
774
# frozen_string_literal: true module RuboCop module Cop # Common functionality for safe assignment. By safe assignment we mean # putting parentheses around an assignment to indicate "I know I'm using an # assignment as a condition. It's not a mistake." module SafeAssignment extend NodePattern::...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/mixin/frozen_string_literal.rb
Ruby
mit
12,856
master
3,476
# frozen_string_literal: true module RuboCop module Cop # Common functionality for dealing with frozen string literals. module FrozenStringLiteral module_function FROZEN_STRING_LITERAL_ENABLED = '# frozen_string_literal: true' FROZEN_STRING_LITERAL_TYPES_RUBY27 = %i[str dstr].freeze ...