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/layout/space_before_comma_spec.rb
spec/rubocop/cop/layout/space_before_comma_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::SpaceBeforeComma, :config do it 'registers an offense and corrects block argument with space before comma' do expect_offense(<<~RUBY) each { |s , t| } ^ Space found before comma. 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/first_argument_indentation_spec.rb
spec/rubocop/cop/layout/first_argument_indentation_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::FirstArgumentIndentation, :config do let(:cop_config) { { 'EnforcedStyle' => style } } let(:other_cops) { { 'Layout/IndentationWidth' => { 'Width' => indentation_width } } } shared_examples 'common behavior' do context 'when IndentationWidt...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/access_modifier_indentation_spec.rb
spec/rubocop/cop/layout/access_modifier_indentation_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::AccessModifierIndentation, :config do let(:config) do c = cop_config.merge('SupportedStyles' => %w[indent outdent]) RuboCop::Config .new('Layout/AccessModifierIndentation' => c, 'Layout/IndentationWidth' => { 'Width' => inden...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/parameter_alignment_spec.rb
spec/rubocop/cop/layout/parameter_alignment_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::ParameterAlignment, :config do let(:config) do RuboCop::Config.new('Layout/ParameterAlignment' => 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/else_alignment_spec.rb
spec/rubocop/cop/layout/else_alignment_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::ElseAlignment, :config do let(:config) { RuboCop::Config.new('Layout/EndAlignment' => end_alignment_config) } let(:end_alignment_config) { { 'Enabled' => true, 'EnforcedStyleAlignWith' => 'variable' } } it 'accepts a ternary if' do expect_no...
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_brace_layout_spec.rb
spec/rubocop/cop/layout/multiline_array_brace_layout_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::MultilineArrayBraceLayout, :config do let(:cop_config) { { 'EnforcedStyle' => 'symmetrical' } } it 'ignores implicit arrays' do expect_no_offenses(<<~RUBY) foo = a, b RUBY end it 'ignores single-line arrays' do expect_...
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_parens_spec.rb
spec/rubocop/cop/layout/space_inside_parens_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::SpaceInsideParens, :config do context 'when EnforcedStyle is no_space' do let(:cop_config) { { 'EnforcedStyle' => 'no_space' } } it 'registers an offense for spaces inside parens' do expect_offense(<<~RUBY) f( 3) ^ Sp...
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_arguments_spec.rb
spec/rubocop/cop/layout/empty_lines_around_arguments_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::EmptyLinesAroundArguments, :config do let(:empty_line_annotation) { '^{} Empty line detected around arguments.' } context 'when extra lines' do it 'registers and autocorrects offense for empty line before arg' 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/empty_line_after_guard_clause_spec.rb
spec/rubocop/cop/layout/empty_line_after_guard_clause_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::EmptyLineAfterGuardClause, :config do it 'does not register an offense when the clause is not followed by other code' do expect_no_offenses(<<~RUBY) return unless item.positive? RUBY end it 'registers an offense and corrects a guar...
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_indentation_spec.rb
spec/rubocop/cop/layout/multiline_method_call_indentation_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::MultilineMethodCallIndentation, :config do let(:config) do merged = RuboCop::ConfigLoader .default_configuration['Layout/MultilineMethodCallIndentation'] .merge(cop_config) .merge('IndentationWidth' => cop_i...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
true
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/comment_indentation_spec.rb
spec/rubocop/cop/layout/comment_indentation_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::CommentIndentation, :config do let(:config) do RuboCop::Config .new('Layout/IndentationWidth' => { 'Width' => indentation_width }, 'Layout/CommentIndentation' => { 'AllowForAlignment' => allow_for_alignment }) end let(:indent...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/leading_comment_space_spec.rb
spec/rubocop/cop/layout/leading_comment_space_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::LeadingCommentSpace, :config do it 'registers an offense and corrects comment without leading space' do expect_offense(<<~RUBY) #missing space ^^^^^^^^^^^^^^ Missing space after `#`. RUBY expect_correction(<<~RUBY) # mi...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/multiline_block_layout_spec.rb
spec/rubocop/cop/layout/multiline_block_layout_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::MultilineBlockLayout, :config do it 'registers an offense for missing newline in do/end block w/o params' do expect_offense(<<~RUBY) test do foo ^^^ Block body expression is on the same line as the block start. end R...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/layout/dot_position_spec.rb
spec/rubocop/cop/layout/dot_position_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::DotPosition, :config do context 'Leading dots style' do let(:cop_config) { { 'EnforcedStyle' => 'leading' } } it 'registers an offense for trailing dot in multi-line call' do expect_offense(<<~RUBY) something. ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/mixin/enforce_superclass_spec.rb
spec/rubocop/cop/mixin/enforce_superclass_spec.rb
# 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...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/gemspec/ordered_dependencies_spec.rb
spec/rubocop/cop/gemspec/ordered_dependencies_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Gemspec::OrderedDependencies, :config do let(:cop_config) { { 'TreatCommentsAsGroupSeparators' => treat_comments_as_group_separators } } let(:treat_comments_as_group_separators) { false } shared_examples 'ordered dependency' do |add_dependency| cont...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/gemspec/deprecated_attribute_assignment_spec.rb
spec/rubocop/cop/gemspec/deprecated_attribute_assignment_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Gemspec::DeprecatedAttributeAssignment, :config do shared_examples 'deprecated attributes' do |attribute, value| it 'registers and corrects an offense when using `s.rubygems_version =`' do expect_offense(<<~RUBY) Gem::Specification.new do |...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/gemspec/add_runtime_dependency_spec.rb
spec/rubocop/cop/gemspec/add_runtime_dependency_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Gemspec::AddRuntimeDependency, :config do it 'registers an offense when using `add_runtime_dependency`' do expect_offense(<<~RUBY) Gem::Specification.new do |spec| spec.add_runtime_dependency('rubocop') ^^^^^^^^^^^^^^^^^^^^^^ U...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/gemspec/duplicated_assignment_spec.rb
spec/rubocop/cop/gemspec/duplicated_assignment_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Gemspec::DuplicatedAssignment, :config do it 'registers an offense when using `name=` twice' do expect_offense(<<~RUBY) Gem::Specification.new do |spec| spec.name = 'rubocop' spec.name = 'rubocop2' ^^^^^^^^^^^^^^^^^^^^^^ `na...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/gemspec/ruby_version_globals_usage_spec.rb
spec/rubocop/cop/gemspec/ruby_version_globals_usage_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Gemspec::RubyVersionGlobalsUsage, :config do it 'registers an offense when using `RUBY_VERSION`' do expect_offense(<<~RUBY) Gem::Specification.new do |spec| RUBY_VERSION ^^^^^^^^^^^^ Do not use `RUBY_VERSION` in gemspec file. ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/gemspec/require_mfa_spec.rb
spec/rubocop/cop/gemspec/require_mfa_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Gemspec::RequireMFA, :config do context 'when the gemspec is blank' do it 'does not register an offense' do expect_no_offenses('', 'my.gemspec') end end context 'when the specification is blank' do it 'registers an offense and corrects...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/gemspec/dependency_version_spec.rb
spec/rubocop/cop/gemspec/dependency_version_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Gemspec::DependencyVersion, :config do let(:cop_config) do { 'Enabled' => true, 'EnforcedStyle' => enforced_style, 'AllowedGems' => allowed_gems } end let(:allowed_gems) { [] } let(:config) do base = RuboCop::ConfigLoader ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/gemspec/development_dependencies_spec.rb
spec/rubocop/cop/gemspec/development_dependencies_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Gemspec::DevelopmentDependencies, :config do let(:cop_config) do { 'Enabled' => true, 'EnforcedStyle' => enforced_style, 'AllowedGems' => [ 'allowed' ] } end shared_examples 'prefer gem file' do it 'registers ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/gemspec/attribute_assignment_spec.rb
spec/rubocop/cop/gemspec/attribute_assignment_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Gemspec::AttributeAssignment, :config do it 'does not register an offense when only indexed hash assignment is used' do expect_no_offenses(<<~RUBY) Gem::Specification.new do |spec| spec.metadata['key-0'] = 'value-0' spec.metadata['k...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/gemspec/required_ruby_version_spec.rb
spec/rubocop/cop/gemspec/required_ruby_version_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Gemspec::RequiredRubyVersion, :config do # rubocop:disable RSpec/RepeatedExampleGroupDescription context 'target ruby version > 3.4', :ruby34 do # rubocop:enable RSpec/RepeatedExampleGroupDescription it 'registers an offense when `required_ruby_ver...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/migration/department_name_spec.rb
spec/rubocop/cop/migration/department_name_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Migration::DepartmentName, :config do context 'when todo/enable comments have cop names without departments' do let(:tip) { 'Run `rubocop -a --only Migration/DepartmentName` to fix.' } let(:warning) do <<~OUTPUT file.rb: Warning: no dep...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/security/eval_spec.rb
spec/rubocop/cop/security/eval_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Security::Eval, :config do it 'registers an offense for eval as function' do expect_offense(<<~RUBY) eval(something) ^^^^ The use of `eval` is a serious security risk. RUBY end it 'registers an offense for eval as command' do exp...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/security/io_methods_spec.rb
spec/rubocop/cop/security/io_methods_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Security::IoMethods, :config do shared_examples 'offense' do |current, preferred, method_name| it "registers and corrects an offense when using `#{method_name}`" do expect_offense(<<~RUBY, current: current) #{current} ^{current} `Fi...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/security/marshal_load_spec.rb
spec/rubocop/cop/security/marshal_load_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Security::MarshalLoad, :config do it 'registers an offense for using Marshal.load' do expect_offense(<<~RUBY) Marshal.load('{}') ^^^^ Avoid using `Marshal.load`. ::Marshal.load('{}') ^^^^ Avoid using `Marshal.loa...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/security/compound_hash_spec.rb
spec/rubocop/cop/security/compound_hash_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Security::CompoundHash, :config do it 'registers an offense when using XOR operator in the implementation of the hash method' do expect_offense(<<~RUBY) def hash 1.hash ^ 2.hash ^ 3.hash ^^^^^^^^^^^^^^^^^^^^^^^^ Use `[...].hash` ins...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/security/open_spec.rb
spec/rubocop/cop/security/open_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Security::Open, :config do it 'registers an offense for open' do expect_offense(<<~RUBY) open(something) ^^^^ The use of `Kernel#open` is a serious security risk. RUBY end it 'registers an offense for open with mode argument' do ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/security/json_load_spec.rb
spec/rubocop/cop/security/json_load_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Security::JSONLoad, :config do it 'registers an offense and corrects JSON.load' do expect_offense(<<~RUBY) JSON.load(arg) ^^^^ Prefer `JSON.parse` over `JSON.load`. ::JSON.load(arg) ^^^^ Prefer `JSON.parse` over `JSON....
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/security/yaml_load_spec.rb
spec/rubocop/cop/security/yaml_load_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Security::YAMLLoad, :config do it 'does not register an offense for YAML.dump' do expect_no_offenses(<<~RUBY) YAML.dump("foo") ::YAML.dump("foo") Module::YAML.dump("foo") RUBY end it 'does not register an offense for YAML.load ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/bundler/gem_version_spec.rb
spec/rubocop/cop/bundler/gem_version_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Bundler::GemVersion, :config do context 'when EnforcedStyle is set to required (default)' do let(:cop_config) do { 'EnforcedStyle' => 'required', 'AllowedGems' => ['rspec'] } end it 'flags gems that do not specify a v...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/bundler/duplicated_group_spec.rb
spec/rubocop/cop/bundler/duplicated_group_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Bundler::DuplicatedGroup, :config do let(:cop_config) { { 'Include' => ['**/Gemfile'] } } context 'when investigating Ruby files' do it 'does not register any offenses' do expect_no_offenses(<<~RUBY, 'foo.rb') # cop will not read these c...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/bundler/gem_filename_spec.rb
spec/rubocop/cop/bundler/gem_filename_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Bundler::GemFilename, :config do shared_examples 'invalid gem file' do |message| it 'registers an offense' do offenses = _investigate(cop, processed_source) expect(offenses.size).to eq(1) expect(offenses.first.message).to eq(message) ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/bundler/gem_comment_spec.rb
spec/rubocop/cop/bundler/gem_comment_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Bundler::GemComment, :config do let(:cop_config) do { 'Include' => ['**/Gemfile'], 'IgnoredGems' => ['rake'], 'OnlyFor' => [] } end context 'when investigating Ruby files' do it 'does not register any offenses' do exp...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/bundler/duplicated_gem_spec.rb
spec/rubocop/cop/bundler/duplicated_gem_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Bundler::DuplicatedGem, :config do let(:cop_config) { { 'Include' => ['**/Gemfile'] } } context 'when investigating Ruby files' do it 'does not register any offenses' do expect_no_offenses(<<~RUBY, 'foo.rb') # cop will not read these con...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/bundler/insecure_protocol_source_spec.rb
spec/rubocop/cop/bundler/insecure_protocol_source_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Bundler::InsecureProtocolSource, :config do it 'registers an offense when using `source :gemcutter`' do expect_offense(<<~RUBY) source :gemcutter ^^^^^^^^^^ The source `:gemcutter` is deprecated [...] 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/bundler/ordered_gems_spec.rb
spec/rubocop/cop/bundler/ordered_gems_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Bundler::OrderedGems, :config do let(:cop_config) { { 'TreatCommentsAsGroupSeparators' => treat_comments_as_group_separators } } let(:treat_comments_as_group_separators) { false } context 'When gems are alphabetically sorted' do it 'does not registe...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/naming/constant_name_spec.rb
spec/rubocop/cop/naming/constant_name_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Naming::ConstantName, :config do it 'registers an offense for camel case in const name' do expect_offense(<<~RUBY) TopCase = 5 ^^^^^^^ Use SCREAMING_SNAKE_CASE for constants. RUBY end it 'registers an offense for camel case in const ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/naming/ascii_identifiers_spec.rb
spec/rubocop/cop/naming/ascii_identifiers_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Naming::AsciiIdentifiers, :config do shared_examples 'checks identifiers' do it 'registers an offense for a variable name with non-ascii chars' do expect_offense(<<~RUBY) älg = 1 ^ Use only ascii symbols in identifiers. RUBY ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/naming/inclusive_language_spec.rb
spec/rubocop/cop/naming/inclusive_language_spec.rb
# 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...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/naming/method_name_spec.rb
spec/rubocop/cop/naming/method_name_spec.rb
# 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 ^^^^^^...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/naming/variable_number_spec.rb
spec/rubocop/cop/naming/variable_number_spec.rb
# 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...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/naming/memoized_instance_variable_name_spec.rb
spec/rubocop/cop/naming/memoized_instance_variable_name_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Naming::MemoizedInstanceVariableName, :config do it 'does not register an offense when or-assignment-based memoization is used outside a method definition' do expect_no_offenses(<<~RUBY) @x ||= y RUBY end context 'with default EnforcedStyl...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
true
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/naming/heredoc_delimiter_naming_spec.rb
spec/rubocop/cop/naming/heredoc_delimiter_naming_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Naming::HeredocDelimiterNaming, :config do let(:cop_config) { { 'ForbiddenDelimiters' => %w[END] } } context 'with an interpolated heredoc' do it 'registers an offense with a non-meaningful delimiter' do expect_offense(<<~RUBY) <<-END ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/naming/binary_operator_parameter_name_spec.rb
spec/rubocop/cop/naming/binary_operator_parameter_name_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Naming::BinaryOperatorParameterName, :config do it 'registers an offense and corrects for `#+` when argument is not named other' do expect_offense(<<~RUBY) def +(foo); end ^^^ When defining the `+` operator, name its argument `other`. ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/naming/accessor_method_name_spec.rb
spec/rubocop/cop/naming/accessor_method_name_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Naming::AccessorMethodName, :config do it 'registers an offense for method get_something with no args' do expect_offense(<<~RUBY) def get_something ^^^^^^^^^^^^^ Do not prefix reader method names with `get_`. # ... end R...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/naming/class_and_module_camel_case_spec.rb
spec/rubocop/cop/naming/class_and_module_camel_case_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Naming::ClassAndModuleCamelCase, :config do it 'registers an offense for underscore in class and module name' do expect_offense(<<~RUBY) class My_Class ^^^^^^^^ Use CamelCase for classes and modules. end module My_Module ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/naming/predicate_method_spec.rb
spec/rubocop/cop/naming/predicate_method_spec.rb
# 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...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/naming/block_forwarding_spec.rb
spec/rubocop/cop/naming/block_forwarding_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Naming::BlockForwarding, :config do context 'when `EnforcedStyle: anonymous' do let(:cop_config) { { 'EnforcedStyle' => 'anonymous' } } context 'Ruby >= 3.1', :ruby31 do it 'registers and corrects an offense when using explicit block forwardin...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/naming/variable_name_spec.rb
spec/rubocop/cop/naming/variable_name_spec.rb
# 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...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/naming/block_parameter_name_spec.rb
spec/rubocop/cop/naming/block_parameter_name_spec.rb
# 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...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/naming/rescued_exceptions_variable_name_spec.rb
spec/rubocop/cop/naming/rescued_exceptions_variable_name_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Naming::RescuedExceptionsVariableName, :config do context 'with default config' do context 'with explicit rescue' do context 'with `Exception` variable' do it 'registers an offense when using `exc`' 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/naming/file_name_spec.rb
spec/rubocop/cop/naming/file_name_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Naming::FileName, :config do let(:config) do RuboCop::Config.new( { 'AllCops' => { 'Include' => includes }, described_class.badge.to_s => cop_config }, '/some/.rubocop.yml' ) end let(:cop_config) do # matches default.yml {...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/naming/predicate_prefix_spec.rb
spec/rubocop/cop/naming/predicate_prefix_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Naming::PredicatePrefix, :config do context 'with restricted prefixes' do let(:cop_config) { { 'NamePrefix' => %w[has_ is_], 'ForbiddenPrefixes' => %w[has_ is_] } } it 'registers an offense when method name starts with "is"' do expect_offense(...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/naming/method_parameter_name_spec.rb
spec/rubocop/cop/naming/method_parameter_name_spec.rb
# 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) ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/naming/heredoc_delimiter_case_spec.rb
spec/rubocop/cop/naming/heredoc_delimiter_case_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Naming::HeredocDelimiterCase, :config do context 'when enforced style is uppercase' do let(:cop_config) do { 'SupportedStyles' => %w[uppercase lowercase], 'EnforcedStyle' => 'uppercase' } end context 'with an interpol...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/variable_force/reference_spec.rb
spec/rubocop/cop/variable_force/reference_spec.rb
# frozen_string_literal: true require 'rubocop/ast/sexp' RSpec.describe RuboCop::Cop::VariableForce::Reference do include RuboCop::AST::Sexp describe '.new' do context 'when non variable reference node is passed' do it 'raises error' do node = s(:def) scope = RuboCop::Cop::VariableForce...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/variable_force/scope_spec.rb
spec/rubocop/cop/variable_force/scope_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::VariableForce::Scope do include RuboCop::AST::Sexp subject(:scope) { described_class.new(scope_node) } let(:ast) { RuboCop::ProcessedSource.new(source, ruby_version, parser_engine: parser_engine).ast } let(:scope_node) { ast.each_node(scope_node_typ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/variable_force/variable_spec.rb
spec/rubocop/cop/variable_force/variable_spec.rb
# frozen_string_literal: true require 'rubocop/ast/sexp' RSpec.describe RuboCop::Cop::VariableForce::Variable do include RuboCop::AST::Sexp describe '.new' do context 'when non variable declaration node is passed' do it 'raises error' do name = :foo declaration_node = s(:def) sc...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/variable_force/variable_table_spec.rb
spec/rubocop/cop/variable_force/variable_table_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::VariableForce::VariableTable do include RuboCop::AST::Sexp subject(:variable_table) { described_class.new } describe '#push_scope' do it 'returns pushed scope object' do node = s(:def) scope = variable_table.push_scope(node) expec...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cop/variable_force/assignment_spec.rb
spec/rubocop/cop/variable_force/assignment_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Cop::VariableForce::Assignment do include RuboCop::AST::Sexp let(:ast) { RuboCop::ProcessedSource.new(source, ruby_version, parser_engine: parser_engine).ast } let(:source) do <<~RUBY class SomeClass def some_method(flag) puts 'H...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/server/rubocop_server_spec.rb
spec/rubocop/server/rubocop_server_spec.rb
# frozen_string_literal: true require 'open3' RSpec.describe 'rubocop --server', :isolated_environment do # rubocop:disable RSpec/DescribeClass let(:rubocop) { "#{RuboCop::ConfigLoader::RUBOCOP_HOME}/exe/rubocop" } include_context 'cli spec behavior' before do # Makes sure the project dir of rubocop serve...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/server/cli_spec.rb
spec/rubocop/server/cli_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Server::CLI, :isolated_environment do subject(:cli) { described_class.new } include_context 'cli spec behavior' if RuboCop::Server.support_server? before do allow_any_instance_of(RuboCop::Server::Core).to receive(:server_mode?).and_return(false) #...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/server/cache_spec.rb
spec/rubocop/server/cache_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Server::Cache do subject(:cache_class) { described_class } include_context 'cli spec behavior' describe '.cache_path' do context 'when cache root path is not specified as default' do before do cache_class.cache_root_path = nil end ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/server/client_command/exec_spec.rb
spec/rubocop/server/client_command/exec_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Server::ClientCommand::Exec do if RuboCop::Server.support_server? it 'does not read from $stdin when -s/--stdin not specified' do exec_command = described_class.new expect(ARGV).to receive(:include?).with('-s').and_return(false) expect(ARGV...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cli/autocorrect_spec.rb
spec/rubocop/cli/autocorrect_spec.rb
# frozen_string_literal: true RSpec.describe 'RuboCop::CLI --autocorrect', :isolated_environment do # rubocop:disable RSpec/DescribeClass subject(:cli) { RuboCop::CLI.new } include_context 'cli spec behavior' before do RuboCop::ConfigLoader.default_configuration = nil RuboCop::ConfigLoader.default_conf...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
true
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cli/disable_uncorrectable_spec.rb
spec/rubocop/cli/disable_uncorrectable_spec.rb
# frozen_string_literal: true RSpec.describe 'RuboCop::CLI --disable-uncorrectable', :isolated_environment do # rubocop:disable RSpec/DescribeClass subject(:cli) { RuboCop::CLI.new } include_context 'cli spec behavior' describe '--disable-uncorrectable' do let(:cli_opts) { %w[--autocorrect-all --format sim...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cli/auto_gen_config_spec.rb
spec/rubocop/cli/auto_gen_config_spec.rb
# frozen_string_literal: true RSpec.describe 'RuboCop::CLI --auto-gen-config', :isolated_environment do # rubocop:disable RSpec/DescribeClass subject(:cli) { RuboCop::CLI.new } include_context 'cli spec behavior' describe '--auto-gen-config' do before do RuboCop::Formatter::DisabledConfigFormatter.co...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
true
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cli/suggest_extensions_spec.rb
spec/rubocop/cli/suggest_extensions_spec.rb
# frozen_string_literal: true require 'timeout' RSpec.describe 'RuboCop::CLI SuggestExtensions', :isolated_environment do # rubocop:disable RSpec/DescribeClass subject(:cli) { RuboCop::CLI.new } include_context 'cli spec behavior' describe 'extension suggestions', :config do matcher :suggest_extensions do...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cli/options_spec.rb
spec/rubocop/cli/options_spec.rb
# frozen_string_literal: true require 'open3' RSpec.describe 'RuboCop::CLI options', :isolated_environment do # rubocop:disable RSpec/DescribeClass subject(:cli) { RuboCop::CLI.new } include_context 'cli spec behavior' let(:rubocop) { "#{RuboCop::ConfigLoader::RUBOCOP_HOME}/exe/rubocop" } before do Rub...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
true
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/fixtures/html_formatter/project/app/controllers/books_controller.rb
spec/fixtures/html_formatter/project/app/controllers/books_controller.rb
class BooksController < ApplicationController before_action :set_book, only: [:show, :edit, :update, :destroy] # GET /books # GET /books.json def index @books = Book.all end # GET /books/1 # GET /books/1.json def show end # GET /books/new def new @book = Book.new end # GET /books/1...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/fixtures/html_formatter/project/app/controllers/application_controller.rb
spec/fixtures/html_formatter/project/app/controllers/application_controller.rb
class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception # “Test encoding issues by using curly quotes” end
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/fixtures/html_formatter/project/app/models/book.rb
spec/fixtures/html_formatter/project/app/models/book.rb
class Book < ActiveRecord::Base def someMethod foo = bar = baz qux(quux.scan(/&amp;&lt;/)) Regexp.new(/\A<p>(.*)<\/p>\Z/m).match(full_document)[1] rescue full_document end end
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/fixtures/ruby_lsp/example.rb
spec/fixtures/ruby_lsp/example.rb
s = 'hi' puts s
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/fixtures/markdown_formatter/project/app/controllers/books_controller.rb
spec/fixtures/markdown_formatter/project/app/controllers/books_controller.rb
class BooksController < ApplicationController before_action :set_book, only: [:show, :edit, :update, :destroy] # GET /books # GET /books.json def index @books = Book.all end # GET /books/1 # GET /books/1.json def show end # GET /books/new def new @book = Book.new end # GET /books/1...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/fixtures/markdown_formatter/project/app/controllers/application_controller.rb
spec/fixtures/markdown_formatter/project/app/controllers/application_controller.rb
class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception # “Test encoding issues by using curly quotes” end
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/fixtures/markdown_formatter/project/app/models/book.rb
spec/fixtures/markdown_formatter/project/app/models/book.rb
class Book < ActiveRecord::Base def someMethod foo = bar = baz Regexp.new(/\A<p>(.*)<\/p>\Z/m).match(full_document)[1] rescue full_document end end
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/fixtures/markdown_formatter/project/app/models/shelf.rb
spec/fixtures/markdown_formatter/project/app/models/shelf.rb
# frozen_string_literal: true # Book class comment class Book < ActiveRecord::Base def some_method Regexp.new(%r{\A<p>(.*)</p>\Z}m).match(full_document)[1] rescue StandardError full_document end end
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/core_ext/string.rb
spec/core_ext/string.rb
# frozen_string_literal: true class String unless method_defined? :strip_margin # The method strips the characters preceding a special margin character. # Useful for HEREDOCs and other multi-line strings. # # @example # # code = <<-END.strip_margin('|') # |def test # | some...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/ruby_lsp/rubocop/addon_spec.rb
spec/ruby_lsp/rubocop/addon_spec.rb
# frozen_string_literal: true # NOTE: These don't work in Ruby LSP. return if RUBY_VERSION < '3.0' || RUBY_ENGINE == 'jruby' || RuboCop::Platform.windows? require 'ruby_lsp/internal' require 'ruby_lsp/rubocop/addon' # NOTE: ruby-lsp enables LSP mode. Ideally the two requires should happen in isolation, but # for now ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop.rb
lib/rubocop.rb
# frozen_string_literal: true require 'English' # fileutils is autoloaded by pathname, # but must be explicitly loaded here for inclusion in `$LOADED_FEATURES`. require 'fileutils' before_us = $LOADED_FEATURES.dup require 'rainbow' require 'regexp_parser' require 'set' require 'stringio' require 'unicode/display_wi...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
true
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/feature_loader.rb
lib/rubocop/feature_loader.rb
# frozen_string_literal: true module RuboCop # This class handles loading files (a.k.a. features in Ruby) specified # by `--require` command line option and `require` directive in the config. # # Normally, the given string is directly passed to `require`. If a string # beginning with `.` is given, it is assu...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/platform.rb
lib/rubocop/platform.rb
# frozen_string_literal: true module RuboCop # This module provides information on the platform that RuboCop is being run # on. module Platform def self.windows? /cygwin|mswin|mingw|bccwin|wince|emx/.match?(RbConfig::CONFIG['host_os']) end end end
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/arguments_env.rb
lib/rubocop/arguments_env.rb
# frozen_string_literal: true module RuboCop # This is a class that reads optional command line arguments to rubocop from environment variable. # @api private class ArgumentsEnv def self.read_as_arguments if (arguments = ENV.fetch('RUBOCOP_OPTS', '')).empty? [] else require 'shell...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/remote_config.rb
lib/rubocop/remote_config.rb
# frozen_string_literal: true require 'net/http' require 'time' module RuboCop # Common methods and behaviors for dealing with remote config files. # @api private class RemoteConfig attr_reader :uri CACHE_LIFETIME = 24 * 60 * 60 def initialize(url, cache_root) begin @uri = URI.parse(...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/version.rb
lib/rubocop/version.rb
# frozen_string_literal: true module RuboCop # This module holds the RuboCop version information. module Version STRING = '1.82.1' MSG = '%<version>s (using %<parser_version>s, ' \ 'rubocop-ast %<rubocop_ast_version>s, ' \ 'analyzing as Ruby %<target_ruby_version>s, ' \ 'runn...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/config_loader_resolver.rb
lib/rubocop/config_loader_resolver.rb
# frozen_string_literal: true require 'pathname' require 'yaml' require_relative 'plugin' module RuboCop # A help class for ConfigLoader that handles configuration resolution. # @api private class ConfigLoaderResolver # rubocop:disable Metrics/ClassLength def resolve_plugins(rubocop_config, plugins) p...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/config_regeneration.rb
lib/rubocop/config_regeneration.rb
# frozen_string_literal: true module RuboCop # This class handles collecting the options for regenerating a TODO file. # @api private class ConfigRegeneration AUTO_GENERATED_FILE = RuboCop::CLI::Command::AutoGenerateConfig::AUTO_GENERATED_FILE COMMAND_REGEX = /(?<=`rubocop )(.*?)(?=`)/.freeze DEFAULT...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/lockfile.rb
lib/rubocop/lockfile.rb
# frozen_string_literal: true begin # We might not be running with `bundle exec`, so we need to pull in Bundler ourselves, # in order to use `Bundler::LockfileParser`. require 'bundler' rescue LoadError nil end module RuboCop # Encapsulation of a lockfile for use when checking for gems. # Does not actuall...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/config_validator.rb
lib/rubocop/config_validator.rb
# frozen_string_literal: true module RuboCop # Handles validation of configuration, for example cop names, parameter # names, and Ruby versions. # rubocop:disable Metrics/ClassLength class ConfigValidator extend SimpleForwardable # @api private COMMON_PARAMS = %w[Exclude Include Severity inherit_m...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/options.rb
lib/rubocop/options.rb
# frozen_string_literal: true require 'optparse' require_relative 'arguments_env' require_relative 'arguments_file' module RuboCop class IncorrectCopNameError < StandardError; end class OptionArgumentError < StandardError; end # This class handles command line options. # @api private class Options E_S...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/config_obsoletion.rb
lib/rubocop/config_obsoletion.rb
# frozen_string_literal: true module RuboCop # This class handles obsolete configuration. # @api private class ConfigObsoletion DEFAULT_RULES_FILE = File.join(ConfigLoader::RUBOCOP_HOME, 'config', 'obsoletion.yml') COP_RULE_CLASSES = { 'renamed' => RenamedCop, 'removed' => RemovedCop, '...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/file_finder.rb
lib/rubocop/file_finder.rb
# frozen_string_literal: true require 'pathname' module RuboCop # Common methods for finding files. # @api private module FileFinder class << self attr_accessor :root_level end def find_file_upwards(filename, start_dir, stop_dir = nil) traverse_files_upwards(filename, start_dir, stop_di...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/lsp.rb
lib/rubocop/lsp.rb
# frozen_string_literal: true module RuboCop # The RuboCop's built-in LSP module. module LSP module_function # Returns true when LSP is enabled, false when disabled. # # @return [Boolean] def enabled? @enabled ||= false end # Enable LSP. # # @return [void] def enable...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/config_loader.rb
lib/rubocop/config_loader.rb
# frozen_string_literal: true require 'erb' require 'yaml' require_relative 'config_finder' module RuboCop # Raised when a RuboCop configuration file is not found. class ConfigNotFoundError < Error end # This class represents the configuration of the RuboCop application # and all its cops. A Config is asso...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/pending_cops_reporter.rb
lib/rubocop/pending_cops_reporter.rb
# frozen_string_literal: true module RuboCop # Reports information about pending cops that are not explicitly configured. # # This class is responsible for displaying warnings when new cops have been added to RuboCop # but have not yet been enabled or disabled in the user's configuration. # It provides a cen...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/path_util.rb
lib/rubocop/path_util.rb
# frozen_string_literal: true module RuboCop # Common methods and behaviors for dealing with paths. module PathUtil class << self attr_accessor :relative_paths_cache end self.relative_paths_cache = Hash.new { |hash, key| hash[key] = {} } module_function def relative_path(path, base_dir ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false