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/lib/rubocop/cop/style/swap_values.rb
lib/rubocop/cop/style/swap_values.rb
# frozen_string_literal: true module RuboCop module Cop module Style # Enforces the use of shorthand-style swapping of 2 variables. # # @safety # Autocorrection is unsafe, because the temporary variable used to # swap variables will be removed, but may be referred to elsewhere. ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/redundant_string_escape.rb
lib/rubocop/cop/style/redundant_string_escape.rb
# frozen_string_literal: true module RuboCop module Cop module Style # Checks for redundant escapes in string literals. # # @example # # bad - no need to escape # without following {/$/@ # "\#foo" # # # bad - no need to escape single quotes inside double quoted str...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/trailing_body_on_method_definition.rb
lib/rubocop/cop/style/trailing_body_on_method_definition.rb
# frozen_string_literal: true module RuboCop module Cop module Style # Checks for trailing code after the method definition. # # NOTE: It always accepts endless method definitions that are basically on the same line. # # @example # # bad # def some_method; do_stuff ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/redundant_regexp_escape.rb
lib/rubocop/cop/style/redundant_regexp_escape.rb
# frozen_string_literal: true module RuboCop module Cop module Style # Checks for redundant escapes inside `Regexp` literals. # # @example # # bad # %r{foo\/bar} # # # good # %r{foo/bar} # # # good # /foo\/bar/ # # # good...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/hash_like_case.rb
lib/rubocop/cop/style/hash_like_case.rb
# frozen_string_literal: true module RuboCop module Cop module Style # Checks for places where `case-when` represents a simple 1:1 # mapping and can be replaced with a hash lookup. # # @example MinBranchesCount: 3 (default) # # bad # case country # when 'europe' ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/object_then.rb
lib/rubocop/cop/style/object_then.rb
# frozen_string_literal: true module RuboCop module Cop module Style # Enforces the use of consistent method names # `Object#yield_self` or `Object#then`. # # @example EnforcedStyle: then (default) # # # bad # obj.yield_self { |x| x.do_something } # # #...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/access_modifier_declarations.rb
lib/rubocop/cop/style/access_modifier_declarations.rb
# frozen_string_literal: true module RuboCop module Cop module Style # Access modifiers should be declared to apply to a group of methods # or inline before each method, depending on configuration. # EnforcedStyle config covers only method definitions. # Applications of visibility methods...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/infinite_loop.rb
lib/rubocop/cop/style/infinite_loop.rb
# frozen_string_literal: true module RuboCop module Cop module Style # Use `Kernel#loop` for infinite loops. # # @safety # This cop is unsafe as the rule should not necessarily apply if the loop # body might raise a `StopIteration` exception; contrary to other infinite # ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/constant_visibility.rb
lib/rubocop/cop/style/constant_visibility.rb
# frozen_string_literal: true module RuboCop module Cop module Style # Checks that constants defined in classes and modules have # an explicit visibility declaration. By default, Ruby makes all class- # and module constants public, which litters the public API of the # class or module. Ex...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/one_line_conditional.rb
lib/rubocop/cop/style/one_line_conditional.rb
# frozen_string_literal: true module RuboCop module Cop module Style # Checks for uses of if/then/else/end constructs on a single line. # `AlwaysCorrectToMultiline` config option can be set to true to autocorrect all offenses to # multi-line constructs. When `AlwaysCorrectToMultiline` is false ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/word_array.rb
lib/rubocop/cop/style/word_array.rb
# frozen_string_literal: true module RuboCop module Cop module Style # Checks for array literals made up of word-like # strings, that are not using the %w() syntax. # # Alternatively, it can check for uses of the %w() syntax, in projects # which do not want to include that syntax. ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/single_line_methods.rb
lib/rubocop/cop/style/single_line_methods.rb
# frozen_string_literal: true module RuboCop module Cop module Style # Checks for single-line method definitions that contain a body. # It will accept single-line methods with no body. # # Endless methods added in Ruby 3.0 are also accepted by this cop. # # If `Style/EndlessMe...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/redundant_each.rb
lib/rubocop/cop/style/redundant_each.rb
# frozen_string_literal: true module RuboCop module Cop module Style # Checks for redundant `each`. # # @safety # This cop is unsafe, as it can produce false positives if the receiver # is not an `Enumerator`. # # @example # # # bad # array.each...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/parentheses_around_condition.rb
lib/rubocop/cop/style/parentheses_around_condition.rb
# frozen_string_literal: true module RuboCop module Cop module Style # Checks for the presence of superfluous parentheses around the # condition of if/unless/while/until. # # `AllowSafeAssignment` option for safe assignment. # By safe assignment we mean putting parentheses around ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/date_time.rb
lib/rubocop/cop/style/date_time.rb
# frozen_string_literal: true module RuboCop module Cop module Style # Checks for consistent usage of the `DateTime` class over the # `Time` class. This cop is disabled by default since these classes, # although highly overlapping, have particularities that make them not # replaceable in ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/lambda_call.rb
lib/rubocop/cop/style/lambda_call.rb
# frozen_string_literal: true module RuboCop module Cop module Style # Checks for use of the lambda.(args) syntax. # # @example EnforcedStyle: call (default) # # bad # lambda.(x, y) # # # good # lambda.call(x, y) # # @example EnforcedStyle: braces ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/case_equality.rb
lib/rubocop/cop/style/case_equality.rb
# frozen_string_literal: true module RuboCop module Cop module Style # Checks for uses of the case equality operator (`===`). # # If `AllowOnConstant` option is enabled, the cop will ignore violations when the receiver of # the case equality operator is a constant. # # If `All...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/comparable_between.rb
lib/rubocop/cop/style/comparable_between.rb
# frozen_string_literal: true module RuboCop module Cop module Style # Checks for logical comparison which can be replaced with `Comparable#between?`. # # NOTE: `Comparable#between?` is on average slightly slower than logical comparison, # although the difference generally isn't observabl...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/return_nil.rb
lib/rubocop/cop/style/return_nil.rb
# frozen_string_literal: true module RuboCop module Cop module Style # Enforces consistency between `return nil` and `return`. # # This cop is disabled by default. Because there seems to be a perceived semantic difference # between `return` and `return nil`. The former can be seen as just...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/ternary_parentheses.rb
lib/rubocop/cop/style/ternary_parentheses.rb
# frozen_string_literal: true module RuboCop module Cop module Style # Checks for the presence of parentheses around ternary # conditions. It is configurable to enforce inclusion or omission of # parentheses using `EnforcedStyle`. Omission is only enforced when # removing the parentheses ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/class_and_module_children.rb
lib/rubocop/cop/style/class_and_module_children.rb
# frozen_string_literal: true module RuboCop module Cop module Style # Checks that namespaced classes and modules are defined with a consistent style. # # With `nested` style, classes and modules should be defined separately (one constant # on each line, without `::`). With `compact` styl...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/symbol_literal.rb
lib/rubocop/cop/style/symbol_literal.rb
# frozen_string_literal: true module RuboCop module Cop module Style # Checks symbol literal syntax. # # @example # # # bad # :"symbol" # # # good # :symbol class SymbolLiteral < Base extend AutoCorrector MSG = 'Do not use strin...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/redundant_assignment.rb
lib/rubocop/cop/style/redundant_assignment.rb
# frozen_string_literal: true module RuboCop module Cop module Style # Checks for redundant assignment before returning. # # @example # # bad # def test # x = foo # x # end # # # bad # def test # if x # z = ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/redundant_exception.rb
lib/rubocop/cop/style/redundant_exception.rb
# frozen_string_literal: true module RuboCop module Cop module Style # Checks for `RuntimeError` as the argument of `raise`/`fail`. # # @example # # bad # raise RuntimeError, 'message' # raise RuntimeError.new('message') # # # good # raise 'message'...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/def_with_parentheses.rb
lib/rubocop/cop/style/def_with_parentheses.rb
# frozen_string_literal: true module RuboCop module Cop module Style # Checks for parentheses in the definition of a method, # that does not take any arguments. Both instance and # class/singleton methods are checked. # # @example # # # bad # def foo() # ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/optional_arguments.rb
lib/rubocop/cop/style/optional_arguments.rb
# frozen_string_literal: true module RuboCop module Cop module Style # Checks for optional arguments to methods # that do not come at the end of the argument list. # # @safety # This cop is unsafe because changing a method signature will # implicitly change behavior. ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/multiline_when_then.rb
lib/rubocop/cop/style/multiline_when_then.rb
# frozen_string_literal: true module RuboCop module Cop module Style # Checks uses of the `then` keyword # in multi-line when statements. # # @example # # bad # case foo # when bar then # end # # # good # case foo # when bar ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/each_with_object.rb
lib/rubocop/cop/style/each_with_object.rb
# frozen_string_literal: true module RuboCop module Cop module Style # Looks for inject / reduce calls where the passed in object is # returned at the end and so could be replaced by each_with_object without # the need to return the object at the end. # # However, we can't replace w...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/sole_nested_conditional.rb
lib/rubocop/cop/style/sole_nested_conditional.rb
# frozen_string_literal: true module RuboCop module Cop module Style # If the branch of a conditional consists solely of a conditional node, # its conditions can be combined with the conditions of the outer branch. # This helps to keep the nesting level from getting too deep. # # @e...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/slicing_with_range.rb
lib/rubocop/cop/style/slicing_with_range.rb
# frozen_string_literal: true module RuboCop module Cop module Style # Checks that arrays are not sliced with the redundant `ary[0..-1]`, replacing it with `ary`, # and ensures arrays are sliced with endless ranges instead of `ary[start..-1]` on Ruby 2.6+, # and with beginless ranges instead of...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/class_methods_definitions.rb
lib/rubocop/cop/style/class_methods_definitions.rb
# frozen_string_literal: true module RuboCop module Cop module Style # Enforces using `def self.method_name` or `class << self` to define class methods. # # @example EnforcedStyle: def_self (default) # # bad # class SomeClass # class << self # attr_accessor...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/endless_method.rb
lib/rubocop/cop/style/endless_method.rb
# frozen_string_literal: true module RuboCop module Cop module Style # Checks for endless methods. # # It can enforce endless method definitions whenever possible or with single line methods. # It can also disallow multiline endless method definitions or all endless definitions. # ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/raise_args.rb
lib/rubocop/cop/style/raise_args.rb
# frozen_string_literal: true module RuboCop module Cop module Style # Checks the args passed to `fail` and `raise`. # # Exploded style (default) enforces passing the exception class and message # arguments separately, rather than constructing an instance of the error. # # Com...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/redundant_sort_by.rb
lib/rubocop/cop/style/redundant_sort_by.rb
# frozen_string_literal: true module RuboCop module Cop module Style # Identifies places where `sort_by { ... }` can be replaced by # `sort`. # # @example # # bad # array.sort_by { |x| x } # array.sort_by do |var| # var # end # # # g...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/lambda.rb
lib/rubocop/cop/style/lambda.rb
# frozen_string_literal: true module RuboCop module Cop module Style # (by default) checks for uses of the lambda literal syntax for # single line lambdas, and the method call syntax for multiline lambdas. # It is configurable to enforce one of the styles for both single line # and multil...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/unless_logical_operators.rb
lib/rubocop/cop/style/unless_logical_operators.rb
# frozen_string_literal: true module RuboCop module Cop module Style # Checks for the use of logical operators in an `unless` condition. # It discourages such code, as the condition becomes more difficult # to read and understand. # # This cop supports two styles: # # - ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/hash_transform_values.rb
lib/rubocop/cop/style/hash_transform_values.rb
# frozen_string_literal: true module RuboCop module Cop module Style # Looks for uses of `+_.each_with_object({}) {...}+`, # `+_.map {...}.to_h+`, and `+Hash[_.map {...}]+` that are actually just # transforming the values of a hash, and tries to use a simpler & faster # call to `transform...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb
lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb
# frozen_string_literal: true module RuboCop module Cop module Style class MethodCallWithArgsParentheses # Style omit_parentheses # rubocop:disable Metrics/ModuleLength, Metrics/CyclomaticComplexity module OmitParentheses include RangeHelp TRAILING_WHITESPACE_RE...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/method_call_with_args_parentheses/require_parentheses.rb
lib/rubocop/cop/style/method_call_with_args_parentheses/require_parentheses.rb
# frozen_string_literal: true module RuboCop module Cop module Style class MethodCallWithArgsParentheses # Style require_parentheses module RequireParentheses REQUIRE_MSG = 'Use parentheses for method calls with arguments.' private_constant :REQUIRE_MSG privat...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/bisected_attr_accessor/macro.rb
lib/rubocop/cop/style/bisected_attr_accessor/macro.rb
# frozen_string_literal: true module RuboCop module Cop module Style class BisectedAttrAccessor # Representation of an `attr_reader`, `attr_writer` or `attr` macro # for use by `Style/BisectedAttrAccessor`. # @api private class Macro include VisibilityHelp ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/metrics/parameter_lists.rb
lib/rubocop/cop/metrics/parameter_lists.rb
# frozen_string_literal: true module RuboCop module Cop module Metrics # Checks for methods with too many parameters. # # The maximum number of parameters is configurable. # Keyword arguments can optionally be excluded from the total count, # as they add less complexity than positio...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/metrics/collection_literal_length.rb
lib/rubocop/cop/metrics/collection_literal_length.rb
# frozen_string_literal: true module RuboCop module Cop module Metrics # Checks for literals with extremely many entries. This is indicative of # configuration or data that may be better extracted somewhere else, like # a database, fetched from an API, or read from a non-code file (CSV, #...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/metrics/perceived_complexity.rb
lib/rubocop/cop/metrics/perceived_complexity.rb
# frozen_string_literal: true module RuboCop module Cop module Metrics # Tries to produce a complexity score that's a measure of the # complexity the reader experiences when looking at a method. For that # reason it considers `when` nodes as something that doesn't add as much # complexity...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/metrics/block_length.rb
lib/rubocop/cop/metrics/block_length.rb
# frozen_string_literal: true module RuboCop module Cop module Metrics # Checks if the length of a block exceeds some maximum value. # Comment lines can optionally be ignored. # The maximum allowed length is configurable. # The cop can be configured to ignore blocks passed to certain meth...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/metrics/block_nesting.rb
lib/rubocop/cop/metrics/block_nesting.rb
# frozen_string_literal: true module RuboCop module Cop module Metrics # Checks for excessive nesting of conditional and looping constructs. # # You can configure if blocks are considered using the `CountBlocks` and `CountModifierForms` # options. When both are set to `false` (the default...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/metrics/module_length.rb
lib/rubocop/cop/metrics/module_length.rb
# frozen_string_literal: true module RuboCop module Cop module Metrics # Checks if the length of a module exceeds some maximum value. # Comment lines can optionally be ignored. # The maximum allowed length is configurable. # # You can set constructs you want to fold with `CountAsOne...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/metrics/abc_size.rb
lib/rubocop/cop/metrics/abc_size.rb
# frozen_string_literal: true module RuboCop module Cop module Metrics # Checks that the ABC size of methods is not higher than the # configured maximum. The ABC size is based on assignments, branches # (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric # and https://en....
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/metrics/method_length.rb
lib/rubocop/cop/metrics/method_length.rb
# frozen_string_literal: true module RuboCop module Cop module Metrics # Checks if the length of a method exceeds some maximum value. # Comment lines can optionally be allowed. # The maximum allowed length is configurable. # # You can set constructs you want to fold with `CountAsOne...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/metrics/cyclomatic_complexity.rb
lib/rubocop/cop/metrics/cyclomatic_complexity.rb
# frozen_string_literal: true module RuboCop module Cop module Metrics # Checks that the cyclomatic complexity of methods is not higher # than the configured maximum. The cyclomatic complexity is the number of # linearly independent paths through a method. The algorithm counts # decision ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/metrics/class_length.rb
lib/rubocop/cop/metrics/class_length.rb
# frozen_string_literal: true module RuboCop module Cop module Metrics # Checks if the length of a class exceeds some maximum value. # Comment lines can optionally be ignored. # The maximum allowed length is configurable. # # You can set constructs you want to fold with `CountAsOne`...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/metrics/utils/code_length_calculator.rb
lib/rubocop/cop/metrics/utils/code_length_calculator.rb
# frozen_string_literal: true module RuboCop module Cop module Metrics module Utils # Helps to calculate code length for the provided node. class CodeLengthCalculator extend NodePattern::Macros include Util FOLDABLE_TYPES = %i[array hash heredoc method_call].f...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/metrics/utils/iterating_block.rb
lib/rubocop/cop/metrics/utils/iterating_block.rb
# frozen_string_literal: true module RuboCop module Cop module Metrics module Utils # Used to identify iterating blocks like `.map{}` and `.map(&:...)` module IteratingBlock enumerable = %i[ all? any? chain chunk chunk_while collect collect_concat count cycle ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/metrics/utils/repeated_csend_discount.rb
lib/rubocop/cop/metrics/utils/repeated_csend_discount.rb
# frozen_string_literal: true module RuboCop module Cop module Metrics module Utils # @api private # # Identifies repetitions `&.` on the same variable: # # my_var&.foo # my_var&.bar # => repeated # my_var = baz # => reset # my_var&.qux # ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/metrics/utils/repeated_attribute_discount.rb
lib/rubocop/cop/metrics/utils/repeated_attribute_discount.rb
# frozen_string_literal: true module RuboCop module Cop module Metrics module Utils # @api private # # Identifies repetitions `{c}send` calls with no arguments: # # foo.bar # foo.bar # => repeated # foo.bar.baz.qux # => inner send repeated ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb
lib/rubocop/cop/metrics/utils/abc_size_calculator.rb
# frozen_string_literal: true module RuboCop module Cop module Metrics module Utils # > ABC is .. a software size metric .. computed by counting the number # > of assignments, branches and conditions for a section of code. # > http://c2.com/cgi/wiki?AbcMetric # # We ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/internal_affairs/cop_description.rb
lib/rubocop/cop/internal_affairs/cop_description.rb
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # Enforces the cop description to start with a word such as verb. # # @example # # bad # # This cop checks .... # class SomeCop < Base # .... # end # # # bad ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/internal_affairs/lambda_or_proc.rb
lib/rubocop/cop/internal_affairs/lambda_or_proc.rb
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # Enforces the use of `node.lambda_or_proc?` instead of `node.lambda? || node.proc?`. # # @example # # bad # node.lambda? || node.proc? # node.proc? || node.lambda? # # # good ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/internal_affairs/useless_message_assertion.rb
lib/rubocop/cop/internal_affairs/useless_message_assertion.rb
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # Checks that cops are not tested using `described_class::MSG`. # # @example # # # bad # expect(cop.messages).to eq([described_class::MSG]) # # # good # expect(cop....
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/internal_affairs/numblock_handler.rb
lib/rubocop/cop/internal_affairs/numblock_handler.rb
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # Checks for missing `numblock` handlers. The blocks with numbered # arguments introduced in Ruby 2.7 are parsed with a node type of # `numblock` instead of block. Cops that define `block` handlers # need to de...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/internal_affairs/example_description.rb
lib/rubocop/cop/internal_affairs/example_description.rb
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # Checks that RSpec examples that use `expects_offense` # or `expects_no_offenses` do not have conflicting # descriptions. # # @example # # bad # it 'does not register an offense' do ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/internal_affairs/operator_keyword.rb
lib/rubocop/cop/internal_affairs/operator_keyword.rb
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # Enforces the use of `node.operator_keyword?` instead of `node.and_type? || node.or_type?`. # # @example # # bad # node.and_type? || node.or_type? # node.or_type? || node.and_type? # ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/internal_affairs/example_heredoc_delimiter.rb
lib/rubocop/cop/internal_affairs/example_heredoc_delimiter.rb
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # Use `RUBY` for heredoc delimiter of example Ruby code. # # Some editors may apply better syntax highlighting by using appropriate language names for # the delimiter. # # @example # # bad ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/internal_affairs/cop_enabled.rb
lib/rubocop/cop/internal_affairs/cop_enabled.rb
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # Use `config.cop_enabled?('Department/CopName')` instead of # traversing the config hash. # # @example # # `for_cop(...)['Enabled'] # # # bad # config.for_cop('Department/CopName'...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/internal_affairs/node_pattern_groups.rb
lib/rubocop/cop/internal_affairs/node_pattern_groups.rb
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # Use node groups (`any_block`, `argument`, `boolean`, `call`, `numeric`, `range`) # in node patterns instead of a union (`{ ... }`) of the member types of the group. # # @example # # bad # def_...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/internal_affairs/method_name_end_with.rb
lib/rubocop/cop/internal_affairs/method_name_end_with.rb
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # Checks potentially usage of method identifier predicates # defined in rubocop-ast instead of `method_name.end_with?`. # # @example # # bad # node.method_name.to_s.end_with?('=') # ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/internal_affairs/undefined_config.rb
lib/rubocop/cop/internal_affairs/undefined_config.rb
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # Looks for references to a cop configuration key that isn't defined in config/default.yml. class UndefinedConfig < Base # `FileFinder` is a private API not intended to be used by cops, # but it's fine for ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/internal_affairs/empty_line_between_expect_offense_and_correction.rb
lib/rubocop/cop/internal_affairs/empty_line_between_expect_offense_and_correction.rb
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # Checks whether `expect_offense` and correction expectation methods # (i.e. `expect_correction` and `expect_no_corrections`) are separated by empty line. # # @example # # bad # it 'registers an...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/internal_affairs/redundant_context_config_parameter.rb
lib/rubocop/cop/internal_affairs/redundant_context_config_parameter.rb
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # Checks for redundant `:config` parameter in the `context` arguments. # # @example # # # bad # context 'foo', :config do # end # # # good # context 'foo' do ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/internal_affairs/node_matcher_directive.rb
lib/rubocop/cop/internal_affairs/node_matcher_directive.rb
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # Checks that node matcher definitions are tagged with a YARD `@!method` # directive so that editors are able to find the dynamically defined # method. # # @example # # bad # def_node_matche...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/internal_affairs/redundant_message_argument.rb
lib/rubocop/cop/internal_affairs/redundant_message_argument.rb
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # Checks for redundant message arguments to `#add_offense`. This method # will automatically use `#message` or `MSG` (in that order of priority) # if they are defined. # # @example # # # bad...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/internal_affairs/plugin.rb
lib/rubocop/cop/internal_affairs/plugin.rb
# frozen_string_literal: true require 'lint_roller' module RuboCop module InternalAffairs # A Plugin for `InternalAffairs` department, which has internal cops. class Plugin < LintRoller::Plugin def about LintRoller::About.new( name: 'rubocop-internal_affairs', version: Vers...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/internal_affairs/node_type_multiple_predicates.rb
lib/rubocop/cop/internal_affairs/node_type_multiple_predicates.rb
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # Use `node.type?(:foo, :bar)` instead of `node.foo_type? || node.bar_type?`, # and `!node.type?(:foo, :bar)` instead of `!node.foo_type? && !node.bar_type?`. # # @example # # # bad # node...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/internal_affairs/redundant_described_class_as_subject.rb
lib/rubocop/cop/internal_affairs/redundant_described_class_as_subject.rb
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # Checks for redundant `subject(:cop) { described_class.new }`. # # @example # # bad # RSpec.describe RuboCop::Cop::Department::Foo do # subject(:cop) { described_class.new(config) } #...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/internal_affairs/redundant_let_rubocop_config_new.rb
lib/rubocop/cop/internal_affairs/redundant_let_rubocop_config_new.rb
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # Checks that `let` is `RuboCop::Config.new` with no arguments. # # @example # # bad # RSpec.describe RuboCop::Cop::Department::Foo, :config do # let(:config) { RuboCop::Config.new } #...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/internal_affairs/method_name_equal.rb
lib/rubocop/cop/internal_affairs/method_name_equal.rb
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # Checks that method names are checked using `method?` method. # # @example # # bad # node.method_name == :do_something # # # good # node.method?(:do_something) # # ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/internal_affairs/node_type_group.rb
lib/rubocop/cop/internal_affairs/node_type_group.rb
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # Checks that node types are checked against their group when all types of a # group are checked. # # @example # # bad # node.type?(:irange, :erange) # # # good # node.rang...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/internal_affairs/node_destructuring.rb
lib/rubocop/cop/internal_affairs/node_destructuring.rb
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # Checks that node destructuring is using the node extensions. # # @example Using splat expansion # # # bad # _receiver, method_name, _arguments = send_node.children # # # bad ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/internal_affairs/redundant_source_range.rb
lib/rubocop/cop/internal_affairs/redundant_source_range.rb
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # Checks for redundant `source_range`. # # @example # # # bad # node.source_range.source # # # good # node.source # # # bad # add_offense(node.source_...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/internal_affairs/on_send_without_on_csend.rb
lib/rubocop/cop/internal_affairs/on_send_without_on_csend.rb
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # Checks for cops that define `on_send` without define `on_csend`. # # Although in some cases it can be predetermined that safe navigation # will never be used with the code checked by a specific cop, in genera...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/internal_affairs/location_expression.rb
lib/rubocop/cop/internal_affairs/location_expression.rb
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # Enforces the use of `node.source_range` instead of `node.location.expression`. # # @example # # # bad # node.location.expression # node.loc.expression # # # good # ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/internal_affairs/offense_location_keyword.rb
lib/rubocop/cop/internal_affairs/offense_location_keyword.rb
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # Checks for potential uses of the location keywords which can be used as # shortcut arguments to `#add_offense`. # # @example # # # bad # add_offense(node, location: node.loc.selector) ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/internal_affairs/node_first_or_last_argument.rb
lib/rubocop/cop/internal_affairs/node_first_or_last_argument.rb
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # Checks for the use of `node.arguments.first` or `node.arguments.last` and # suggests the use of `node.first_argument` or `node.last_argument` instead. # # @example # # bad # node.arguments.fir...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/internal_affairs/redundant_method_dispatch_node.rb
lib/rubocop/cop/internal_affairs/redundant_method_dispatch_node.rb
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # Checks for redundant `send_node` method dispatch node. # # @example # # # bad # node.send_node.method_name # # # good # node.method_name # # # bad # ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/internal_affairs/node_type_predicate.rb
lib/rubocop/cop/internal_affairs/node_type_predicate.rb
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # Checks that node types are checked using the predicate helpers. # # @example # # # bad # node.type == :send # # # good # node.send_type? # class NodeTypePredi...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/internal_affairs/processed_source_buffer_name.rb
lib/rubocop/cop/internal_affairs/processed_source_buffer_name.rb
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # Enforces the use of `processed_source.file_path` instead of `processed_source.buffer.name`. # # @example # # # bad # processed_source.buffer.name # # # good # processed_s...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/internal_affairs/location_line_equality_comparison.rb
lib/rubocop/cop/internal_affairs/location_line_equality_comparison.rb
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # Enforces the use of `same_line?` instead of location line comparison for equality. # # @example # # bad # node.loc.line == node.parent.loc.line # # # bad # node.loc.first_line ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/internal_affairs/inherit_deprecated_cop_class.rb
lib/rubocop/cop/internal_affairs/inherit_deprecated_cop_class.rb
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # `RuboCop::Cop::Cop` is deprecated and will be removed in RuboCop 2.0. # Your custom cop class should inherit from `RuboCop::Cop::Base` instead of # `RuboCop::Cop::Cop`. # # See "v1 Upgrade Notes" for mo...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/internal_affairs/style_detected_api_use.rb
lib/rubocop/cop/internal_affairs/style_detected_api_use.rb
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # Checks for correct use of the style_detected API provided by # `ConfigurableEnforcedStyle`. If `correct_style_detected` is used # then `opposite_style_detected`, `unexpected_style_detected`, # `ambiguous_styl...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/internal_affairs/redundant_location_argument.rb
lib/rubocop/cop/internal_affairs/redundant_location_argument.rb
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # Checks for redundant `location` argument to `#add_offense`. `location` # argument has a default value of `:expression` and this method will # automatically use it. # # @example # # # bad ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/internal_affairs/redundant_expect_offense_arguments.rb
lib/rubocop/cop/internal_affairs/redundant_expect_offense_arguments.rb
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # Checks for redundant arguments of `RuboCop::RSpec::ExpectOffense`'s methods. # # @example # # # bad # expect_no_offenses('code', keyword: keyword) # # # good # expect_no_...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/internal_affairs/location_exists.rb
lib/rubocop/cop/internal_affairs/location_exists.rb
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # When a node location may not exist, `Node#loc?` or `Node#loc_is?` # can be used instead of calling `Node#respond_to?` before using # the value. # # @example # # bad # node.loc.respond_to...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/internal_affairs/single_line_comparison.rb
lib/rubocop/cop/internal_affairs/single_line_comparison.rb
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # Enforces the use of `node.single_line?` instead of # comparing `first_line` and `last_line` for equality. # # @example # # bad # node.loc.first_line == node.loc.last_line # # # b...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/internal_affairs/create_empty_file.rb
lib/rubocop/cop/internal_affairs/create_empty_file.rb
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # Checks for uses of `create_file` with empty string second argument. # # @example # # # bad # create_file(path, '') # # # good # create_empty_file(path) # clas...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/internal_affairs/useless_restrict_on_send.rb
lib/rubocop/cop/internal_affairs/useless_restrict_on_send.rb
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # Checks for useless `RESTRICT_ON_SEND`. # # @example # # bad # class FooCop # RESTRICT_ON_SEND = %i[bad_method].freeze # end # # # good # class FooCop # ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/internal_affairs/node_pattern_groups/ast_walker.rb
lib/rubocop/cop/internal_affairs/node_pattern_groups/ast_walker.rb
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # rubocop:disable InternalAffairs/RedundantSourceRange -- node here is a `NodePattern::Node` class NodePatternGroups # Walks an AST that has been processed by `InternalAffairs::NodePatternGroups::Processor` ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/internal_affairs/node_pattern_groups/ast_processor.rb
lib/rubocop/cop/internal_affairs/node_pattern_groups/ast_processor.rb
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs class NodePatternGroups # AST Processor for NodePattern ASTs, for use with `InternalAffairs/NodePatternGroups`. # # Looks for sequences and subsequences where the first item is a `node_type` node, ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/correctors/empty_line_corrector.rb
lib/rubocop/cop/correctors/empty_line_corrector.rb
# frozen_string_literal: true module RuboCop module Cop # This class does empty line autocorrection class EmptyLineCorrector class << self def correct(corrector, node) offense_style, range = node case offense_style when :no_empty_lines corrector.remove...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/correctors/space_corrector.rb
lib/rubocop/cop/correctors/space_corrector.rb
# frozen_string_literal: true module RuboCop module Cop # This autocorrects whitespace class SpaceCorrector extend SurroundingSpace class << self attr_reader :processed_source def empty_corrections(processed_source, corrector, empty_config, left_tok...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/correctors/ordered_gem_corrector.rb
lib/rubocop/cop/correctors/ordered_gem_corrector.rb
# frozen_string_literal: true module RuboCop module Cop # This autocorrects gem dependency order class OrderedGemCorrector class << self include OrderedGemNode include RangeHelp attr_reader :processed_source, :comments_as_separators def correct(processed_source, node, ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/correctors/alignment_corrector.rb
lib/rubocop/cop/correctors/alignment_corrector.rb
# frozen_string_literal: true module RuboCop module Cop # This class does autocorrection of nodes that should just be moved to # the left or to the right, amount being determined by the instance # variable column_delta. class AlignmentCorrector extend RangeHelp extend Alignment cla...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false