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
spec/rubocop/cop/lint/multiple_comparison_spec.rb
Ruby
mit
12,856
master
1,069
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::MultipleComparison, :config do shared_examples 'Check to use two comparison operator' do |operator1, operator2| it "registers an offense for x #{operator1} y #{operator2} z" do expect_offense(<<~RUBY, operator1: operator1, operator2: operator...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/duplicate_magic_comment_spec.rb
Ruby
mit
12,856
master
2,403
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::DuplicateMagicComment, :config do it 'registers an offense when frozen magic comments are duplicated' do expect_offense(<<~RUBY) # frozen_string_literal: true # frozen_string_literal: true ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Duplicate m...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/empty_class_spec.rb
Ruby
mit
12,856
master
1,963
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::EmptyClass, :config do let(:cop_config) { { 'AllowComments' => false } } it 'registers an offense for empty class' do expect_offense(<<~RUBY) class Foo ^^^^^^^^^ Empty class detected. end RUBY end it 'registers an offe...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/safe_navigation_with_empty_spec.rb
Ruby
mit
12,856
master
773
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::SafeNavigationWithEmpty, :config do context 'in a conditional' do it 'registers an offense and corrects on `&.empty?`' do expect_offense(<<~RUBY) return unless foo&.empty? ^^^^^^^^^^^ Avoid calling `empty?` with ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/circular_argument_reference_spec.rb
Ruby
mit
12,856
master
4,539
# frozen_string_literal: true # Run test with Ruby 3.4 because this cop cannot handle invalid syntax between Ruby 2.7 and 3.3. RSpec.describe RuboCop::Cop::Lint::CircularArgumentReference, :config, :ruby34 do describe 'circular argument references in ordinal arguments' do context 'when the method contains a circ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/empty_interpolation_spec.rb
Ruby
mit
12,856
master
2,705
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::EmptyInterpolation, :config do it 'registers an offense and corrects #{} in interpolation' do expect_offense(<<~'RUBY') "this is the #{}" ^^^ Empty interpolation detected. RUBY expect_correction(<<~RUBY) "thi...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/safe_navigation_chain_spec.rb
Ruby
mit
12,856
master
17,791
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::SafeNavigationChain, :config do shared_examples 'accepts' do |name, code| it "accepts usages of #{name}" do expect_no_offenses(code) end end context 'TargetRubyVersion >= 2.3', :ruby23 do [ ['ordinary method chain', 'x.foo....
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/useless_rescue_spec.rb
Ruby
mit
12,856
master
2,703
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::UselessRescue, :config do it 'registers an offense when single `rescue` which only anonymously reraises' do expect_offense(<<~RUBY) def foo do_something rescue ^^^^^^ Useless `rescue` detected. raise end ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/rand_one_spec.rb
Ruby
mit
12,856
master
1,253
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::RandOne, :config do shared_examples 'offenses' do |source| describe source do it 'registers an offense' do expect_offense(<<~RUBY, source: source) %{source} ^{source} `#{source}` always returns `0`. [...] R...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/require_range_parentheses_spec.rb
Ruby
mit
12,856
master
1,705
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::RequireRangeParentheses, :config do it 'registers an offense when the end of the range (`..`) is line break' do expect_offense(<<~RUBY) 42.. ^^^^ Wrap the endless range literal `42..` to avoid precedence ambiguity. do_something ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/data_define_override_spec.rb
Ruby
mit
12,856
master
2,297
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::DataDefineOverride, :config do it 'registers an offense using `Data.define(symbol)`' do expect_offense(<<~RUBY) Bad = Data.define(:members) ^^^^^^^^ `:members` member overrides `Data#members` and it may be unexpected. ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/require_parentheses_spec.rb
Ruby
mit
12,856
master
3,119
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::RequireParentheses, :config do it 'registers an offense for missing parentheses around expression with && operator' do expect_offense(<<~RUBY) if day.is? 'monday' && month == :jan ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use parentheses in ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/duplicate_regexp_character_class_element_spec.rb
Ruby
mit
12,856
master
4,863
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::DuplicateRegexpCharacterClassElement, :config do context 'with a repeated character class element' do it 'registers an offense and corrects' do expect_offense(<<~RUBY) foo = /[xyx]/ ^ Duplicate element inside regexp ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/boolean_symbol_spec.rb
Ruby
mit
12,856
master
2,407
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::BooleanSymbol, :config do it 'registers an offense when using `:true`' do expect_offense(<<~RUBY) :true ^^^^^ Symbol with a boolean name - you probably meant to use `true`. RUBY expect_correction(<<~RUBY) true RUBY ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/ambiguous_block_association_spec.rb
Ruby
mit
12,856
master
7,069
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::AmbiguousBlockAssociation, :config do shared_examples 'accepts' do |code| it 'does not register an offense' do expect_no_offenses(code) end end it_behaves_like 'accepts', 'foo == bar { baz a }' it_behaves_like 'accepts', 'foo ->(a)...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/each_with_object_argument_spec.rb
Ruby
mit
12,856
master
1,606
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::EachWithObjectArgument, :config do it 'registers an offense for fixnum argument' do expect_offense(<<~RUBY) collection.each_with_object(0) { |e, a| a + e } ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The argument to each_with_object cannot be immuta...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/useless_ruby2_keywords_spec.rb
Ruby
mit
12,856
master
5,680
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::UselessRuby2Keywords, :config do context 'when `ruby2_keywords` is given a `def` node' do it 'registers an offense for a method without arguments' do expect_offense(<<~RUBY) ruby2_keywords def foo ^^^^^^^^^^^^^^ `ruby2_keyword...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/rescue_type_spec.rb
Ruby
mit
12,856
master
4,799
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::RescueType, :config do it 'accepts rescue modifier' do expect_no_offenses('foo rescue nil') end it 'accepts rescuing nothing' do expect_no_offenses(<<~RUBY) begin foo rescue bar end RUBY end it 'a...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/else_layout_spec.rb
Ruby
mit
12,856
master
3,428
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::ElseLayout, :config do it 'registers an offense and corrects for expr on same line as else' do expect_offense(<<~RUBY) if something test else ala ^^^ Odd `else` layout detected. Did you mean to use `elsif`? so...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/useless_constant_scoping_spec.rb
Ruby
mit
12,856
master
4,344
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::UselessConstantScoping, :config do it 'registers an offense when using constant after `private` access modifier' do expect_offense(<<~RUBY) class Foo private CONST = 42 ^^^^^^^^^^ Useless `private` access modifier for ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/require_relative_self_path_spec.rb
Ruby
mit
12,856
master
1,988
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::RequireRelativeSelfPath, :config do it 'registers an offense when using `require_relative` with self file path argument' do expect_offense(<<~RUBY, 'foo.rb') require_relative 'foo' ^^^^^^^^^^^^^^^^^^^^^^ Remove the `require_relative` th...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/non_deterministic_require_order_spec.rb
Ruby
mit
12,856
master
12,081
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::NonDeterministicRequireOrder, :config do context 'when requiring files' do context 'when Ruby 3.0 or higher', :ruby30 do context 'with `Dir[]`' do it 'does not register an offense' do expect_no_offenses(<<~RUBY) ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/raise_exception_spec.rb
Ruby
mit
12,856
master
4,356
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::RaiseException, :config do let(:cop_config) { { 'AllowedImplicitNamespaces' => ['Gem'] } } it 'registers an offense and corrects for `raise` with `::Exception`' do expect_offense(<<~RUBY) raise ::Exception ^^^^^^^^^^^ Use `Stan...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/empty_expression_spec.rb
Ruby
mit
12,856
master
2,528
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::EmptyExpression, :config do context 'when used as a standalone expression' do it 'registers an offense' do expect_offense(<<~RUBY) () ^^ Avoid empty expressions. RUBY end context 'with nested empty expressions' ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/deprecated_open_ssl_constant_spec.rb
Ruby
mit
12,856
master
6,843
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::DeprecatedOpenSSLConstant, :config do it 'registers an offense with cipher constant and two arguments and corrects' do expect_offense(<<~RUBY) OpenSSL::Cipher::AES.new(128, :GCM) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use `OpenSSL::Cipher....
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/ineffective_access_modifier_spec.rb
Ruby
mit
12,856
master
3,161
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::IneffectiveAccessModifier, :config do context 'when `private` is applied to a class method' do it 'registers an offense' do expect_offense(<<~RUBY) class C private def self.method ^^^ `private` (on line ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/duplicate_require_spec.rb
Ruby
mit
12,856
master
2,924
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::DuplicateRequire, :config do it 'registers and corrects an offense when duplicate `require` is detected' do expect_offense(<<~RUBY) require 'foo' require 'foo' ^^^^^^^^^^^^^ Duplicate `require` detected. RUBY expect_corre...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/useless_method_definition_spec.rb
Ruby
mit
12,856
master
5,575
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::UselessMethodDefinition, :config do it 'does not register an offense for empty constructor' do expect_no_offenses(<<~RUBY) class Foo def initialize(arg1, arg2) end end RUBY end it 'does not register an offense f...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/useless_times_spec.rb
Ruby
mit
12,856
master
7,253
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::UselessTimes, :config do it 'registers an offense and corrects with 0.times' do expect_offense(<<~RUBY) 0.times { something } ^^^^^^^^^^^^^^^^^^^^^ Useless call to `0.times` detected. RUBY expect_correction('') end it 'reg...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/to_json_spec.rb
Ruby
mit
12,856
master
574
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::ToJSON, :config do it 'registers an offense and corrects using `#to_json` without arguments' do expect_offense(<<~RUBY) def to_json ^^^^^^^^^^^ `#to_json` requires an optional argument to be parsable via JSON.generate(obj). end ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/useless_assignment_spec.rb
Ruby
mit
12,856
master
61,618
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::UselessAssignment, :config do context 'when a variable is assigned and assigned again in a modifier condition' do it 'accepts with parentheses' do expect_no_offenses(<<~RUBY) a = nil puts a if (a = 123) RUBY end ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/redundant_type_conversion_spec.rb
Ruby
mit
12,856
master
13,796
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::RedundantTypeConversion, :config do shared_examples 'accepted' do |source| it "does not register an offense on `#{source}`" do expect_no_offenses(source) end end shared_examples 'offense' do |conversion, receiver, suffix = ''| it...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/deprecated_constants_spec.rb
Ruby
mit
12,856
master
6,146
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::DeprecatedConstants, :config do let(:cop_config) do { 'DeprecatedConstants' => { 'NIL' => { 'Alternative' => 'nil', 'DeprecatedVersion' => '2.4' }, 'TRUE' => { 'Alternative' => 'true', 'DeprecatedVersion' => '2.4' }, '...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/underscore_prefixed_variable_name_spec.rb
Ruby
mit
12,856
master
4,536
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::UnderscorePrefixedVariableName, :config do let(:cop_config) { { 'AllowKeywordBlockArguments' => false } } context 'when an underscore-prefixed variable is used' do it 'registers an offense' do expect_offense(<<~RUBY) def some_metho...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/ambiguous_regexp_literal_spec.rb
Ruby
mit
12,856
master
7,139
# frozen_string_literal: true # FIXME: https://github.com/ruby/prism/issues/2513 RSpec.describe RuboCop::Cop::Lint::AmbiguousRegexpLiteral, :config do shared_examples 'with a regexp literal in the first argument' do context 'without parentheses' do it 'registers an offense and corrects when single argument...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/useless_default_value_argument_spec.rb
Ruby
mit
12,856
master
6,776
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::UselessDefaultValueArgument, :config do context 'with `fetch`' do it 'registers an offense for `x.fetch(key, default_value) { block_value }`' do expect_offense(<<~RUBY) x.fetch(key, default_value) { block_value } ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/redundant_cop_disable_directive_spec.rb
Ruby
mit
12,856
master
26,364
# frozen_string_literal: true require 'rubocop/cop/legacy/corrector' RSpec.describe RuboCop::Cop::Lint::RedundantCopDisableDirective, :config do describe '.check' do let(:offenses) { [] } let(:cop) { cop_class.new(config, cop_options, offenses) } context 'when there are no disabled lines' do let(...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/non_atomic_file_operation_spec.rb
Ruby
mit
12,856
master
12,282
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::NonAtomicFileOperation, :config do it 'registers an offense when use `FileTest.exist?` before creating file' do expect_offense(<<~RUBY) unless FileTest.exist?(path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Remove unnecessary existence check `FileTe...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/self_assignment_spec.rb
Ruby
mit
12,856
master
16,222
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::SelfAssignment, :config do it 'registers an offense when using local var self-assignment' do expect_offense(<<~RUBY) foo = foo ^^^^^^^^^ Self-assignment detected. RUBY end it 'does not register an offense when using local var a...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/debugger_spec.rb
Ruby
mit
12,856
master
18,689
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::Debugger, :config do context 'with the DebuggerMethods configuration' do let(:cop_config) { { 'DebuggerMethods' => %w[custom_debugger] } } it 'does not register an offense for a byebug call' do expect_no_offenses(<<~RUBY) byebug ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/empty_conditional_body_spec.rb
Ruby
mit
12,856
master
12,015
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::EmptyConditionalBody, :config do let(:cop_config) { { 'AllowComments' => true } } it 'registers an offense for missing `if` body' do expect_offense(<<~RUBY) if condition ^^^^^^^^^^^^ Avoid `if` branches without a body. end ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/useless_numeric_operation_spec.rb
Ruby
mit
12,856
master
3,511
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::UselessNumericOperation, :config do it 'registers an offense when 0 is added to a variable' do expect_offense(<<~RUBY) x + 0 ^^^^^ Do not apply inconsequential numeric operations to variables. RUBY expect_correction(<<~RUBY) ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/redundant_with_object_spec.rb
Ruby
mit
12,856
master
4,225
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::RedundantWithObject, :config do it 'registers an offense and corrects when using `ary.each_with_object { |v| v }`' do expect_offense(<<~RUBY) ary.each_with_object([]) { |v| v } ^^^^^^^^^^^^^^^^^^^^ Use `each` instead of `each_with_o...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/useless_setter_call_spec.rb
Ruby
mit
12,856
master
7,062
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::UselessSetterCall, :config do context 'with method ending with setter call on local object' do it 'registers an offense and corrects' do expect_offense(<<~RUBY) def test top = Top.new top.attr = 5 ^^^ Use...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/float_comparison_spec.rb
Ruby
mit
12,856
master
4,905
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::FloatComparison, :config do it 'registers an offense when comparing with float' do expect_offense(<<~RUBY) x == 0.1 ^^^^^^^^ Avoid equality comparisons of floats as they are unreliable. 0.1 == x ^^^^^^^^ Avoid equality compa...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/inherit_exception_spec.rb
Ruby
mit
12,856
master
6,328
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::InheritException, :config do context 'when class inherits from `Exception`' do context 'with enforced style set to `runtime_error`' do let(:cop_config) { { 'EnforcedStyle' => 'runtime_error' } } it 'registers an offense and corrects' d...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/numbered_parameter_assignment_spec.rb
Ruby
mit
12,856
master
1,275
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::NumberedParameterAssignment, :config do # NOTE: Assigning to numbered parameter (from `_1` to `_9`) cause an error in Ruby 3.0. context 'when Ruby 2.7 or lower', :ruby27, unsupported_on: :prism do (1..9).to_a.each do |number| it "registers ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/suppressed_exception_in_number_conversion_spec.rb
Ruby
mit
12,856
master
7,655
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::SuppressedExceptionInNumberConversion, :config, :ruby26 do it 'registers an offense when using `Integer(arg) rescue nil`' do expect_offense(<<~RUBY) Integer(arg) rescue nil ^^^^^^^^^^^^^^^^^^^^^^^ Use `Integer(arg, exception: false)` in...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/incompatible_io_select_with_fiber_scheduler_spec.rb
Ruby
mit
12,856
master
5,896
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::IncompatibleIoSelectWithFiberScheduler, :config do it 'registers and corrects an offense when using `IO.select` with single read argument' do expect_offense(<<~RUBY) IO.select([io], [], []) ^^^^^^^^^^^^^^^^^^^^^^^ Use `io.wait_readable`...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/missing_cop_enable_directive_spec.rb
Ruby
mit
12,856
master
3,984
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::MissingCopEnableDirective, :config do context 'when the maximum range size is infinite' do let(:cop_config) { { 'MaximumRangeSize' => Float::INFINITY } } let(:other_cops) { { 'Layout/SpaceAroundOperators' => { 'Enabled' => true } } } it 'r...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/duplicate_case_condition_spec.rb
Ruby
mit
12,856
master
2,522
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::DuplicateCaseCondition, :config do it 'registers an offense for repeated case conditionals' do expect_offense(<<~RUBY) case x when false first_method when true second_method when false ^^^^^ Duplic...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/empty_file_spec.rb
Ruby
mit
12,856
master
1,041
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::EmptyFile, :config do let(:commissioner) { RuboCop::Cop::Commissioner.new([cop]) } let(:offenses) { commissioner.investigate(processed_source).offenses } let(:cop_config) { { 'AllowComments' => true } } let(:source) { '' } it 'registers an off...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/redundant_cop_enable_directive_spec.rb
Ruby
mit
12,856
master
11,973
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::RedundantCopEnableDirective, :config do describe 'when cop is disabled in the configuration' do let(:other_cops) { { 'Layout/LineLength' => { 'Enabled' => false } } } it 'registers no offense when enabling the cop' do expect_no_offenses(...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/safe_navigation_consistency_spec.rb
Ruby
mit
12,856
master
9,652
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::SafeNavigationConsistency, :config do let(:cop_config) { { 'AllowedMethods' => %w[present? blank? try presence] } } it 'allows && without receiver' do expect_no_offenses(<<~RUBY) foo && bar RUBY end it 'allows && without safe navi...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/constant_definition_in_block_spec.rb
Ruby
mit
12,856
master
6,287
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::ConstantDefinitionInBlock, :config do it 'does not register an offense for a top-level constant' do expect_no_offenses(<<~RUBY) FOO = 1 RUBY end it 'does not register an offense for a top-level constant followed by another statement'...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/redundant_safe_navigation_spec.rb
Ruby
mit
12,856
master
27,133
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::RedundantSafeNavigation, :config do let(:cop_config) do { 'AllowedMethods' => %w[respond_to?], 'AdditionalNilMethods' => %w[present?] } end it 'registers an offense and corrects when `&.` is used for camel case const receiver' do expect_of...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/loop_spec.rb
Ruby
mit
12,856
master
995
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::Loop, :config do it 'registers an offense and corrects for begin/end/while' do expect_offense(<<~RUBY) begin something end while test ^^^^^ Use `Kernel#loop` with `break` rather than `begin/end/until`(or `while`). ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/redundant_regexp_quantifiers_spec.rb
Ruby
mit
12,856
master
5,733
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::RedundantRegexpQuantifiers, :config do # silence Ruby's own warnings for the tested redundant quantifiers around { |example| RuboCop::Util.silence_warnings(&example) } context 'with non-redundant quantifiers' do it 'does not register an offens...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/duplicate_branch_spec.rb
Ruby
mit
12,856
master
14,365
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::DuplicateBranch, :config do shared_examples 'literal if allowed' do |type, value| context "when returning a #{type} in multiple branches" do it 'allows branches to be duplicated' do expect_no_offenses(<<~RUBY) if x ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/ensure_return_spec.rb
Ruby
mit
12,856
master
1,320
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::EnsureReturn, :config do it 'registers an offense but does not correct for return in ensure' do expect_offense(<<~RUBY) begin something ensure file.close return ^^^^^^ Do not return from an `ensure` block...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/missing_super_spec.rb
Ruby
mit
12,856
master
6,525
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::MissingSuper, :config do context 'constructor' do it 'registers an offense and does not autocorrect when no `super` call' do expect_offense(<<~RUBY) class Child < Parent def initialize ^^^^^^^^^^^^^^ Call `super` t...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/script_permission_spec.rb
Ruby
mit
12,856
master
2,261
# frozen_string_literal: true # rubocop:disable Style/NumericLiteralPrefix RSpec.describe RuboCop::Cop::Lint::ScriptPermission, :config do subject(:cop) { described_class.new(config, options) } let(:options) { nil } let(:file) { Tempfile.new('') } let(:filename) { file.path.split('/').last } let(:source) {...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/syntax_spec.rb
Ruby
mit
12,856
master
4,573
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::Syntax, :config do describe '.offenses_from_processed_source' do let(:commissioner) { RuboCop::Cop::Commissioner.new([cop]) } let(:offenses) { commissioner.investigate(processed_source).offenses } let(:ruby_version) { 3.3 } # The minimum ve...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/next_without_accumulator_spec.rb
Ruby
mit
12,856
master
3,243
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::NextWithoutAccumulator, :config do shared_examples 'reduce/inject' do |reduce_alias| context "given a #{reduce_alias} block" do it 'registers an offense for a bare next' do expect_offense(<<~RUBY) (1..4).#{reduce_alias}(0) d...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/trailing_comma_in_attribute_declaration_spec.rb
Ruby
mit
12,856
master
764
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::TrailingCommaInAttributeDeclaration, :config do it 'registers an offense when using trailing comma' do expect_offense(<<~RUBY) class Foo attr_reader :bar, ^ Avoid leaving a trailing comma in attribute declarati...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/ambiguous_operator_precedence_spec.rb
Ruby
mit
12,856
master
4,463
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::AmbiguousOperatorPrecedence, :config do it 'does not register an offense when there is only one operator in the expression' do expect_no_offenses(<<~RUBY) a + b RUBY end it 'does not register an offense when all operators in the expr...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/empty_ensure_spec.rb
Ruby
mit
12,856
master
622
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::EmptyEnsure, :config do it 'registers an offense and corrects empty ensure' do expect_offense(<<~RUBY) begin something ensure # hello ^^^^^^ Empty `ensure` block detected. # world end RUBY expect_cor...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/empty_in_pattern_spec.rb
Ruby
mit
12,856
master
3,928
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::EmptyInPattern, :config do let(:cop_config) { { 'AllowComments' => false } } context 'when a `in` body is missing', :ruby27 do it 'registers an offense for a missing `in` body' do expect_offense(<<~RUBY) case foo in [a] the...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/numeric_operation_with_constant_result_spec.rb
Ruby
mit
12,856
master
2,879
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::NumericOperationWithConstantResult, :config do it 'registers an offense when a variable is multiplied by 0' do expect_offense(<<~RUBY) x * 0 ^^^^^ Numeric operation with a constant result detected. RUBY expect_correction(<<~RUB...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/ordered_magic_comments_spec.rb
Ruby
mit
12,856
master
3,216
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::OrderedMagicComments, :config do it 'registers an offense and corrects when an `encoding` magic comment ' \ 'does not precede all other magic comments' do expect_offense(<<~RUBY) # frozen_string_literal: true # encoding: ascii ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/unreachable_code_spec.rb
Ruby
mit
12,856
master
8,308
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::UnreachableCode, :config do def wrap(str) head = <<~RUBY def something array.each do |item| RUBY tail = <<~RUBY end end RUBY body = str.each_line.map { |line| " #{line}" }.join head + body + tail ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/literal_as_condition_spec.rb
Ruby
mit
12,856
master
18,442
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::LiteralAsCondition, :config do %w(1 2.0 [1] {} :sym :"#{a}").each do |lit| it "registers an offense for truthy literal #{lit} in if" do expect_offense(<<~RUBY, lit: lit) if %{lit} ^{lit} Literal `#{lit}` appeared as a condi...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/percent_string_array_spec.rb
Ruby
mit
12,856
master
3,229
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::PercentStringArray, :config do context 'detecting quotes or commas in a %w/%W string' do %w[w W].each do |char| it 'accepts tokens without quotes or commas' do expect_no_offenses("%#{char}(foo bar baz)") end [ %(%...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/redundant_dir_glob_sort_spec.rb
Ruby
mit
12,856
master
4,033
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::RedundantDirGlobSort, :config do context 'when Ruby 3.0 or higher', :ruby30 do it 'registers an offense and correction when using `Dir.glob.sort`' do expect_offense(<<~RUBY) Dir.glob(Rails.root.join('test', '*.rb')).sort.each(&method(...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/unescaped_bracket_in_regexp_spec.rb
Ruby
mit
12,856
master
7,006
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::UnescapedBracketInRegexp, :config do around { |example| RuboCop::Util.silence_warnings(&example) } context 'literal Regexp' do context 'when unescaped bracket is the first character' do it 'does not register an offense' do # this d...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/array_literal_in_regexp_spec.rb
Ruby
mit
12,856
master
3,293
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::ArrayLiteralInRegexp, :config do shared_examples 'character class' do |source, correction| it "registers an offense and corrects for `#{source}`" do expect_offense(<<~'RUBY', source: source) /#{%{source}}/ ^^^{source}^ Use a ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/non_local_exit_from_iterator_spec.rb
Ruby
mit
12,856
master
4,767
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::NonLocalExitFromIterator, :config do context 'when block is followed by method chain' do context 'and has single argument' do it 'registers an offense' do expect_offense(<<~RUBY) items.each do |item| return if it...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/unexpected_block_arity_spec.rb
Ruby
mit
12,856
master
5,482
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::UnexpectedBlockArity, :config do let(:cop_config) { { 'Methods' => { 'reduce' => 2, 'inject' => 2 } } } context 'with a block' do context 'when given two parameters' do it 'does not register an offense' do expect_no_offenses(<<~RUB...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/cop_directive_syntax_spec.rb
Ruby
mit
12,856
master
3,559
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::CopDirectiveSyntax, :config do it 'does not register an offense for a single cop name' do expect_no_offenses(<<~RUBY) # rubocop:disable Layout/LineLength RUBY end it 'does not register an offense for a single cop department' do e...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/ambiguous_operator_spec.rb
Ruby
mit
12,856
master
6,498
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::AmbiguousOperator, :config do context 'with `+` unary operator in the first argument' do context 'without parentheses' do context 'without whitespaces on the right of the operator' do it 'registers an offense and corrects' do ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/parentheses_as_grouped_expression_spec.rb
Ruby
mit
12,856
master
5,549
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::ParenthesesAsGroupedExpression, :config do it 'registers an offense and corrects for method call with space before the parenthesis' do expect_offense(<<~RUBY) a.func (x) ^ `(x)` interpreted as grouped expression. RUBY exp...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/useless_defined_spec.rb
Ruby
mit
12,856
master
1,532
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::UselessDefined, :config do it 'registers an offense when using `defined?` with a string argument' do expect_offense(<<~RUBY) defined?("FooBar") ^^^^^^^^^^^^^^^^^^ Calling `defined?` with a string argument will always return a truthy val...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/out_of_range_regexp_ref_spec.rb
Ruby
mit
12,856
master
15,132
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::OutOfRangeRegexpRef, :config do it 'registers an offense when references are used before any regexp' do expect_offense(<<~RUBY) puts $3 ^^ $3 is out of range (no regexp capture groups detected). RUBY end it 'registers an o...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/it_without_arguments_in_block_spec.rb
Ruby
mit
12,856
master
3,847
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::ItWithoutArgumentsInBlock, :config do context '>= Ruby 3.4', :ruby34 do it 'does not register an offense when using `it` without arguments in a single line block' do expect_no_offenses(<<~RUBY) 0.times { it } RUBY end i...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/useless_else_without_rescue_spec.rb
Ruby
mit
12,856
master
691
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::UselessElseWithoutRescue, :config do context 'with `else` without `rescue`', :ruby25, unsupported_on: :prism do it 'registers an offense' do expect_offense(<<~RUBY) begin do_something else ^^^^ `else` without...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/binary_operator_with_identical_operands_spec.rb
Ruby
mit
12,856
master
1,212
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::BinaryOperatorWithIdenticalOperands, :config do %i[== != === <=> =~ && || > >= < <= | ^].each do |operator| it "registers an offense for `#{operator}` with duplicate operands" do expect_offense(<<~RUBY, operator: operator) y = a.x(arg...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/uri_regexp_spec.rb
Ruby
mit
12,856
master
3,893
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::UriRegexp, :config do it 'does not register an offense when using `regexp` without receiver' do expect_no_offenses(<<~RUBY) regexp('http://example.com') RUBY end it 'does not register an offense when using `regexp` with variable rece...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/return_in_void_context_spec.rb
Ruby
mit
12,856
master
5,092
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::ReturnInVoidContext, :config do context 'with an initialize method containing a return with a value' do it 'registers an offense' do expect_offense(<<~RUBY) class A def initialize return :qux if bar? ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/unified_integer_spec.rb
Ruby
mit
12,856
master
2,792
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::UnifiedInteger, :config do shared_examples 'registers an offense' do |klass| context 'target ruby version < 2.4', :ruby23, unsupported_on: :prism do context "when #{klass}" do context 'without any decorations' do it 'registe...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/duplicate_set_element_spec.rb
Ruby
mit
12,856
master
5,920
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::DuplicateSetElement, :config do %w[Set SortedSet].each do |class_name| it "registers an offense when using duplicate symbol element in `#{class_name}[...]`" do expect_offense(<<~RUBY, class_name: class_name) #{class_name}[:foo, :bar, ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/send_with_mixin_argument_spec.rb
Ruby
mit
12,856
master
3,777
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::SendWithMixinArgument, :config do it 'registers an offense when using `send` with `include`' do expect_offense(<<~RUBY) Foo.send(:include, Bar) ^^^^^^^^^^^^^^^^^^^ Use `include Bar` instead of `send(:include, Bar)`. RUBY ex...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/rescue_exception_spec.rb
Ruby
mit
12,856
master
2,857
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::RescueException, :config do it 'registers an offense for rescue from Exception' do expect_offense(<<~RUBY) begin something rescue Exception ^^^^^^^^^^^^^^^^ Avoid rescuing the `Exception` class. Perhaps you meant to rescue...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/nested_method_definition_spec.rb
Ruby
mit
12,856
master
11,614
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::NestedMethodDefinition, :config do it 'registers an offense for a nested method definition' do expect_offense(<<~RUBY) def x; def y; end; end ^^^^^^^^^^ Method definitions must not be nested. Use `lambda` instead. RUBY end ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/erb_new_arguments_spec.rb
Ruby
mit
12,856
master
5,226
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::ErbNewArguments, :config do context '<= Ruby 2.5', :ruby25, unsupported_on: :prism do it 'does not register an offense when using `ERB.new` with non-keyword arguments' do expect_no_offenses(<<~RUBY) ERB.new(str, nil, '-', '@output_buf...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/unused_method_argument_spec.rb
Ruby
mit
12,856
master
20,617
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::UnusedMethodArgument, :config do let(:cop_config) do { 'AllowUnusedKeywordArguments' => false, 'IgnoreEmptyMethods' => false, 'IgnoreNotImplementedMethods' => false } end describe 'inspection' do context 'when a metho...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/empty_when_spec.rb
Ruby
mit
12,856
master
4,747
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::EmptyWhen, :config do let(:cop_config) { { 'AllowComments' => false } } context 'when a `when` body is missing' do it 'registers an offense for a missing when body' do expect_offense(<<~RUBY) case foo when :bar then 1 ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/interpolation_check_spec.rb
Ruby
mit
12,856
master
3,254
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::InterpolationCheck, :config do it 'registers an offense and corrects for interpolation in single quoted string' do expect_offense(<<~'RUBY') 'foo #{bar}' ^^^^^^^^^^^^ Interpolation in single quoted string detected. Use double quoted str...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/literal_assignment_in_condition_spec.rb
Ruby
mit
12,856
master
7,826
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::LiteralAssignmentInCondition, :config do it 'registers an offense when assigning integer literal to local variable in `if` condition' do expect_offense(<<~RUBY) if test = 42 ^^^^ Don't use literal assignment `= 42` in conditiona...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/uri_escape_unescape_spec.rb
Ruby
mit
12,856
master
3,358
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::UriEscapeUnescape, :config do it "registers an offense when using `URI.escape('http://example.com')`" do expect_offense(<<~RUBY) URI.escape('http://example.com') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `URI.escape` method is obsolete and shoul...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/unreachable_loop_spec.rb
Ruby
mit
12,856
master
8,510
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::UnreachableLoop, :config do context 'without preceding continue statements' do it 'registers an offense when using `break`' do expect_offense(<<~RUBY) while x > 0 ^^^^^^^^^^^ This loop will have at most one iteration. ...