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/to_enum_arguments_spec.rb
Ruby
mit
12,856
master
6,420
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::ToEnumArguments, :config do it 'registers an offense when required arg is missing' do expect_offense(<<~RUBY) def m(x) return to_enum(:m) unless block_given? ^^^^^^^^^^^ Ensure you correctly provided all the arguments. ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/ambiguous_range_spec.rb
Ruby
mit
12,856
master
6,479
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::AmbiguousRange, :config do { 'irange' => '..', 'erange' => '...' }.each do |node_type, operator| context "for an #{node_type}" do it 'registers an offense and corrects when not parenthesized' do expect_offense(<<~RUBY) x || ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/mixed_regexp_capture_types_spec.rb
Ruby
mit
12,856
master
2,393
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::MixedRegexpCaptureTypes, :config do it 'registers an offense when both of named and numbered captures are used' do expect_offense(<<~RUBY) /(?<foo>bar)(baz)/ ^^^^^^^^^^^^^^^^^^ Do not mix named captures and numbered captures in a Regexp...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/shared_mutable_default_spec.rb
Ruby
mit
12,856
master
2,169
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::SharedMutableDefault, :config do context 'when line is unrelated' do it 'does not register an offense' do expect_no_offenses(<<~RUBY) [] {} Array.new Hash.new Hash.new { |h, k| h[k] = [] } Hash....
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/format_parameter_mismatch_spec.rb
Ruby
mit
12,856
master
12,522
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::FormatParameterMismatch, :config do shared_examples 'variables' do |variable| it 'does not register an offense for % called on a variable' do expect_no_offenses(<<~RUBY) #{variable} = '%s' #{variable} % [foo] RUBY en...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/ambiguous_assignment_spec.rb
Ruby
mit
12,856
master
696
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::AmbiguousAssignment, :config do described_class::MISTAKES.each_key do |mistake| operator = mistake[1] %i[x @x @@x $x X].each do |lhs| it "registers an offense when using `#{operator}` with `#{lhs}`" do expect_offense(<<~RUBY, ope...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/struct_new_override_spec.rb
Ruby
mit
12,856
master
2,812
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::StructNewOverride, :config do it 'registers an offense using `Struct.new(symbol)`' do expect_offense(<<~RUBY) Bad = Struct.new(:members) ^^^^^^^^ `:members` member overrides `Struct#members` and it may be unexpected. ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/useless_or_spec.rb
Ruby
mit
12,856
master
2,728
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::UselessOr, :config do described_class::TRUTHY_RETURN_VALUE_METHODS.each do |method| it "registers an offense with `x.#{method} || fallback`" do expect_offense(<<~RUBY, method: method) x.#{method} || fallback _{method} ^^^^^^...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/hash_compare_by_identity_spec.rb
Ruby
mit
12,856
master
1,581
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::HashCompareByIdentity, :config do it 'registers an offense when using hash methods with `object_id` on receiver as a key' do expect_offense(<<~RUBY) hash.key?(foo.object_id) ^^^^^^^^^^^^^^^^^^^^^^^^ Use `Hash#compare_by_identity` instea...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/regexp_as_condition_spec.rb
Ruby
mit
12,856
master
1,210
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::RegexpAsCondition, :config do it 'registers an offense and corrects for a regexp literal in `if` condition' do expect_offense(<<~RUBY) if /foo/ ^^^^^ Do not use regexp literal as a condition. The regexp literal matches `$_` implicitl...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/duplicate_methods_spec.rb
Ruby
mit
12,856
master
45,108
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::DuplicateMethods, :config do shared_examples 'in scope' do |type, opening_line, receiver = 'A'| it "registers an offense for duplicate method in #{type}" do expect_offense(<<~RUBY) #{opening_line} def some_method ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/constant_overwritten_in_rescue_spec.rb
Ruby
mit
12,856
master
2,902
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::ConstantOverwrittenInRescue, :config do it 'registers an offense when overriding an exception with an exception result' do expect_offense(<<~RUBY) begin something rescue => StandardError ^^ `StandardError` is overwr...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/duplicate_elsif_condition_spec.rb
Ruby
mit
12,856
master
1,245
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::DuplicateElsifCondition, :config do it 'registers an offense for repeated elsif conditions' do expect_offense(<<~RUBY) if x == 1 elsif x == 2 elsif x == 1 ^^^^^^ Duplicate `elsif` condition detected. end RUBY...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/disjunctive_assignment_in_constructor_spec.rb
Ruby
mit
12,856
master
2,831
# frozen_string_literal: true RSpec.describe( RuboCop::Cop::Lint::DisjunctiveAssignmentInConstructor, :config ) do context 'empty constructor' do it 'accepts' do expect_no_offenses(<<~RUBY) class Banana def initialize end end RUBY end end context 'cons...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/shadowed_exception_spec.rb
Ruby
mit
12,856
master
11,739
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::ShadowedException, :config do context 'modifier rescue' do it 'accepts rescue in its modifier form' do expect_no_offenses('foo rescue nil') end end context 'single rescue' do it 'accepts an empty rescue' do expect_no_offens...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/or_assignment_to_constant_spec.rb
Ruby
mit
12,856
master
1,760
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::OrAssignmentToConstant, :config do it 'registers an offense with or-assignment to a constant' do expect_offense(<<~RUBY) CONST ||= 1 ^^^ Avoid using or-assignment with constants. RUBY expect_correction(<<~RUBY) CONS...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/triple_quotes_spec.rb
Ruby
mit
12,856
master
2,644
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::TripleQuotes, :config do context 'triple quotes' do context 'on one line' do it 'registers an offense and corrects' do expect_offense(<<~RUBY) """a string""" ^^^^^^^^^^^^^^ Delimiting a string with multiple quotes ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/redundant_splat_expansion_spec.rb
Ruby
mit
12,856
master
14,576
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::RedundantSplatExpansion, :config do it 'allows assigning to a splat' do expect_no_offenses('*, rhs = *node') end it 'allows assigning to a splat variable' do expect_no_offenses('lhs, *args = *node') end it 'allows assigning a variable...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/nested_percent_literal_spec.rb
Ruby
mit
12,856
master
2,101
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::NestedPercentLiteral, :config do it 'registers no offense for empty array' do expect_no_offenses('%i[]') end it 'registers no offense for array' do expect_no_offenses('%i[a b c d xyz]') end it 'registers no offense for percent modifie...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/constant_reassignment_spec.rb
Ruby
mit
12,856
master
15,086
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::ConstantReassignment, :config do it 'registers an offense when reassigning a constant on top-level namespace' do expect_offense(<<~RUBY) FOO = :bar FOO = :baz ^^^^^^^^^^ Constant `FOO` is already assigned in this namespace. RU...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/constant_resolution_spec.rb
Ruby
mit
12,856
master
3,204
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::ConstantResolution, :config do it 'registers no offense when qualifying a const' do expect_no_offenses(<<~RUBY) ::MyConst RUBY end it 'registers no offense qualifying a namespace const' do expect_no_offenses(<<~RUBY) ::MyCo...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/identity_comparison_spec.rb
Ruby
mit
12,856
master
2,468
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::IdentityComparison, :config do it 'registers an offense and corrects when using `==` for comparison between `object_id`s' do expect_offense(<<~RUBY) foo.object_id == bar.object_id ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use `equal?` instead of `...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/lambda_without_literal_block_spec.rb
Ruby
mit
12,856
master
1,673
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::LambdaWithoutLiteralBlock, :config do it 'registers and corrects an offense when using lambda with `&proc {}` block argument' do expect_offense(<<~RUBY) lambda(&proc { do_something }) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lambda without a lite...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/useless_access_modifier_spec.rb
Ruby
mit
12,856
master
33,668
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::UselessAccessModifier, :config do context 'when an access modifier has no effect' do it 'registers an offense and corrects' do expect_offense(<<~RUBY) class SomeClass def some_method puts 10 end ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/unreachable_pattern_branch_spec.rb
Ruby
mit
12,856
master
6,929
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::UnreachablePatternBranch, :config, :ruby27 do it 'registers an offense for `in` branch after bare variable catch-all' do expect_offense(<<~RUBY) case value in x handle_other in Integer ^^^^^^^^^^ Unreachable `in` pat...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/big_decimal_new_spec.rb
Ruby
mit
12,856
master
841
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::BigDecimalNew, :config do it 'registers an offense and corrects using `BigDecimal.new()`' do expect_offense(<<~RUBY) BigDecimal.new(123.456, 3) ^^^ `BigDecimal.new()` is deprecated. Use `BigDecimal()` instead. RUBY e...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/flip_flop_spec.rb
Ruby
mit
12,856
master
670
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::FlipFlop, :config do it 'registers an offense for inclusive flip-flops' do expect_offense(<<~RUBY) DATA.each_line do |line| print line if (line =~ /begin/)..(line =~ /end/) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Avoid th...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/duplicate_match_pattern_spec.rb
Ruby
mit
12,856
master
5,040
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::DuplicateMatchPattern, :config, :ruby27 do it 'registers an offense for repeated `in` patterns' do expect_offense(<<~RUBY) case x in foo first_method in bar second_method in foo ^^^ Duplicate `in` pa...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/empty_block_spec.rb
Ruby
mit
12,856
master
3,231
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::EmptyBlock, :config do let(:cop_config) { { 'AllowComments' => true, 'AllowEmptyLambdas' => true } } it 'registers an offense for empty block within method call' do expect_offense(<<~RUBY) items.each { |item| } ^^^^^^^^^^^^^^^^^^^^^ ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/suppressed_exception_spec.rb
Ruby
mit
12,856
master
7,561
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::SuppressedException, :config do context 'with AllowComments set to false' do let(:cop_config) { { 'AllowComments' => false } } it 'registers an offense for empty rescue block' do expect_offense(<<~RUBY) begin something ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/redundant_with_index_spec.rb
Ruby
mit
12,856
master
4,475
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::RedundantWithIndex, :config do it 'registers an offense for `ary.each_with_index { |v| v }` and corrects to `ary.each`' do expect_offense(<<~RUBY) ary.each_with_index { |v| v } ^^^^^^^^^^^^^^^ Use `each` instead of `each_with_index`...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/refinement_import_methods_spec.rb
Ruby
mit
12,856
master
1,712
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::RefinementImportMethods, :config do context 'Ruby >= 3.1', :ruby31 do it 'registers an offense when using `include` in `refine` block' do expect_offense(<<~RUBY) refine Foo do include Bar ^^^^^^^ Use `import_method...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/redundant_require_statement_spec.rb
Ruby
mit
12,856
master
6,496
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::RedundantRequireStatement, :config do it 'registers an offense when using requiring `enumerator`' do expect_offense(<<~RUBY) require 'enumerator' ^^^^^^^^^^^^^^^^^^^^ Remove unnecessary `require` statement. require 'uri' RUBY ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/number_conversion_spec.rb
Ruby
mit
12,856
master
10,660
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::NumberConversion, :config do context 'registers an offense' do it 'when using `#to_i`' do expect_offense(<<~RUBY) "10".to_i ^^^^^^^^^ Replace unsafe number conversion with number class parsing, instead of using `"10".to_i`, us...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/mixed_case_range_spec.rb
Ruby
mit
12,856
master
6,177
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::MixedCaseRange, :config do let(:message) do 'Ranges from upper to lower case ASCII letters may include unintended ' \ 'characters. Instead of `A-z` (which also includes several symbols) ' \ 'specify each range individually: `A-Za-z` and...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/top_level_return_with_argument_spec.rb
Ruby
mit
12,856
master
3,883
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::TopLevelReturnWithArgument, :config do context 'Code segment with only top-level return statement' do it 'expects no offense from the return without arguments' do expect_no_offenses(<<~RUBY) return RUBY end it 'expects ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/assignment_in_condition_spec.rb
Ruby
mit
12,856
master
12,222
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::AssignmentInCondition, :config do let(:cop_config) { { 'AllowSafeAssignment' => true } } it 'registers an offense for lvar assignment in condition' do expect_offense(<<~RUBY) if test = 10 ^ Use `==` if you meant to do a compa...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/deprecated_class_methods_spec.rb
Ruby
mit
12,856
master
7,403
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::DeprecatedClassMethods, :config do context 'prefer `File.exist?` over `File.exists?`' do it 'registers an offense and corrects File.exists?' do expect_offense(<<~RUBY) File.exists?(o) ^^^^^^^^^^^^ `File.exists?` is deprecated ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/heredoc_method_call_position_spec.rb
Ruby
mit
12,856
master
3,724
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::HeredocMethodCallPosition, :config do context 'correct cases' do it 'accepts simple correct case' do expect_no_offenses(<<~RUBY) <<~SQL foo SQL RUBY end it 'accepts chained correct case' do expec...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/lint/unmodified_reduce_accumulator_spec.rb
Ruby
mit
12,856
master
18,774
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Lint::UnmodifiedReduceAccumulator, :config do shared_examples 'reduce/inject' do |method| it "does not affect #{method} called with no block args" do expect_no_offenses(<<~RUBY) values.#{method} do do_something end R...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/internal_affairs/on_send_without_on_csend_spec.rb
Ruby
mit
12,856
master
1,984
# frozen_string_literal: true RSpec.describe RuboCop::Cop::InternalAffairs::OnSendWithoutOnCSend, :config do it 'registers an offense when `on_send` is defined without `on_csend`' do expect_offense(<<~RUBY) class MyCop < RuboCop::Cop:Base def on_send(node) ^^^^^^^^^^^^^^^^^ Cop defines `on_...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/internal_affairs/undefined_config_spec.rb
Ruby
mit
12,856
master
7,647
# frozen_string_literal: true RSpec.describe RuboCop::Cop::InternalAffairs::UndefinedConfig, :config, :isolated_environment do include FileHelper before do create_file('config/default.yml', <<~YAML) Test/Foo: Defined: true X/Y/Z: Defined: true YAML stub_const('RuboCop::Co...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/internal_affairs/redundant_expect_offense_arguments_spec.rb
Ruby
mit
12,856
master
2,174
# 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) ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/internal_affairs/numblock_handler_spec.rb
Ruby
mit
12,856
master
1,087
# frozen_string_literal: true RSpec.describe RuboCop::Cop::InternalAffairs::NumblockHandler, :config do it 'registers an offense for cops with forgotten numblock handlers' do expect_offense <<~RUBY class Cop < Base def on_block(node) ^^^^^^^^^^^^^^^^^^ Define on_numblock to handle blocks wi...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/internal_affairs/offense_location_keyword_spec.rb
Ruby
mit
12,856
master
1,397
# frozen_string_literal: true RSpec.describe RuboCop::Cop::InternalAffairs::OffenseLocationKeyword, :config do context 'when `node.loc.selector` is passed' do it 'registers an offense' do expect_offense(<<~RUBY) add_offense(node, location: node.loc.selector) ^^^^...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/internal_affairs/cop_description_spec.rb
Ruby
mit
12,856
master
3,658
# frozen_string_literal: true RSpec.describe RuboCop::Cop::InternalAffairs::CopDescription, :config do context 'The description starts with `This cop ...`' do it 'registers an offense and corrects if using just a verb' do expect_offense(<<~RUBY) module RuboCop module Cop modul...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/internal_affairs/example_heredoc_delimiter_spec.rb
Ruby
mit
12,856
master
2,283
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/internal_affairs/single_line_comparison_spec.rb
Ruby
mit
12,856
master
4,182
# 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 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/internal_affairs/redundant_message_argument_spec.rb
Ruby
mit
12,856
master
1,793
# 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 ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/internal_affairs/node_type_group_spec.rb
Ruby
mit
12,856
master
3,841
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/internal_affairs/node_matcher_directive_spec.rb
Ruby
mit
12,856
master
12,866
# frozen_string_literal: true RSpec.describe RuboCop::Cop::InternalAffairs::NodeMatcherDirective, :config do %i[def_node_matcher def_node_search].each do |method| it 'does not register an offense if the node matcher already has a directive' do expect_no_offenses(<<~RUBY) # @!method foo?(node) ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/internal_affairs/method_name_equal_spec.rb
Ruby
mit
12,856
master
1,236
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/internal_affairs/empty_line_between_expect_offense_and_correction_spec.rb
Ruby
mit
12,856
master
2,710
# frozen_string_literal: true RSpec.describe RuboCop::Cop::InternalAffairs::EmptyLineBetweenExpectOffenseAndCorrection, :config do it 'registers and corrects an offense when using no empty line between `expect_offense` and `expect_correction` ' \ 'with heredoc argument' do expect_offense(<<~RUBY) expe...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/internal_affairs/operator_keyword_spec.rb
Ruby
mit
12,856
master
2,071
# frozen_string_literal: true RSpec.describe RuboCop::Cop::InternalAffairs::OperatorKeyword, :config do it 'registers an offense when using `node.and_type? || node.or_type?`' do expect_offense(<<~RUBY) node.and_type? || node.or_type? ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use `node.operator_keyword?`. R...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/internal_affairs/lambda_or_proc_spec.rb
Ruby
mit
12,856
master
1,709
# frozen_string_literal: true RSpec.describe RuboCop::Cop::InternalAffairs::LambdaOrProc, :config do it 'registers an offense when using `node.lambda? || node.proc?`' do expect_offense(<<~RUBY) node.lambda? || node.proc? ^^^^^^^^^^^^^^^^^^^^^^^^^^ Use `node.lambda_or_proc?`. RUBY expect_corr...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/internal_affairs/redundant_source_range_spec.rb
Ruby
mit
12,856
master
5,914
# 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`...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/internal_affairs/node_first_or_last_argument_spec.rb
Ruby
mit
12,856
master
2,930
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/internal_affairs/location_exists_spec.rb
Ruby
mit
12,856
master
10,164
# frozen_string_literal: true RSpec.describe RuboCop::Cop::InternalAffairs::LocationExists, :config do context 'within an `and` node' do context 'code that can be replaced with `loc?`' do it 'registers an offense when the receiver does not match' do expect_offense(<<~RUBY) node.loc.respon...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/internal_affairs/location_expression_spec.rb
Ruby
mit
12,856
master
2,728
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/internal_affairs/node_destructuring_spec.rb
Ruby
mit
12,856
master
1,196
# frozen_string_literal: true RSpec.describe RuboCop::Cop::InternalAffairs::NodeDestructuring, :config do context 'when destructuring using `node.children`' do it 'registers an offense when receiver is named `node`' do expect_offense(<<~RUBY, 'example_cop.rb') lhs, rhs = node.children ^^^^^...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/internal_affairs/useless_restrict_on_send_spec.rb
Ruby
mit
12,856
master
2,349
# frozen_string_literal: true RSpec.describe RuboCop::Cop::InternalAffairs::UselessRestrictOnSend, :config do it 'registers an offense when using `RESTRICT_ON_SEND` and not defines send callback method' do expect_offense(<<~RUBY) class FooCop RESTRICT_ON_SEND = %i[bad_method].freeze ^^^^^^^...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/internal_affairs/method_name_end_with_spec.rb
Ruby
mit
12,856
master
4,448
# frozen_string_literal: true RSpec.describe RuboCop::Cop::InternalAffairs::MethodNameEndWith, :config do it 'registers an offense if there is potentially usage of `assignment_method?`' do expect_offense(<<~RUBY) node.method_name.to_s.end_with?('=') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use `assignmen...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/internal_affairs/cop_enabled_spec.rb
Ruby
mit
12,856
master
3,001
# frozen_string_literal: true RSpec.describe RuboCop::Cop::InternalAffairs::CopEnabled, :config do context 'with .for_cop' do it "registers an offense when using `config.for_cop(...)['Enabled']" do expect_offense(<<~RUBY) config.for_cop('Foo/Bar')['Enabled'] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/internal_affairs/create_empty_file_spec.rb
Ruby
mit
12,856
master
1,286
# frozen_string_literal: true RSpec.describe RuboCop::Cop::InternalAffairs::CreateEmptyFile, :config do it "registers an offense when using `create_file(path, '')" do expect_offense(<<~RUBY) create_file(path, '') ^^^^^^^^^^^^^^^^^^^^^ Use `create_empty_file(path)`. RUBY expect_correction(<<~...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/internal_affairs/redundant_context_config_parameter_spec.rb
Ruby
mit
12,856
master
1,270
# 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. ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/internal_affairs/redundant_described_class_as_subject_spec.rb
Ruby
mit
12,856
master
2,668
# frozen_string_literal: true RSpec.describe RuboCop::Cop::InternalAffairs::RedundantDescribedClassAsSubject, :config do it 'registers an offense when using `subject(:cop)` and `:config` is not specified in `describe`' do expect_offense(<<~RUBY) RSpec.describe RuboCop::Cop::Lint::RegexpAsCondition do ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/internal_affairs/style_detected_api_use_spec.rb
Ruby
mit
12,856
master
2,331
# frozen_string_literal: true RSpec.describe RuboCop::Cop::InternalAffairs::StyleDetectedApiUse, :config do it 'registers an offense when correct_style_detected is used without a negative *_style_detected follow up' do expect_offense(<<~RUBY) def on_send(node) ^{} `correct_style_detected` method call...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/internal_affairs/node_type_predicate_spec.rb
Ruby
mit
12,856
master
902
# frozen_string_literal: true RSpec.describe RuboCop::Cop::InternalAffairs::NodeTypePredicate, :config do context 'comparison node type check' do it 'registers an offense and autocorrects' do expect_offense(<<~RUBY) node.type == :send ^^^^^^^^^^^^^^^^^^ Use `#send_type?` to check node type....
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/internal_affairs/node_pattern_groups_spec.rb
Ruby
mit
12,856
master
24,175
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/internal_affairs/itblock_handler_spec.rb
Ruby
mit
12,856
master
1,078
# frozen_string_literal: true RSpec.describe RuboCop::Cop::InternalAffairs::ItblockHandler, :config do it 'registers an offense for cops with forgotten itblock handlers' do expect_offense <<~RUBY class Cop < Base def on_block(node) ^^^^^^^^^^^^^^^^^^ Define on_itblock to handle blocks with ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/internal_affairs/redundant_let_rubocop_config_new_spec.rb
Ruby
mit
12,856
master
3,182
# frozen_string_literal: true RSpec.describe RuboCop::Cop::InternalAffairs::RedundantLetRuboCopConfigNew, :config do it 'registers an offense when using `let(:config)` and `:config` is not specified in `describe`' do expect_offense(<<~RUBY) RSpec.describe RuboCop::Cop::Layout::SpaceAfterComma do su...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/internal_affairs/redundant_location_argument_spec.rb
Ruby
mit
12,856
master
2,390
# frozen_string_literal: true RSpec.describe RuboCop::Cop::InternalAffairs::RedundantLocationArgument, :config do context 'when location argument is passed' do context 'when location argument is :expression' do it 'registers an offense' do expect_offense(<<~RUBY, 'example_cop.rb') add_off...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/internal_affairs/example_description_spec.rb
Ruby
mit
12,856
master
12,010
# 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 ^^^^^^^^^^^^^...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/internal_affairs/location_line_equality_comparison_spec.rb
Ruby
mit
12,856
master
2,790
# frozen_string_literal: true RSpec.describe RuboCop::Cop::InternalAffairs::LocationLineEqualityComparison, :config do it 'registers and corrects an offense when comparing `#loc.line` with LHS and RHS' do expect_offense(<<~RUBY) node.loc.line == node.parent.loc.line ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/internal_affairs/redundant_method_dispatch_node_spec.rb
Ruby
mit
12,856
master
1,833
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/internal_affairs/processed_source_buffer_name_spec.rb
Ruby
mit
12,856
master
1,051
# frozen_string_literal: true RSpec.describe RuboCop::Cop::InternalAffairs::ProcessedSourceBufferName, :config do it 'registers an offense and corrects when using `processed_source.buffer.name` and `processed_source` is a method call' do expect_offense(<<~RUBY) processed_source.buffer.name ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/internal_affairs/useless_message_assertion_spec.rb
Ruby
mit
12,856
master
1,597
# frozen_string_literal: true RSpec.describe RuboCop::Cop::InternalAffairs::UselessMessageAssertion, :config do it 'registers an offense for specs that assert using the MSG' do expect_offense(<<~RUBY, 'example_spec.rb') it 'uses described_class::MSG to specify the expected message' do inspect_sourc...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/internal_affairs/node_type_multiple_predicates_spec.rb
Ruby
mit
12,856
master
6,242
# frozen_string_literal: true RSpec.describe RuboCop::Cop::InternalAffairs::NodeTypeMultiplePredicates, :config do context 'in an `or` node with multiple node type predicate branches' do it 'does not register an offense for type predicates called without a receiver' do expect_no_offenses(<<~RUBY) s...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/internal_affairs/inherit_deprecated_cop_class_spec.rb
Ruby
mit
12,856
master
792
# frozen_string_literal: true RSpec.describe RuboCop::Cop::InternalAffairs::InheritDeprecatedCopClass, :config do it 'registers an offense when using `Cop`' do expect_offense(<<~RUBY) class Foo < Cop ^^^ Use `Base` instead of `Cop`. end RUBY end it 'registers an offense whe...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/utils/format_string_spec.rb
Ruby
mit
12,856
master
5,643
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/mixin/enforce_superclass_spec.rb
Ruby
mit
12,856
master
3,976
# frozen_string_literal: true RSpec.describe RuboCop::Cop::EnforceSuperclass, :restore_registry do subject(:cop) { cop_class.new(configuration) } let(:cop_class) { RuboCop::Cop::RSpec::ApplicationRecord } let(:msg) { 'Models should subclass `ApplicationRecord`' } before do stub_cop_class('RuboCop::Cop::R...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/metrics/collection_literal_length_spec.rb
Ruby
mit
12,856
master
3,351
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Metrics::CollectionLiteralLength, :config do let(:cop_config) do { 'LengthThreshold' => length_threshold } end let(:length_threshold) { 10 } let(:message) do 'Avoid hard coding large quantities of data in code. ' \ 'Prefer readi...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/metrics/module_length_spec.rb
Ruby
mit
12,856
master
7,922
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Metrics::ModuleLength, :config do let(:cop_config) { { 'Max' => 5, 'CountComments' => false } } it 'rejects a module with more than 5 lines' do expect_offense(<<~RUBY) module Test ^^^^^^^^^^^ Module has too many lines. [6/5] a = 1 ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/metrics/class_length_spec.rb
Ruby
mit
12,856
master
12,022
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Metrics::ClassLength, :config do let(:cop_config) { { 'Max' => 5, 'CountComments' => false } } it 'rejects a class with more than 5 lines' do expect_offense(<<~RUBY) class Test ^^^^^^^^^^ Class has too many lines. [6/5] a = 1 ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/metrics/method_length_spec.rb
Ruby
mit
12,856
master
9,537
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Metrics::MethodLength, :config do let(:cop_config) { { 'Max' => 5, 'CountComments' => false } } context 'when method is an instance method' do it 'does not register an offense when there are exactly `Max` lines' do expect_no_offenses(<<~RUBY) ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/metrics/block_length_spec.rb
Ruby
mit
12,856
master
10,539
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Metrics::BlockLength, :config do let(:cop_config) { { 'Max' => 2, 'CountComments' => false } } shared_examples 'allow an offense on an allowed method' do |allowed, config_key| before { cop_config[config_key] = [allowed] } it 'still rejects other ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/metrics/perceived_complexity_spec.rb
Ruby
mit
12,856
master
9,012
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Metrics::PerceivedComplexity, :config do context 'when Max is 1' do let(:cop_config) { { 'Max' => 1 } } it 'accepts a method with no decision points' do expect_no_offenses(<<~RUBY) def method_name call_foo end R...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/metrics/cyclomatic_complexity_spec.rb
Ruby
mit
12,856
master
11,170
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Metrics::CyclomaticComplexity, :config do context 'when Max is 1' do let(:cop_config) { { 'Max' => 1 } } it 'accepts a method with no decision points' do expect_no_offenses(<<~RUBY) def method_name call_foo end ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/metrics/parameter_lists_spec.rb
Ruby
mit
12,856
master
4,176
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Metrics::ParameterLists, :config do include_context 'with exclude limit tracking' let(:cop_config) { { 'Max' => 4, 'CountKeywordArgs' => true, 'MaxOptionalParameters' => 3 } } it 'registers an offense for a method def with 5 parameters' do expect_o...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/metrics/block_nesting_spec.rb
Ruby
mit
12,856
master
8,586
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Metrics::BlockNesting, :config do include_context 'with exclude limit tracking' let(:cop_config) { { 'Max' => 2 } } it 'accepts `Max` levels of nesting' do expect_no_offenses(<<~RUBY) if a if b puts b end end ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/metrics/abc_size_spec.rb
Ruby
mit
12,856
master
7,487
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Metrics::AbcSize, :config do context 'when Max is 0' do let(:cop_config) { { 'Max' => 0 } } it 'accepts an empty method' do expect_no_offenses(<<~RUBY) def method_name end RUBY end it 'accepts an empty `define_me...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/metrics/utils/code_length_calculator_spec.rb
Ruby
mit
12,856
master
11,659
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Metrics::Utils::CodeLengthCalculator do describe '#calculate' do context 'when method' do it 'calculates method length' do source = parse_source(<<~RUBY) def test a = 1 # a = 2 a = [ ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/metrics/utils/abc_size_calculator_spec.rb
Ruby
mit
12,856
master
9,646
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Metrics::Utils::AbcSizeCalculator do describe '#calculate' do subject(:vector) do described_class.calculate(node, discount_repeated_attributes: discount_repeated_attributes).last end let(:discount_repeated_a...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/naming/method_name_spec.rb
Ruby
mit
12,856
master
26,966
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Naming::MethodName, :config do shared_examples 'never accepted' do |enforced_style| it 'registers an offense for mixed snake case and camel case in attr.' do expect_offense(<<~RUBY) attr :visit_Arel_Nodes_SelectStatement ^^^^^^...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/naming/block_parameter_name_spec.rb
Ruby
mit
12,856
master
3,514
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Naming::BlockParameterName, :config do let(:cop_config) { { 'MinNameLength' => 2, 'AllowNamesEndingInNumbers' => false } } it 'does not register for block without parameters' do expect_no_offenses(<<~RUBY) something do do_stuff end...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/naming/variable_number_spec.rb
Ruby
mit
12,856
master
14,775
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Naming::VariableNumber, :config do shared_examples 'offense' do |style, variable, style_to_allow_offenses| it "registers an offense for #{variable} in #{style}" do expect_offense(<<~RUBY, variable: variable) #{variable} = 1 ^{variab...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/naming/inclusive_language_spec.rb
Ruby
mit
12,856
master
13,521
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Naming::InclusiveLanguage, :config do context 'flagged term matching' do let(:cop_config) do { 'FlaggedTerms' => { 'whitelist' => {} } } end it 'registers an offense when using a flagged term' do expect_offense(<<~RUBY) white...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/naming/predicate_method_spec.rb
Ruby
mit
12,856
master
20,943
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Naming::PredicateMethod, :config do let(:allowed_methods) { [] } let(:allowed_patterns) { [] } let(:allow_bang_methods) { false } let(:wayward_predicates) { [] } let(:cop_config) do { 'Mode' => mode, 'AllowedMethods' => allowed_method...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/naming/method_parameter_name_spec.rb
Ruby
mit
12,856
master
5,709
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Naming::MethodParameterName, :config do let(:cop_config) { { 'MinNameLength' => 3, 'AllowNamesEndingInNumbers' => false } } context 'when using argument forwarding', :ruby27 do it 'does not register an offense' do expect_no_offenses(<<~RUBY) ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
spec/rubocop/cop/naming/variable_name_spec.rb
Ruby
mit
12,856
master
19,132
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Naming::VariableName, :config do shared_examples 'always accepted' do it 'accepts screaming snake case globals' do expect_no_offenses('$MY_GLOBAL = 0') end it 'accepts screaming snake case constants' do expect_no_offenses('MY_CONSTAN...