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/spec/rubocop/cop/internal_affairs/method_name_equal_spec.rb
spec/rubocop/cop/internal_affairs/method_name_equal_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::InternalAffairs::MethodNameEqual, :config do it 'registers an offense when using `#method == :do_something`' do expect_offense(<<~RUBY) node.method_name == :do_something ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use `node.method?(:do_something)` inst...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/internal_affairs/example_heredoc_delimiter_spec.rb
spec/rubocop/cop/internal_affairs/example_heredoc_delimiter_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::InternalAffairs::ExampleHeredocDelimiter, :config do context 'when expected heredoc delimiter is used at RuboCop specific expectation' do it 'does not register an offense' do expect_no_offenses(<<~RUBY_) it 'does not register an offense' do...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/internal_affairs/redundant_context_config_parameter_spec.rb
spec/rubocop/cop/internal_affairs/redundant_context_config_parameter_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::InternalAffairs::RedundantContextConfigParameter, :config do it 'registers an offense when using `:config` parameter' do expect_offense(<<~RUBY) context 'foo', :config do ^^^^^^^ Remove the redundant `:config` parameter. ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/internal_affairs/single_line_comparison_spec.rb
spec/rubocop/cop/internal_affairs/single_line_comparison_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::InternalAffairs::SingleLineComparison, :config do it 'registers and corrects an offense when comparing `loc.first_line` with `loc.last_line`' do expect_offense(<<~RUBY) node.loc.first_line == node.loc.last_line ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/internal_affairs/node_pattern_groups_spec.rb
spec/rubocop/cop/internal_affairs/node_pattern_groups_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::InternalAffairs::NodePatternGroups, :config do shared_examples 'node group' do |node_group, members| describe "`#{node_group}` node group" do let(:source) { members.join(' ') } let(:names) { members.join('`, `') } it 'registers an offe...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/internal_affairs/example_description_spec.rb
spec/rubocop/cop/internal_affairs/example_description_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::InternalAffairs::ExampleDescription, :config do context 'with `expect_offense`' do it 'registers an offense when given an improper description in `it`' do expect_offense(<<~RUBY) it 'does not register an offense' do ^^^^^^^^^^^^^...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/internal_affairs/redundant_message_argument_spec.rb
spec/rubocop/cop/internal_affairs/redundant_message_argument_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::InternalAffairs::RedundantMessageArgument, :config do context 'when `MSG` is passed' do it 'registers an offense' do expect_offense(<<~RUBY, 'example_cop.rb') add_offense(node, message: MSG) ^^^^^^^^^^^^ Redundant ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/internal_affairs/location_expression_spec.rb
spec/rubocop/cop/internal_affairs/location_expression_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::InternalAffairs::LocationExpression, :config do it 'registers and corrects an offense when using `location.expression`' do expect_offense(<<~RUBY) node.location.expression ^^^^^^^^^^^^^^^^^^^ Use `source_range` instead. RUBY exp...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/internal_affairs/redundant_method_dispatch_node_spec.rb
spec/rubocop/cop/internal_affairs/redundant_method_dispatch_node_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::InternalAffairs::RedundantMethodDispatchNode, :config do it 'registers an offense when using `node.send_node.method_name`' do expect_offense(<<~RUBY) node.send_node.method_name ^^^^^^^^^^ Remove the redundant `send_node`. RUBY ex...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/internal_affairs/redundant_source_range_spec.rb
spec/rubocop/cop/internal_affairs/redundant_source_range_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::InternalAffairs::RedundantSourceRange, :config do it 'does not register an offense when using `source_range.source`' do expect_no_offenses(<<~RUBY) source_range.source RUBY end it 'registers an offense when using `node.source_range.source`...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/internal_affairs/node_type_group_spec.rb
spec/rubocop/cop/internal_affairs/node_type_group_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::InternalAffairs::NodeTypeGroup, :config do it 'registers an offense when using `type?` with entire `numeric` group' do expect_offense(<<~RUBY) node.type?(:int, :float, :rational, :complex) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use `:nu...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/internal_affairs/redundant_expect_offense_arguments_spec.rb
spec/rubocop/cop/internal_affairs/redundant_expect_offense_arguments_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::InternalAffairs::RedundantExpectOffenseArguments, :config do it 'registers an offense when using `expect_no_offenses` with string and single keyword arguments' do expect_offense(<<~RUBY) expect_no_offenses('code', keyword: keyword) ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/internal_affairs/node_first_or_last_argument_spec.rb
spec/rubocop/cop/internal_affairs/node_first_or_last_argument_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::InternalAffairs::NodeFirstOrLastArgument, :config do shared_examples 'registers an offense' do |receiver:, position:, accessor:, dot: '.'| offending_source = "#{receiver}.arguments#{accessor}" correction_source = "#{receiver}#{dot}#{position}_argumen...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/utils/format_string_spec.rb
spec/rubocop/cop/utils/format_string_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Utils::FormatString do def format_sequences(string) RuboCop::Cop::Utils::FormatString.new(string).format_sequences end it 'finds the correct number of fields' do # rubocop:disable RSpec/MultipleExpectations expect(format_sequences('').size).to e...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/first_hash_element_indentation_spec.rb
spec/rubocop/cop/layout/first_hash_element_indentation_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::FirstHashElementIndentation, :config do let(:config) do supported_styles = { 'SupportedStyles' => %w[special_inside_parentheses consistent align_braces] } RuboCop::Config.new('Layout/HashAlignment' => a...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/single_line_block_chain_spec.rb
spec/rubocop/cop/layout/single_line_block_chain_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::SingleLineBlockChain, :config do it 'registers an offense for method call chained on the same line as a block' do expect_offense(<<~RUBY) example.select { |item| item.cond? }.join('-') ^^^^^ Put met...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/multiline_array_line_breaks_spec.rb
spec/rubocop/cop/layout/multiline_array_line_breaks_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::MultilineArrayLineBreaks, :config do context 'when on same line' do it 'does not add any offenses' do expect_no_offenses(<<~RUBY) [1,2,3] RUBY end end context 'when on same line, separate line from brackets' do it...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/def_end_alignment_spec.rb
spec/rubocop/cop/layout/def_end_alignment_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::DefEndAlignment, :config do context 'when EnforcedStyleAlignWith is start_of_line' do let(:cop_config) { { 'EnforcedStyleAlignWith' => 'start_of_line', 'AutoCorrect' => true } } it_behaves_like 'misaligned', <<~RUBY, false def test ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/class_structure_spec.rb
spec/rubocop/cop/layout/class_structure_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::ClassStructure, :config do let(:config) do RuboCop::Config.new( 'Layout/ClassStructure' => { 'ExpectedOrder' => %w[ module_inclusion constants attribute_macros delegate macros ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/space_after_not_spec.rb
spec/rubocop/cop/layout/space_after_not_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::SpaceAfterNot, :config do it 'registers an offense and corrects a single space after !' do expect_offense(<<~RUBY) ! something ^^^^^^^^^^^ Do not leave space between `!` and its argument. RUBY expect_correction(<<~RUBY) ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/trailing_empty_lines_spec.rb
spec/rubocop/cop/layout/trailing_empty_lines_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::TrailingEmptyLines, :config do context 'when EnforcedStyle is final_newline' do let(:cop_config) { { 'EnforcedStyle' => 'final_newline' } } it 'accepts final newline' do expect_no_offenses("x = 0\n") end it 'accepts an empty f...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/line_length_spec.rb
spec/rubocop/cop/layout/line_length_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::LineLength, :config do let(:cop_config) { { 'Max' => 80, 'AllowedPatterns' => nil } } let(:config) do RuboCop::Config.new( 'Layout/LineLength' => { 'URISchemes' => %w[http https] }.merge(cop_config), 'Layout/IndentationStyle' => { ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
true
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/argument_alignment_spec.rb
spec/rubocop/cop/layout/argument_alignment_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::ArgumentAlignment, :config do let(:config) do RuboCop::Config.new('Layout/ArgumentAlignment' => cop_config, 'Layout/IndentationWidth' => { 'Width' => indentation_width }) ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/empty_line_after_multiline_condition_spec.rb
spec/rubocop/cop/layout/empty_line_after_multiline_condition_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::EmptyLineAfterMultilineCondition, :config do it 'registers an offense when no new line after `if` with multiline condition' do expect_offense(<<~RUBY) if multiline && ^^^^^^^^^^^^ Use empty line after multiline condition. ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/empty_lines_after_module_inclusion_spec.rb
spec/rubocop/cop/layout/empty_lines_after_module_inclusion_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::EmptyLinesAfterModuleInclusion, :config do described_class::MODULE_INCLUSION_METHODS.each do |method| it "registers an offense and corrects for code that immediately follows #{method}" do expect_offense(<<~RUBY, method: method) #{me...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/empty_lines_around_exception_handling_keywords_spec.rb
spec/rubocop/cop/layout/empty_lines_around_exception_handling_keywords_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::EmptyLinesAroundExceptionHandlingKeywords, :config do let(:message) { '^{} Extra empty line detected' } shared_examples 'accepts' do |name, code| it "accepts #{name}" do expect_no_offenses(code) end end it 'registers an offense ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/space_after_method_name_spec.rb
spec/rubocop/cop/layout/space_after_method_name_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::SpaceAfterMethodName, :config do it 'registers an offense and corrects def with space before the parenthesis' do expect_offense(<<~RUBY) def func (x) ^ Do not put a space between a method name and the opening parenthesis. ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/space_after_colon_spec.rb
spec/rubocop/cop/layout/space_after_colon_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::SpaceAfterColon, :config do it 'registers an offense and corrects colon without space after it' do expect_offense(<<~RUBY) {a:3} ^ Space missing after colon. RUBY expect_correction(<<~RUBY) {a: 3} RUBY end it...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/empty_lines_spec.rb
spec/rubocop/cop/layout/empty_lines_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::EmptyLines, :config do it 'registers an offense for consecutive empty lines' do expect_offense(<<~RUBY) test = 5 ^{} Extra blank line detected. top RUBY expect_correction(<<~RUBY) test = 5 top RUBY ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/rescue_ensure_alignment_spec.rb
spec/rubocop/cop/layout/rescue_ensure_alignment_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::RescueEnsureAlignment, :config do it 'accepts the modifier form' do expect_no_offenses('test rescue nil') end context 'rescue with begin' do it 'registers an offense' do expect_offense(<<~RUBY) begin something ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/space_after_comma_spec.rb
spec/rubocop/cop/layout/space_after_comma_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::SpaceAfterComma, :config do let(:config) { RuboCop::Config.new('Layout/SpaceInsideHashLiteralBraces' => brace_config) } let(:brace_config) { {} } shared_examples 'ends with an item' do |items, annotation_start, correct_items| it 'registers a...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/first_parameter_indentation_spec.rb
spec/rubocop/cop/layout/first_parameter_indentation_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::FirstParameterIndentation, :config do let(:config) do supported_styles = { 'SupportedStyles' => %w[consistent align_parentheses] } RuboCop::Config.new('Layout/FirstParameterIndentation' => cop_config.merge(supported_st...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/space_inside_range_literal_spec.rb
spec/rubocop/cop/layout/space_inside_range_literal_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::SpaceInsideRangeLiteral, :config do it 'registers an offense for space inside .. literal' do expect_offense(<<~RUBY) 1 .. 2 ^^^^^^ Space inside range literal. 1.. 2 ^^^^^ Space inside range literal. 1 ..2 ^^^^^...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/indentation_consistency_spec.rb
spec/rubocop/cop/layout/indentation_consistency_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::IndentationConsistency, :config do let(:cop_config) { { 'EnforcedStyle' => 'normal' } } context 'with top-level code' do it 'accepts an empty expression string interpolation' do expect_no_offenses(<<~'RUBY') "#{}" RUBY ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/space_inside_array_percent_literal_spec.rb
spec/rubocop/cop/layout/space_inside_array_percent_literal_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::SpaceInsideArrayPercentLiteral, :config do %w[i I w W].each do |type| [%w[{ }], %w[( )], %w([ ]), %w[! !]].each do |(ldelim, rdelim)| context "for #{type} type and #{[ldelim, rdelim]} delimiters" do define_method(:code_example) { |c...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/end_of_line_spec.rb
spec/rubocop/cop/layout/end_of_line_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::EndOfLine, :config do include EncodingHelper shared_examples 'all configurations' do it 'accepts an empty file' do expect_no_offenses('') end end shared_examples 'iso-8859-15' do |eol| it 'can inspect non-UTF-8 encoded sourc...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/space_before_brackets_spec.rb
spec/rubocop/cop/layout/space_before_brackets_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::SpaceBeforeBrackets, :config do context 'when referencing' do it 'registers an offense and corrects when using space between lvar receiver and left brackets' do expect_offense(<<~RUBY) collection = do_something collection [i...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/hash_alignment_spec.rb
spec/rubocop/cop/layout/hash_alignment_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::HashAlignment, :config do let(:config) do RuboCop::Config.new( 'Layout/HashAlignment' => default_cop_config.merge(cop_config), 'Layout/ArgumentAlignment' => argument_alignment_config ) end let(:default_cop_config) { { 'Enforc...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
true
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/space_inside_percent_literal_delimiters_spec.rb
spec/rubocop/cop/layout/space_inside_percent_literal_delimiters_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::SpaceInsidePercentLiteralDelimiters, :config do let(:message) { 'Do not use spaces inside percent literal delimiters.' } %w[i I w W x].each do |type| [%w[{ }], %w[( )], %w([ ]), %w[! !]].each do |(ldelim, rdelim)| context "for #{type} ty...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/heredoc_indentation_spec.rb
spec/rubocop/cop/layout/heredoc_indentation_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::HeredocIndentation, :config do let(:allow_heredoc) { true } let(:other_cops) { { 'Layout/LineLength' => { 'Max' => 5, 'AllowHeredoc' => allow_heredoc } } } shared_examples 'all heredoc type' do |quote| context "quoted by #{quote}" do i...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/multiline_method_parameter_line_breaks_spec.rb
spec/rubocop/cop/layout/multiline_method_parameter_line_breaks_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::MultilineMethodParameterLineBreaks, :config do context 'when one parameter on same line' do it 'does not add any offenses' do expect_no_offenses(<<~RUBY) def taz(abc) end RUBY end end context 'when there are n...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/empty_lines_around_block_body_spec.rb
spec/rubocop/cop/layout/empty_lines_around_block_body_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::EmptyLinesAroundBlockBody, :config do let(:beginning_offense_annotation) { '^{} Extra empty line detected at block body beginning.' } # Test blocks using both {} and do..end [%w[{ }], %w[do end]].each do |open, close| context "when EnforcedS...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/empty_comment_spec.rb
spec/rubocop/cop/layout/empty_comment_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::EmptyComment, :config do let(:cop_config) { { 'AllowBorderComment' => true, 'AllowMarginComment' => true } } it 'registers an offense and corrects using single line empty comment' do expect_offense(<<~RUBY) # ^ Source code comment ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/space_around_operators_spec.rb
spec/rubocop/cop/layout/space_around_operators_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::SpaceAroundOperators, :config do let(:config) do RuboCop::Config .new( 'AllCops' => { 'TargetRubyVersion' => target_ruby_version }, 'Layout/HashAlignment' => { 'EnforcedHashRocketStyle' => hash_style }, 'Layout/Space...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
true
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/indentation_width_spec.rb
spec/rubocop/cop/layout/indentation_width_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::IndentationWidth, :config do let(:config) do RuboCop::Config.new( 'Layout/IndentationWidth' => cop_config, 'Layout/AccessModifierIndentation' => access_modifier_config, 'Layout/IndentationConsistency' => consistency_config, ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
true
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/multiline_operation_indentation_spec.rb
spec/rubocop/cop/layout/multiline_operation_indentation_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::MultilineOperationIndentation, :config do let(:config) do merged = RuboCop::ConfigLoader .default_configuration['Layout/MultilineOperationIndentation'] .merge(cop_config) .merge('IndentationWidth' => cop_ind...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/closing_parenthesis_indentation_spec.rb
spec/rubocop/cop/layout/closing_parenthesis_indentation_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::ClosingParenthesisIndentation, :config do context 'for method calls' do context 'with line break before 1st parameter' do it 'registers an offense for misaligned )' do expect_offense(<<~RUBY) some_method( a ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/space_around_block_parameters_spec.rb
spec/rubocop/cop/layout/space_around_block_parameters_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::SpaceAroundBlockParameters, :config do shared_examples 'common behavior' do it 'accepts an empty block' do expect_no_offenses('{}.each {}') end it 'skips lambda without args' do expect_no_offenses('->() { puts "a" }') end...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/indentation_style_spec.rb
spec/rubocop/cop/layout/indentation_style_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::IndentationStyle, :config do let(:config) do supported_styles = { 'SupportedStyles' => %w[spaces tabs] } RuboCop::Config.new( 'Layout/IndentationWidth' => { 'Width' => 2 }, 'Layout/IndentationStyle' => cop_config.merge(supported_s...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/first_array_element_indentation_spec.rb
spec/rubocop/cop/layout/first_array_element_indentation_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::FirstArrayElementIndentation, :config do let(:config) do supported_styles = { 'SupportedStyles' => %w[special_inside_parentheses consistent align_brackets] } RuboCop::Config.new('Layout/FirstArrayElemen...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/empty_lines_around_method_body_spec.rb
spec/rubocop/cop/layout/empty_lines_around_method_body_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::EmptyLinesAroundMethodBody, :config do let(:beginning_offense_annotation) { '^{} Extra empty line detected at method body beginning.' } let(:end_offense_annotation) { '^{} Extra empty line detected at method body end.' } it 'registers an offense...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/multiline_assignment_layout_spec.rb
spec/rubocop/cop/layout/multiline_assignment_layout_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::MultilineAssignmentLayout, :config do let(:supported_types) { %w[if] } let(:cop_config) { { 'EnforcedStyle' => enforced_style, 'SupportedTypes' => supported_types } } context 'new_line style' do let(:enforced_style) { 'new_line' } it '...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/end_alignment_spec.rb
spec/rubocop/cop/layout/end_alignment_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::EndAlignment, :config do let(:cop_config) { { 'EnforcedStyleAlignWith' => 'keyword', 'AutoCorrect' => true } } it_behaves_like 'aligned', "\xef\xbb\xbfclass", 'Test', 'end' it_behaves_like 'aligned', 'class', 'Test', 'end' it_be...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/space_after_semicolon_spec.rb
spec/rubocop/cop/layout/space_after_semicolon_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::SpaceAfterSemicolon, :config do let(:config) { RuboCop::Config.new('Layout/SpaceInsideBlockBraces' => brace_config) } let(:brace_config) { {} } it 'registers an offense and corrects semicolon without space after it' do expect_offense(<<~RUBY...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/space_inside_hash_literal_braces_spec.rb
spec/rubocop/cop/layout/space_inside_hash_literal_braces_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::SpaceInsideHashLiteralBraces, :config do let(:cop_config) { { 'EnforcedStyle' => 'space' } } context 'with space inside empty braces not allowed' do let(:cop_config) { { 'EnforcedStyleForEmptyBraces' => 'no_space' } } it 'accepts empty br...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/block_alignment_spec.rb
spec/rubocop/cop/layout/block_alignment_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::BlockAlignment, :config do let(:cop_config) { { 'EnforcedStyleAlignWith' => 'either' } } context 'when the block has no arguments' do it 'registers an offense for mismatched block end' do expect_offense(<<~RUBY) test do ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/trailing_whitespace_spec.rb
spec/rubocop/cop/layout/trailing_whitespace_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::TrailingWhitespace, :config do let(:cop_config) { { 'AllowInHeredoc' => false } } it 'registers an offense for a line ending with space' do expect_offense(<<~RUBY) x = 0#{trailing_whitespace} ^ Trailing whitespace detected. ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/initial_indentation_spec.rb
spec/rubocop/cop/layout/initial_indentation_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::InitialIndentation, :config do it 'registers an offense for indented method definition' do expect_offense(<<-RUBY.strip_margin('|')) | def f | ^^^ Indentation of first line in file detected. | end RUBY expect_correction(<<...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/space_inside_array_literal_brackets_spec.rb
spec/rubocop/cop/layout/space_inside_array_literal_brackets_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::SpaceInsideArrayLiteralBrackets, :config do let(:no_space_in_empty_message) { 'Do not use space inside empty array brackets.' } let(:no_space_message) { 'Do not use space inside array brackets.' } let(:one_space_message) { 'Use one space inside e...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/space_inside_block_braces_spec.rb
spec/rubocop/cop/layout/space_inside_block_braces_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::SpaceInsideBlockBraces, :config do let(:supported_styles) { %w[space no_space] } let(:cop_config) do { 'EnforcedStyle' => 'space', 'SupportedStyles' => supported_styles, 'SpaceBeforeBlockParameters' => true } end cont...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/empty_lines_around_class_body_spec.rb
spec/rubocop/cop/layout/empty_lines_around_class_body_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::EmptyLinesAroundClassBody, :config do let(:extra_begin) { 'Extra empty line detected at class body beginning.' } let(:extra_end) { 'Extra empty line detected at class body end.' } let(:missing_begin) { 'Empty line missing at class body beginning....
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/condition_position_spec.rb
spec/rubocop/cop/layout/condition_position_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::ConditionPosition, :config do %w[if unless while until].each do |keyword| it 'registers an offense and corrects for condition on the next line' do expect_offense(<<~RUBY) #{keyword} x == 10 ^^^^^^^ Place the conditio...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/space_before_semicolon_spec.rb
spec/rubocop/cop/layout/space_before_semicolon_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::SpaceBeforeSemicolon, :config do let(:config) { RuboCop::Config.new('Layout/SpaceInsideBlockBraces' => brace_config) } let(:brace_config) { {} } it 'registers an offense and corrects space before semicolon' do expect_offense(<<~RUBY) x...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/case_indentation_spec.rb
spec/rubocop/cop/layout/case_indentation_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::CaseIndentation, :config do let(:config) do merged = RuboCop::ConfigLoader.default_configuration['Layout/CaseIndentation'].merge(cop_config) RuboCop::Config.new('Layout/CaseIndentation' => merged, 'Layout/IndentationWi...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/extra_spacing_spec.rb
spec/rubocop/cop/layout/extra_spacing_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::ExtraSpacing, :config do shared_examples 'common behavior' do it 'registers an offense and corrects alignment with token not preceded by space' do # The = and the ( are on the same column, but this is not for alignment, # it's just a ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/first_hash_element_line_break_spec.rb
spec/rubocop/cop/layout/first_hash_element_line_break_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::FirstHashElementLineBreak, :config do it 'registers an offense and corrects elements listed on the first line' do expect_offense(<<~RUBY) a = { a: 1, ^^^^ Add a line break before the first element of a multi-line hash. ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/space_around_method_call_operator_spec.rb
spec/rubocop/cop/layout/space_around_method_call_operator_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::SpaceAroundMethodCallOperator, :config do shared_examples 'offense' do |name, offense, correction| it "registers an offense and corrects when #{name}" do expect_offense(offense) expect_correction(correction) end end context ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/assignment_indentation_spec.rb
spec/rubocop/cop/layout/assignment_indentation_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::AssignmentIndentation, :config do let(:config) do RuboCop::Config.new('Layout/AssignmentIndentation' => { 'IndentationWidth' => cop_indent }, 'Layout/IndentationWidth' => {...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/leading_empty_lines_spec.rb
spec/rubocop/cop/layout/leading_empty_lines_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::LeadingEmptyLines, :config do it 'allows an empty input' do expect_no_offenses('') end it 'allows blank lines without any comments or code' do expect_no_offenses("\n") end it 'accepts not having a blank line before a class' do e...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/multiline_hash_brace_layout_spec.rb
spec/rubocop/cop/layout/multiline_hash_brace_layout_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::MultilineHashBraceLayout, :config do let(:cop_config) { { 'EnforcedStyle' => 'symmetrical' } } it 'ignores implicit hashes' do expect_no_offenses(<<~RUBY) foo(a: 1, b: 2) RUBY end it 'ignores single-line hashes' do exp...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/multiline_method_definition_brace_layout_spec.rb
spec/rubocop/cop/layout/multiline_method_definition_brace_layout_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::MultilineMethodDefinitionBraceLayout, :config do let(:cop_config) { { 'EnforcedStyle' => 'symmetrical' } } it 'ignores implicit defs' do expect_no_offenses(<<~RUBY) def foo a: 1, b: 2 end RUBY end it 'ignores single-...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/space_inside_reference_brackets_spec.rb
spec/rubocop/cop/layout/space_inside_reference_brackets_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::SpaceInsideReferenceBrackets, :config do context 'with space inside empty brackets not allowed' do let(:cop_config) { { 'EnforcedStyleForEmptyBrackets' => 'no_space' } } it 'accepts empty brackets with no space inside' do expect_no_off...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/multiline_method_argument_line_breaks_spec.rb
spec/rubocop/cop/layout/multiline_method_argument_line_breaks_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::MultilineMethodArgumentLineBreaks, :config do context 'with one argument on same line as the method call' do it 'does not add any offenses' do expect_no_offenses(<<~RUBY) taz("abc") RUBY end end context 'when bracket ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/begin_end_alignment_spec.rb
spec/rubocop/cop/layout/begin_end_alignment_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::BeginEndAlignment, :config do let(:cop_config) { { 'EnforcedStyleAlignWith' => 'begin' } } it_behaves_like 'aligned', 'begin', '', 'end' it_behaves_like 'misaligned', <<~RUBY, false begin end ^^^ `end` at 2, 2 is not aligned wit...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/empty_lines_around_module_body_spec.rb
spec/rubocop/cop/layout/empty_lines_around_module_body_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::EmptyLinesAroundModuleBody, :config do let(:extra_begin) { 'Extra empty line detected at module body beginning.' } let(:extra_end) { 'Extra empty line detected at module body end.' } let(:missing_begin) { 'Empty line missing at module body beginn...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/empty_lines_around_attribute_accessor_spec.rb
spec/rubocop/cop/layout/empty_lines_around_attribute_accessor_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::EmptyLinesAroundAttributeAccessor, :config do it 'registers an offense and corrects for code that immediately follows accessor' do expect_offense(<<~RUBY) attr_accessor :foo ^^^^^^^^^^^^^^^^^^ Add an empty line after attribute accesso...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/empty_lines_around_begin_body_spec.rb
spec/rubocop/cop/layout/empty_lines_around_begin_body_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::EmptyLinesAroundBeginBody, :config do shared_examples 'accepts' do |name, code| it "accepts #{name}" do expect_no_offenses(code) end end it 'registers an offense for begin body starting with a blank' do expect_offense(<<~RUBY) ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/line_continuation_spacing_spec.rb
spec/rubocop/cop/layout/line_continuation_spacing_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::LineContinuationSpacing, :config do context 'EnforcedStyle: space' do let(:cop_config) { { 'EnforcedStyle' => 'space' } } it 'registers an offense when no space in front of backslash' do expect_offense(<<~'RUBY') if 2 + 2\ ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/empty_lines_around_access_modifier_spec.rb
spec/rubocop/cop/layout/empty_lines_around_access_modifier_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::EmptyLinesAroundAccessModifier, :config do context 'EnforcedStyle is `around`' do let(:cop_config) { { 'EnforcedStyle' => 'around' } } %w[private protected public module_function].each do |access_modifier| it "requires blank line befor...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/first_array_element_line_break_spec.rb
spec/rubocop/cop/layout/first_array_element_line_break_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::FirstArrayElementLineBreak, :config do context 'elements listed on the first line' do it 'registers and corrects the offense' do expect_offense(<<~RUBY) a = [:a, ^^ Add a line break before the first element of a multi-l...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/space_before_block_braces_spec.rb
spec/rubocop/cop/layout/space_before_block_braces_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::SpaceBeforeBlockBraces, :config do let(:cop_config) { { 'EnforcedStyle' => 'space' } } context 'when EnforcedStyle is space' do it 'accepts braces surrounded by spaces' do expect_no_offenses('each { puts }') end it 'registers an...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/empty_line_between_defs_spec.rb
spec/rubocop/cop/layout/empty_line_between_defs_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::EmptyLineBetweenDefs, :config do let(:cop_config) { { 'AllowAdjacentOneLineDefs' => false } } it 'finds offenses in inner classes' do expect_offense(<<~RUBY) class K def m end class J def n en...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/closing_heredoc_indentation_spec.rb
spec/rubocop/cop/layout/closing_heredoc_indentation_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::ClosingHeredocIndentation, :config do let(:config) { RuboCop::Config.new('Layout/ClosingHeredocIndentation' => cop_config) } let(:cop_config) { { 'Enabled' => true } } it 'accepts correctly indented closing heredoc' do expect_no_offenses(<<~...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/space_before_comment_spec.rb
spec/rubocop/cop/layout/space_before_comment_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::SpaceBeforeComment, :config do it 'registers an offense and corrects missing space before an EOL comment' do expect_offense(<<~RUBY) a += 1# increment ^^^^^^^^^^^ Put a space before an end-of-line comment. RUBY expect_c...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/first_method_parameter_line_break_spec.rb
spec/rubocop/cop/layout/first_method_parameter_line_break_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::FirstMethodParameterLineBreak, :config do it 'registers an offense and corrects params listed on the first line' do expect_offense(<<~RUBY) def foo(bar, ^^^ Add a line break before the first parameter of a multi-line method pa...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/heredoc_argument_closing_parenthesis_spec.rb
spec/rubocop/cop/layout/heredoc_argument_closing_parenthesis_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::HeredocArgumentClosingParenthesis, :config do shared_examples 'correct cases' do |dot| context 'correct cases' do it 'accepts simple correct case' do expect_no_offenses(<<~RUBY) foo#{dot}bar(<<-SQL) foo ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/first_method_argument_line_break_spec.rb
spec/rubocop/cop/layout/first_method_argument_line_break_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::FirstMethodArgumentLineBreak, :config do context 'args listed on the first line' do it 'registers an offense and corrects' do expect_offense(<<~RUBY) foo(bar, ^^^ Add a line break before the first argument of a multi-lin...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/line_continuation_leading_space_spec.rb
spec/rubocop/cop/layout/line_continuation_leading_space_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::LineContinuationLeadingSpace, :config do context 'EnforcedStyle: trailing' do let(:cop_config) { { 'EnforcedStyle' => 'trailing' } } it 'registers an offense when 2nd line has one leading space' do expect_offense(<<~'RUBY') 'th...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/space_inside_string_interpolation_spec.rb
spec/rubocop/cop/layout/space_inside_string_interpolation_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::SpaceInsideStringInterpolation, :config do context 'when EnforcedStyle is no_space' do let(:cop_config) { { 'EnforcedStyle' => 'no_space' } } context 'for ill-formatted string interpolations' do it 'registers offenses and autocorrects'...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/multiline_hash_key_line_breaks_spec.rb
spec/rubocop/cop/layout/multiline_hash_key_line_breaks_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::MultilineHashKeyLineBreaks, :config do context 'with line break after opening bracket' do context 'when on different lines than brackets but keys on one' do it 'does not add any offenses' do expect_no_offenses(<<~RUBY) { ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/redundant_line_break_spec.rb
spec/rubocop/cop/layout/redundant_line_break_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::RedundantLineBreak, :config do let(:config) do RuboCop::Config.new('Layout/LineLength' => { 'Enabled' => line_length_enabled, 'Max' => max_line_length }, 'Layout/RedundantL...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/multiline_method_call_brace_layout_spec.rb
spec/rubocop/cop/layout/multiline_method_call_brace_layout_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::MultilineMethodCallBraceLayout, :config do let(:enforced_style) { 'symmetrical' } let(:cop_config) { { 'EnforcedStyle' => enforced_style } } it 'ignores implicit calls' do expect_no_offenses(<<~RUBY) foo 1, 2 RUBY end it...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/line_end_string_concatenation_indentation_spec.rb
spec/rubocop/cop/layout/line_end_string_concatenation_indentation_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::LineEndStringConcatenationIndentation, :config do let(:config) do merged = RuboCop::ConfigLoader .default_configuration['Layout/LineEndStringConcatenationIndentation'] .merge(cop_config) .merge('Enabled' => ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/empty_line_after_magic_comment_spec.rb
spec/rubocop/cop/layout/empty_line_after_magic_comment_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::EmptyLineAfterMagicComment, :config do it 'registers an offense for code that immediately follows comment' do expect_offense(<<~RUBY) # frozen_string_literal: true class Foo; end ^ Add an empty line after magic comments. RUB...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/space_in_lambda_literal_spec.rb
spec/rubocop/cop/layout/space_in_lambda_literal_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::SpaceInLambdaLiteral, :config do context 'when configured to enforce spaces' do let(:cop_config) { { 'EnforcedStyle' => 'require_space' } } it 'registers an offense and corrects no space between -> and (' do expect_offense(<<~RUBY) ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/array_alignment_spec.rb
spec/rubocop/cop/layout/array_alignment_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::ArrayAlignment, :config do let(:config) do RuboCop::Config.new('Layout/ArrayAlignment' => cop_config, 'Layout/IndentationWidth' => { 'Width' => indentation_width }) end ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/block_end_newline_spec.rb
spec/rubocop/cop/layout/block_end_newline_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::BlockEndNewline, :config do it 'accepts a one-liner' do expect_no_offenses('test do foo end') end it 'accepts multiline blocks with newlines before the end' do expect_no_offenses(<<~RUBY) test do foo end RUBY en...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/space_around_keyword_spec.rb
spec/rubocop/cop/layout/space_around_keyword_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::SpaceAroundKeyword, :config do shared_examples 'missing before' do |highlight, expr, correct| it "registers an offense for missing space before keyword in `#{expr}`" do h_index = expr.index(highlight) expect_offense(<<~RUBY) #...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/space_around_equals_in_parameter_default_spec.rb
spec/rubocop/cop/layout/space_around_equals_in_parameter_default_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::SpaceAroundEqualsInParameterDefault, :config do context 'when EnforcedStyle is space' do let(:cop_config) { { 'EnforcedStyle' => 'space' } } it 'registers an offense and corrects default value assignment without space' do expect_offens...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/space_before_first_arg_spec.rb
spec/rubocop/cop/layout/space_before_first_arg_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::SpaceBeforeFirstArg, :config do let(:cop_config) { { 'AllowForAlignment' => true } } let(:message) { 'Put one space between the method name and the first argument.' } context 'for method calls without parentheses' do it 'registers an offense...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false