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/layout/trailing_empty_lines.rb
lib/rubocop/cop/layout/trailing_empty_lines.rb
# frozen_string_literal: true module RuboCop module Cop module Layout # Looks for trailing blank lines and a final newline in the # source code. # # @example EnforcedStyle: final_newline (default) # # `final_newline` looks for one newline at the end of files. # # # b...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/multiline_hash_brace_layout.rb
lib/rubocop/cop/layout/multiline_hash_brace_layout.rb
# frozen_string_literal: true module RuboCop module Cop module Layout # Checks that the closing brace in a hash literal is either # on the same line as the last hash element, or a new line. # # When using the `symmetrical` (default) style: # # If a hash's opening brace is on t...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/space_inside_range_literal.rb
lib/rubocop/cop/layout/space_inside_range_literal.rb
# frozen_string_literal: true module RuboCop module Cop module Layout # Checks for spaces inside range literals. # # @example # # bad # 1 .. 3 # # # good # 1..3 # # # bad # 'a' .. 'z' # # # good # 'a'..'z' c...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/multiline_assignment_layout.rb
lib/rubocop/cop/layout/multiline_assignment_layout.rb
# frozen_string_literal: true module RuboCop module Cop module Layout # Checks whether the multiline assignments have a newline # after the assignment operator. # # @example EnforcedStyle: new_line (default) # # bad # foo = if expression # 'bar' # end ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/begin_end_alignment.rb
lib/rubocop/cop/layout/begin_end_alignment.rb
# frozen_string_literal: true module RuboCop module Cop module Layout # Checks whether the end keyword of `begin` is aligned properly. # # Two modes are supported through the `EnforcedStyleAlignWith` configuration # parameter. If it's set to `start_of_line` (which is the default), the ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/indentation_consistency.rb
lib/rubocop/cop/layout/indentation_consistency.rb
# frozen_string_literal: true module RuboCop module Cop module Layout # Checks for inconsistent indentation. # # The difference between `indented_internal_methods` and `normal` is # that the `indented_internal_methods` style prescribes that in # classes and modules the `protected` a...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/empty_line_between_defs.rb
lib/rubocop/cop/layout/empty_line_between_defs.rb
# frozen_string_literal: true module RuboCop module Cop module Layout # Checks whether class/module/method definitions are # separated by one or more empty lines. # # `NumberOfEmptyLines` can be an integer (default is 1) or # an array (e.g. [1, 2]) to specify a minimum and maximum ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/empty_lines_around_attribute_accessor.rb
lib/rubocop/cop/layout/empty_lines_around_attribute_accessor.rb
# frozen_string_literal: true module RuboCop module Cop module Layout # Checks for a newline after an attribute accessor or a group of them. # `alias` syntax and `alias_method`, `public`, `protected`, and `private` methods are allowed # by default. These are customizable with `AllowAliasSyntax`...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/multiline_method_call_indentation.rb
lib/rubocop/cop/layout/multiline_method_call_indentation.rb
# frozen_string_literal: true module RuboCop module Cop module Layout # Checks the indentation of the method name part in method calls # that span more than one line. # # @example EnforcedStyle: aligned (default) # # bad # while myvariable # .b # # do som...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/first_method_parameter_line_break.rb
lib/rubocop/cop/layout/first_method_parameter_line_break.rb
# frozen_string_literal: true module RuboCop module Cop module Layout # Checks for a line break before the first parameter in a # multi-line method parameter definition. # # @example # # # bad # def method(foo, bar, # baz) # do_something #...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/space_around_operators.rb
lib/rubocop/cop/layout/space_around_operators.rb
# frozen_string_literal: true module RuboCop module Cop module Layout # Checks that operators have space around them, except for ** which # should or shouldn't have surrounding space depending on configuration. # It allows vertical alignment consisting of one or more whitespace # around o...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/rescue_ensure_alignment.rb
lib/rubocop/cop/layout/rescue_ensure_alignment.rb
# frozen_string_literal: true module RuboCop module Cop module Layout # Checks whether the rescue and ensure keywords are aligned # properly. # # @example # # # bad # begin # something # rescue # puts 'error' # end # ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/empty_lines_around_arguments.rb
lib/rubocop/cop/layout/empty_lines_around_arguments.rb
# frozen_string_literal: true module RuboCop module Cop module Layout # Checks if empty lines exist around the arguments # of a method invocation. # # @example # # bad # do_something( # foo # # ) # # process(bar, # # ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/layout/empty_comment.rb
lib/rubocop/cop/layout/empty_comment.rb
# frozen_string_literal: true module RuboCop module Cop module Layout # Checks empty comment. # # @example # # bad # # # # class Foo # end # # # good # # # # # Description of `Foo` class. # # # class Foo ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/nil_methods.rb
lib/rubocop/cop/mixin/nil_methods.rb
# frozen_string_literal: true module RuboCop module Cop # This module provides a list of methods that are: # 1. In the NilClass by default # 2. Added to NilClass by explicitly requiring any standard libraries # 3. Cop's configuration parameter AllowedMethods. module NilMethods include Allow...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/hash_alignment_styles.rb
lib/rubocop/cop/mixin/hash_alignment_styles.rb
# frozen_string_literal: true module RuboCop module Cop # Common functionality for checking hash alignment. module HashAlignmentStyles # Handles calculation of deltas when the enforced style is 'key'. class KeyAlignment def checkable_layout?(_node) true end def ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/configurable_formatting.rb
lib/rubocop/cop/mixin/configurable_formatting.rb
# frozen_string_literal: true module RuboCop module Cop # Shared functionality between mixins that enforce naming conventions module ConfigurableFormatting include ConfigurableEnforcedStyle def check_name(node, name, name_range) if valid_name?(node, name) correct_style_detected...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/multiline_element_indentation.rb
lib/rubocop/cop/mixin/multiline_element_indentation.rb
# frozen_string_literal: true module RuboCop module Cop # Common code for indenting the first elements in multiline # array literals, hash literals, and method definitions. module MultilineElementIndentation private def each_argument_node(node, type) left_parenthesis = node.loc.begin...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/range_help.rb
lib/rubocop/cop/mixin/range_help.rb
# frozen_string_literal: true module RuboCop module Cop # Methods that calculate and return Parser::Source::Ranges module RangeHelp BYTE_ORDER_MARK = 0xfeff # The Unicode codepoint NOT_GIVEN = Module.new private def source_range(source_buffer, line_number, column, length = 1) ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/multiline_literal_brace_layout.rb
lib/rubocop/cop/mixin/multiline_literal_brace_layout.rb
# frozen_string_literal: true module RuboCop module Cop # Common functionality for checking the closing brace of a literal is # either on the same line as the last contained elements or a new line. module MultilineLiteralBraceLayout include ConfigurableEnforcedStyle private def check_...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/first_element_line_break.rb
lib/rubocop/cop/mixin/first_element_line_break.rb
# frozen_string_literal: true module RuboCop module Cop # Common functionality for checking for a line break before the first # element in a multi-line collection. module FirstElementLineBreak private def check_method_line_break(node, children, ignore_last: false) return if children....
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/check_single_line_suitability.rb
lib/rubocop/cop/mixin/check_single_line_suitability.rb
# frozen_string_literal: true module RuboCop module Cop # Checks for code on multiple lines that could be rewritten on a single line # without changing semantics or exceeding the `Max` parameter of `Layout/LineLength`. module CheckSingleLineSuitability def suitable_as_single_line?(node) !to...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/interpolation.rb
lib/rubocop/cop/mixin/interpolation.rb
# frozen_string_literal: true module RuboCop module Cop # Common functionality for working with string interpolations. # # @abstract Subclasses are expected to implement {#on_interpolation}. module Interpolation def on_dstr(node) on_node_with_interpolations(node) end alias ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/trailing_comma.rb
lib/rubocop/cop/mixin/trailing_comma.rb
# frozen_string_literal: true module RuboCop module Cop # Common methods shared by Style/TrailingCommaInArguments, # Style/TrailingCommaInArrayLiteral and Style/TrailingCommaInHashLiteral # rubocop:disable Metrics/ModuleLength module TrailingComma include ConfigurableEnforcedStyle include...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/unused_argument.rb
lib/rubocop/cop/mixin/unused_argument.rb
# frozen_string_literal: true module RuboCop module Cop module Lint # Common functionality for cops handling unused arguments. module UnusedArgument extend NodePattern::Macros def after_leaving_scope(scope, _variable_table) scope.variables.each_value { |variable| check_argu...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/allowed_receivers.rb
lib/rubocop/cop/mixin/allowed_receivers.rb
# frozen_string_literal: true module RuboCop module Cop # This module encapsulates the ability to allow certain receivers in a cop. module AllowedReceivers def allowed_receiver?(receiver) receiver_name = receiver_name(receiver) allowed_receivers.include?(receiver_name) end ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/min_branches_count.rb
lib/rubocop/cop/mixin/min_branches_count.rb
# frozen_string_literal: true module RuboCop module Cop # Common functionality for checking minimum branches count. module MinBranchesCount private def min_branches_count?(node) branches = if node.case_type? node.when_branches elsif node.if_type? ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/trailing_body.rb
lib/rubocop/cop/mixin/trailing_body.rb
# frozen_string_literal: true module RuboCop module Cop # Common methods shared by TrailingBody cops module TrailingBody def trailing_body?(node) body = node.to_a.reverse[0] body && node.multiline? && body_on_first_line?(node, body) end def body_on_first_line?(node, body) ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/configurable_enforced_style.rb
lib/rubocop/cop/mixin/configurable_enforced_style.rb
# frozen_string_literal: true module RuboCop module Cop # Handles `EnforcedStyle` configuration parameters. module ConfigurableEnforcedStyle def opposite_style_detected style_detected(alternative_style) end def correct_style_detected style_detected(style) end d...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/heredoc.rb
lib/rubocop/cop/mixin/heredoc.rb
# frozen_string_literal: true module RuboCop module Cop # Common functionality for working with heredoc strings. module Heredoc OPENING_DELIMITER = /(<<[~-]?)['"`]?([^'"`]+)['"`]?/.freeze def on_str(node) return unless node.heredoc? on_heredoc(node) end alias on_dstr...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/surrounding_space.rb
lib/rubocop/cop/mixin/surrounding_space.rb
# frozen_string_literal: true module RuboCop module Cop # Common functionality for checking and correcting surrounding whitespace. module SurroundingSpace include RangeHelp NO_SPACE_COMMAND = 'Do not use' SPACE_COMMAND = 'Use' SINGLE_SPACE_REGEXP = /[ \t]/.freeze private ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/on_normal_if_unless.rb
lib/rubocop/cop/mixin/on_normal_if_unless.rb
# frozen_string_literal: true module RuboCop module Cop # Common functionality for cops checking if and unless expressions. module OnNormalIfUnless def on_if(node) return if node.modifier_form? || node.ternary? on_normal_if_unless(node) end end end end
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/percent_literal.rb
lib/rubocop/cop/mixin/percent_literal.rb
# frozen_string_literal: true module RuboCop module Cop # Common functionality for handling percent literals. module PercentLiteral include RangeHelp private def percent_literal?(node) return false unless (begin_source = begin_source(node)) begin_source.start_with?('%') ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/allowed_identifiers.rb
lib/rubocop/cop/mixin/allowed_identifiers.rb
# frozen_string_literal: true module RuboCop module Cop # This module encapsulates the ability to allow certain identifiers in a cop. module AllowedIdentifiers SIGILS = '@$' # if a variable starts with a sigil it will be removed def allowed_identifier?(name) !allowed_identifiers.empty? &...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/string_literals_help.rb
lib/rubocop/cop/mixin/string_literals_help.rb
# frozen_string_literal: true module RuboCop module Cop # Common functionality for cops checking single/double quotes. module StringLiteralsHelp private def wrong_quotes?(src_or_node) src = src_or_node.is_a?(RuboCop::AST::Node) ? src_or_node.source : src_or_node return false if s...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/array_syntax.rb
lib/rubocop/cop/mixin/array_syntax.rb
# frozen_string_literal: true module RuboCop module Cop # Common code for ordinary arrays with [] that can be written with % # syntax. module ArraySyntax private def bracketed_array_of?(element_type, node) return false unless node.square_brackets? && !node.values.empty? node...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/uncommunicative_name.rb
lib/rubocop/cop/mixin/uncommunicative_name.rb
# frozen_string_literal: true module RuboCop module Cop # Common functionality shared by Uncommunicative cops module UncommunicativeName CASE_MSG = 'Only use lowercase characters for %<name_type>s.' NUM_MSG = 'Do not end %<name_type>s with a number.' LENGTH_MSG = '%<name_type>s must be at l...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/empty_parameter.rb
lib/rubocop/cop/mixin/empty_parameter.rb
# frozen_string_literal: true module RuboCop module Cop # Common code for empty parameter cops. module EmptyParameter extend NodePattern::Macros private # @!method empty_arguments?(node) def_node_matcher :empty_arguments?, <<~PATTERN (block _ $(args) _) PATTERN ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/gemspec_help.rb
lib/rubocop/cop/mixin/gemspec_help.rb
# frozen_string_literal: true module RuboCop module Cop # Common functionality for checking gem declarations. module GemspecHelp extend NodePattern::Macros # @!method gem_specification?(node) def_node_matcher :gem_specification?, <<~PATTERN (block (send (const...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/parentheses.rb
lib/rubocop/cop/mixin/parentheses.rb
# frozen_string_literal: true module RuboCop module Cop # Common functionality for handling parentheses. module Parentheses private def parens_required?(node) range = node.source_range source = range.source_buffer.source /[a-z]/.match?(source[range.begin_pos - 1]) || /[a...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/negative_conditional.rb
lib/rubocop/cop/mixin/negative_conditional.rb
# frozen_string_literal: true module RuboCop module Cop # Some common code shared between `NegatedIf` and # `NegatedWhile` cops. module NegativeConditional extend NodePattern::Macros MSG = 'Favor `%<inverse>s` over `%<current>s` for negative conditions.' private # @!method sing...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/rescue_node.rb
lib/rubocop/cop/mixin/rescue_node.rb
# frozen_string_literal: true module RuboCop module Cop # Common functionality for checking `rescue` nodes. module RescueNode def modifier_locations @modifier_locations ||= processed_source.tokens.select(&:rescue_modifier?).map!(&:pos) end private def rescue_modifier?(node) ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/gem_declaration.rb
lib/rubocop/cop/mixin/gem_declaration.rb
# frozen_string_literal: true module RuboCop module Cop # Common functionality for checking gem declarations. module GemDeclaration extend NodePattern::Macros # @!method gem_declaration?(node) def_node_matcher :gem_declaration?, '(send nil? :gem str ...)' end end end
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/space_before_punctuation.rb
lib/rubocop/cop/mixin/space_before_punctuation.rb
# frozen_string_literal: true module RuboCop module Cop # Common functionality for cops checking for space before # punctuation. module SpaceBeforePunctuation include RangeHelp MSG = 'Space found before %<token>s.' def on_new_investigation each_missing_space(processed_source.s...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/allowed_methods.rb
lib/rubocop/cop/mixin/allowed_methods.rb
# frozen_string_literal: true module RuboCop module Cop # This module encapsulates the ability to allow certain methods when # parsing. Even if the code is in offense, if it contains methods # that are allowed. This module is equivalent to the IgnoredMethods module, # which will be deprecated in Rubo...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/safe_assignment.rb
lib/rubocop/cop/mixin/safe_assignment.rb
# frozen_string_literal: true module RuboCop module Cop # Common functionality for safe assignment. By safe assignment we mean # putting parentheses around an assignment to indicate "I know I'm using an # assignment as a condition. It's not a mistake." module SafeAssignment extend NodePattern::...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/code_length.rb
lib/rubocop/cop/mixin/code_length.rb
# frozen_string_literal: true module RuboCop module Cop # Common functionality for checking length of code segments. module CodeLength extend ExcludeLimit MSG = '%<label>s has too many lines. [%<length>d/%<max>d]' exclude_limit 'Max' private def message(length, max_length) ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/target_ruby_version.rb
lib/rubocop/cop/mixin/target_ruby_version.rb
# frozen_string_literal: true module RuboCop module Cop # Common functionality for checking target ruby version. module TargetRubyVersion def required_minimum_ruby_version @minimum_target_ruby_version end def required_maximum_ruby_version @maximum_target_ruby_version ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/duplication.rb
lib/rubocop/cop/mixin/duplication.rb
# frozen_string_literal: true module RuboCop module Cop # Common functionality for dealing with duplication. module Duplication private # Whether the `collection` contains any duplicates. # # @param [Array] collection an array to check for duplicates # @return [Boolean] whether...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/alignment.rb
lib/rubocop/cop/mixin/alignment.rb
# frozen_string_literal: true module RuboCop module Cop # This module checks for nodes that should be aligned to the left or right. # This amount is determined by the instance variable @column_delta. module Alignment SPACE = ' ' private attr_reader :column_delta def configured_...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/percent_array.rb
lib/rubocop/cop/mixin/percent_array.rb
# frozen_string_literal: true module RuboCop module Cop # Common functionality for handling percent arrays. module PercentArray private # Ruby does not allow percent arrays in an ambiguous block context. # # @example # # foo %i[bar baz] { qux } def invalid_percent...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/end_keyword_alignment.rb
lib/rubocop/cop/mixin/end_keyword_alignment.rb
# frozen_string_literal: true module RuboCop module Cop # Functions for checking the alignment of the `end` keyword. module EndKeywordAlignment include ConfigurableEnforcedStyle include RangeHelp MSG = '`end` at %<end_line>d, %<end_col>d is not aligned with ' \ '`%<source>s` at...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/forbidden_pattern.rb
lib/rubocop/cop/mixin/forbidden_pattern.rb
# frozen_string_literal: true module RuboCop module Cop # This module encapsulates the ability to forbid certain patterns in a cop. module ForbiddenPattern def forbidden_pattern?(name) forbidden_patterns.any? { |pattern| Regexp.new(pattern).match?(name) } end def forbidden_patterns...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/endless_method_rewriter.rb
lib/rubocop/cop/mixin/endless_method_rewriter.rb
# frozen_string_literal: true module RuboCop module Cop # Common functionality for rewriting endless methods to normal method definitions module EndlessMethodRewriter def correct_to_multiline(corrector, node) replacement = <<~RUBY.strip def #{node.method_name}#{arguments(node)} ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/allowed_pattern.rb
lib/rubocop/cop/mixin/allowed_pattern.rb
# frozen_string_literal: true module RuboCop module Cop # This module encapsulates the ability to ignore certain lines when # parsing. module AllowedPattern private def allowed_line?(line) line = if line.respond_to?(:source_line) line.source_line elsif...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/ordered_gem_node.rb
lib/rubocop/cop/mixin/ordered_gem_node.rb
# frozen_string_literal: true module RuboCop module Cop # Common functionality for Bundler/OrderedGems and # Gemspec/OrderedDependencies. module OrderedGemNode private def get_source_range(node, comments_as_separators) unless comments_as_separators first_comment = processed...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/frozen_string_literal.rb
lib/rubocop/cop/mixin/frozen_string_literal.rb
# frozen_string_literal: true module RuboCop module Cop # Common functionality for dealing with frozen string literals. module FrozenStringLiteral module_function FROZEN_STRING_LITERAL_ENABLED = '# frozen_string_literal: true' FROZEN_STRING_LITERAL_TYPES_RUBY27 = %i[str dstr].freeze ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/check_line_breakable.rb
lib/rubocop/cop/mixin/check_line_breakable.rb
# frozen_string_literal: true module RuboCop module Cop # This mixin detects collections that are safe to "break" # by inserting new lines. This is useful for breaking # up long lines. # # Let's look at hashes as an example: # # We know hash keys are safe to break across lines. We can add...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/empty_lines_around_body.rb
lib/rubocop/cop/mixin/empty_lines_around_body.rb
# frozen_string_literal: true module RuboCop module Cop module Layout # Common functionality for checking if presence/absence of empty lines # around some kind of body matches the configuration. module EmptyLinesAroundBody extend NodePattern::Macros include ConfigurableEnforcedS...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/match_range.rb
lib/rubocop/cop/mixin/match_range.rb
# frozen_string_literal: true module RuboCop module Cop # Common functionality for obtaining source ranges from regexp matches module MatchRange include RangeHelp private # Return a new `Range` covering the first matching group number for each # match of `regex` inside `range` ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/hash_subset.rb
lib/rubocop/cop/mixin/hash_subset.rb
# frozen_string_literal: true module RuboCop module Cop # Common functionality for Style/HashExcept and Style/HashSlice cops. # It registers an offense on methods with blocks that are equivalent # to Hash#except or Hash#slice. # rubocop:disable Metrics/ModuleLength module HashSubset include...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/dig_help.rb
lib/rubocop/cop/mixin/dig_help.rb
# frozen_string_literal: true module RuboCop module Cop # Help methods for working with `Enumerable#dig` in cops. # Used by `Style::DigChain` and `Style::SingleArgumentDig` module DigHelp extend NodePattern::Macros # @!method dig?(node) def_node_matcher :dig?, <<~PATTERN (call ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/multiline_expression_indentation.rb
lib/rubocop/cop/mixin/multiline_expression_indentation.rb
# frozen_string_literal: true module RuboCop module Cop # Common functionality for checking multiline method calls and binary # operations. module MultilineExpressionIndentation # rubocop:disable Metrics/ModuleLength KEYWORD_ANCESTOR_TYPES = %i[for if while until return].freeze UNALIGNED_RHS...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/def_node.rb
lib/rubocop/cop/mixin/def_node.rb
# frozen_string_literal: true module RuboCop module Cop # Common functionality for checking def nodes. module DefNode extend NodePattern::Macros include VisibilityHelp private def non_public?(node) non_public_modifier?(node.parent) || preceding_non_public_modifier?(node) ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/visibility_help.rb
lib/rubocop/cop/mixin/visibility_help.rb
# frozen_string_literal: true require 'set' module RuboCop module Cop # Help methods for determining node visibility. module VisibilityHelp extend NodePattern::Macros VISIBILITY_SCOPES = ::Set[:private, :protected, :public].freeze private def node_visibility(node) node_vis...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/comments_help.rb
lib/rubocop/cop/mixin/comments_help.rb
# frozen_string_literal: true module RuboCop module Cop # Help methods for working with nodes containing comments. module CommentsHelp def source_range_with_comment(node) begin_pos = begin_pos_with_comment(node) end_pos = end_position_for(node) Parser::Source::Range.new(buffer,...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/min_body_length.rb
lib/rubocop/cop/mixin/min_body_length.rb
# frozen_string_literal: true module RuboCop module Cop # Common functionality for checking minimum body length. module MinBodyLength private def min_body_length?(node) (node.loc.end.line - node.loc.keyword.line) > min_body_length end def min_body_length length = cop...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/array_min_size.rb
lib/rubocop/cop/mixin/array_min_size.rb
# frozen_string_literal: true module RuboCop module Cop # Handles the `MinSize` configuration option for array-based cops # `Style/SymbolArray` and `Style/WordArray`, which check for use of the # relevant percent literal syntax such as `%i[...]` and `%w[...]` module ArrayMinSize private ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/method_complexity.rb
lib/rubocop/cop/mixin/method_complexity.rb
# frozen_string_literal: true module RuboCop module Cop # @api private # # This module handles measurement and reporting of complexity in methods. module MethodComplexity include AllowedMethods include AllowedPattern include Metrics::Utils::RepeatedCsendDiscount extend NodePat...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/line_length_help.rb
lib/rubocop/cop/mixin/line_length_help.rb
# frozen_string_literal: true module RuboCop module Cop # Help methods for determining if a line is too long. module LineLengthHelp include Alignment private def allow_rbs_inline_annotation? config.for_cop('Layout/LineLength')['AllowRBSInlineAnnotation'] end def rbs_i...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/integer_node.rb
lib/rubocop/cop/mixin/integer_node.rb
# frozen_string_literal: true module RuboCop module Cop # Common functionality for checking integer nodes. module IntegerNode private def integer_part(node) node.source.sub(/^[+-]/, '').split(/[eE.]/, 2).first end end end end
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/configurable_numbering.rb
lib/rubocop/cop/mixin/configurable_numbering.rb
# frozen_string_literal: true module RuboCop module Cop # This module provides functionality for checking if numbering match the # configured EnforcedStyle. module ConfigurableNumbering include ConfigurableFormatting implicit_param = /\A_\d+\z/ FORMATS = { snake_case: /(?:\D|_...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/rational_literal.rb
lib/rubocop/cop/mixin/rational_literal.rb
# frozen_string_literal: true module RuboCop module Cop # Common functionality for handling Rational literals. module RationalLiteral extend NodePattern::Macros private # @!method rational_literal?(node) def_node_matcher :rational_literal?, <<~PATTERN (send (int _)...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/hash_shorthand_syntax.rb
lib/rubocop/cop/mixin/hash_shorthand_syntax.rb
# frozen_string_literal: true module RuboCop module Cop # This module checks for Ruby 3.1's hash value omission syntax. # rubocop:disable Metrics/ModuleLength module HashShorthandSyntax OMIT_HASH_VALUE_MSG = 'Omit the hash value.' EXPLICIT_HASH_VALUE_MSG = 'Include the hash value.' DO_N...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/method_preference.rb
lib/rubocop/cop/mixin/method_preference.rb
# frozen_string_literal: true module RuboCop module Cop # Common code for cops that deal with preferred methods. module MethodPreference private def preferred_method(method) preferred_methods[method.to_sym] end def preferred_methods @preferred_methods ||= b...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/preferred_delimiters.rb
lib/rubocop/cop/mixin/preferred_delimiters.rb
# frozen_string_literal: true module RuboCop module Cop # Common functionality for handling percent literal delimiters. class PreferredDelimiters attr_reader :type, :config PERCENT_LITERAL_TYPES = %w[% %i %I %q %Q %r %s %w %W %x].freeze def initialize(type, config, preferred_delimiters) ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/require_library.rb
lib/rubocop/cop/mixin/require_library.rb
# frozen_string_literal: true module RuboCop module Cop # Ensure a require statement is present for a standard library determined # by variable library_name module RequireLibrary extend NodePattern::Macros RESTRICT_ON_SEND = [:require].freeze def ensure_required(corrector, node, libra...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/string_help.rb
lib/rubocop/cop/mixin/string_help.rb
# frozen_string_literal: true module RuboCop module Cop # Classes that include this module just implement functions to determine # what is an offense and how to do autocorrection. They get help with # adding offenses for the faulty string nodes, and with filtering out # nodes. module StringHelp ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/forbidden_identifiers.rb
lib/rubocop/cop/mixin/forbidden_identifiers.rb
# frozen_string_literal: true module RuboCop module Cop # This module encapsulates the ability to forbid certain identifiers in a cop. module ForbiddenIdentifiers SIGILS = '@$' # if a variable starts with a sigil it will be removed def forbidden_identifier?(name) name = name.to_s.delete(...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/configurable_naming.rb
lib/rubocop/cop/mixin/configurable_naming.rb
# frozen_string_literal: true module RuboCop module Cop # This module provides functionality for checking if names match the # configured EnforcedStyle. module ConfigurableNaming include ConfigurableFormatting FORMATS = { snake_case: /^@{0,2}[\d[[:lower:]]_]+[!?=]?$/, camelCa...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/symbol_help.rb
lib/rubocop/cop/mixin/symbol_help.rb
# frozen_string_literal: true module RuboCop module Cop # Classes that include this module just implement functions for working # with symbol nodes. module SymbolHelp def hash_key?(node) node.parent&.pair_type? && node == node.parent.child_nodes.first end end end end
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/check_assignment.rb
lib/rubocop/cop/mixin/check_assignment.rb
# frozen_string_literal: true module RuboCop module Cop # Common functionality for checking assignment nodes. module CheckAssignment def on_lvasgn(node) check_assignment(node, extract_rhs(node)) end alias on_ivasgn on_lvasgn alias on_cvasgn on_lvasgn alias on_gvasgn ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/statement_modifier.rb
lib/rubocop/cop/mixin/statement_modifier.rb
# frozen_string_literal: true module RuboCop module Cop # Common functionality for modifier cops. module StatementModifier include LineLengthHelp private def single_line_as_modifier?(node) return false if non_eligible_node?(node) || non_eligible_body?(node....
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/enforce_superclass.rb
lib/rubocop/cop/mixin/enforce_superclass.rb
# frozen_string_literal: true module RuboCop module Cop # Common functionality for enforcing a specific superclass. # # IMPORTANT: RuboCop core depended on this module when it supported Rails department. # Rails department has been extracted to RuboCop Rails gem. # # @deprecated This module i...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/preceding_following_alignment.rb
lib/rubocop/cop/mixin/preceding_following_alignment.rb
# frozen_string_literal: true module RuboCop module Cop # Common functionality for checking whether an AST node/token is aligned # with something on a preceding or following line # rubocop:disable Metrics/ModuleLength module PrecedingFollowingAlignment # Tokens that end with an `=`, as well as ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/space_after_punctuation.rb
lib/rubocop/cop/mixin/space_after_punctuation.rb
# frozen_string_literal: true module RuboCop module Cop # Common functionality for cops checking for missing space after # punctuation. module SpaceAfterPunctuation MSG = 'Space missing after %<token>s.' def on_new_investigation each_missing_space(processed_source.tokens) do |token, ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/documentation_comment.rb
lib/rubocop/cop/mixin/documentation_comment.rb
# frozen_string_literal: true module RuboCop module Cop # Common functionality for checking documentation. module DocumentationComment extend NodePattern::Macros private def documentation_comment?(node) preceding_lines = preceding_lines(node) return false unless preceding...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/hash_transform_method.rb
lib/rubocop/cop/mixin/hash_transform_method.rb
# frozen_string_literal: true module RuboCop module Cop # Common functionality for Style/HashTransformKeys and # Style/HashTransformValues module HashTransformMethod extend NodePattern::Macros RESTRICT_ON_SEND = %i[[] to_h].freeze # Internal helper class to hold match data Captu...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/configurable_max.rb
lib/rubocop/cop/mixin/configurable_max.rb
# frozen_string_literal: true module RuboCop module Cop # Handles `Max` configuration parameters, especially setting them to an # appropriate value with --auto-gen-config. # @deprecated Use `exclude_limit <ParameterName>` instead. module ConfigurableMax private def max=(value) wa...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/auto_corrector.rb
lib/rubocop/cop/mixin/auto_corrector.rb
# frozen_string_literal: true module RuboCop module Cop # extend this module to signal autocorrection support module AutoCorrector def support_autocorrect? true end end end end
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/annotation_comment.rb
lib/rubocop/cop/mixin/annotation_comment.rb
# frozen_string_literal: true module RuboCop module Cop # Representation of an annotation comment in source code (eg. `# TODO: blah blah blah`). class AnnotationComment attr_reader :comment, :margin, :keyword, :colon, :space, :note # @param [Parser::Source::Comment] comment # @param [Array...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/mixin/multiline_element_line_breaks.rb
lib/rubocop/cop/mixin/multiline_element_line_breaks.rb
# frozen_string_literal: true module RuboCop module Cop # Common functionality for checking for a line break before each # element in a multi-line collection. module MultilineElementLineBreaks private def check_line_breaks(_node, children, ignore_last: false) return if all_on_same_li...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/gemspec/require_mfa.rb
lib/rubocop/cop/gemspec/require_mfa.rb
# frozen_string_literal: true module RuboCop module Cop module Gemspec # Requires a gemspec to have `rubygems_mfa_required` metadata set. # # This setting tells RubyGems that MFA (Multi-Factor Authentication) is # required for accounts to be able perform privileged operations, such as ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/gemspec/add_runtime_dependency.rb
lib/rubocop/cop/gemspec/add_runtime_dependency.rb
# frozen_string_literal: true module RuboCop module Cop module Gemspec # Prefer `add_dependency` over `add_runtime_dependency` as the latter is # considered soft-deprecated. # # @example # # # bad # Gem::Specification.new do |spec| # spec.add_runtime_depend...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/gemspec/ordered_dependencies.rb
lib/rubocop/cop/gemspec/ordered_dependencies.rb
# frozen_string_literal: true module RuboCop module Cop module Gemspec # Dependencies in the gemspec should be alphabetically sorted. # # @example # # bad # spec.add_dependency 'rubocop' # spec.add_dependency 'rspec' # # # good # spec.add_dependency...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/gemspec/ruby_version_globals_usage.rb
lib/rubocop/cop/gemspec/ruby_version_globals_usage.rb
# frozen_string_literal: true module RuboCop module Cop module Gemspec # Checks that `RUBY_VERSION` and `Ruby::VERSION` constants are not used in gemspec. # Using `RUBY_VERSION` and `Ruby::VERSION` are dangerous because value of the # constant is determined by `rake release`. # It's possi...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/gemspec/deprecated_attribute_assignment.rb
lib/rubocop/cop/gemspec/deprecated_attribute_assignment.rb
# frozen_string_literal: true module RuboCop module Cop module Gemspec # Checks that deprecated attributes are not set in a gemspec file. # Removing deprecated attributes allows the user to receive smaller packed gems. # # @example # # # bad # Gem::Specification.new ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/gemspec/development_dependencies.rb
lib/rubocop/cop/gemspec/development_dependencies.rb
# frozen_string_literal: true module RuboCop module Cop module Gemspec # Enforce that development dependencies for a gem are specified in # `Gemfile`, rather than in the `gemspec` using # `add_development_dependency`. Alternatively, using `EnforcedStyle: # gemspec`, enforce that all depen...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/gemspec/required_ruby_version.rb
lib/rubocop/cop/gemspec/required_ruby_version.rb
# frozen_string_literal: true module RuboCop module Cop module Gemspec # Checks that `required_ruby_version` in a gemspec file is set to a valid # value (non-blank) and matches `TargetRubyVersion` as set in RuboCop's # configuration for the gem. # # This ensures that RuboCop is usin...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/gemspec/dependency_version.rb
lib/rubocop/cop/gemspec/dependency_version.rb
# frozen_string_literal: true module RuboCop module Cop module Gemspec # Enforce that gem dependency version specifications or a commit reference (branch, # ref, or tag) are either required or forbidden. # # @example EnforcedStyle: required (default) # # # bad # Gem:...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false