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/colon_method_definition.rb | lib/rubocop/cop/style/colon_method_definition.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for class methods that are defined using the `::`
# operator instead of the `.` operator.
#
# @example
# # bad
# class Foo
# def self::bar
# end
# end
#
# ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/guard_clause.rb | lib/rubocop/cop/style/guard_clause.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Use a guard clause instead of wrapping the code inside a conditional
# expression
#
# A condition with an `elsif` or `else` branch is allowed unless
# one of `return`, `break`, `next`, `raise`, or `fail` is used
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/not.rb | lib/rubocop/cop/style/not.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for uses of the keyword `not` instead of `!`.
#
# @example
#
# # bad - parentheses are required because of op precedence
# x = (not something)
#
# # good
# x = !something
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/hash_conversion.rb | lib/rubocop/cop/style/hash_conversion.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks the usage of pre-2.1 `Hash[args]` method of converting enumerables and
# sequences of values to hashes.
#
# Correction code from splat argument (`Hash[*ary]`) is not simply determined. For example,
# `Hash... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/implicit_runtime_error.rb | lib/rubocop/cop/style/implicit_runtime_error.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for `raise` or `fail` statements which do not specify an
# explicit exception class. (This raises a `RuntimeError`. Some projects
# might prefer to use exception classes which more precisely identify the
# natur... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/redundant_file_extension_in_require.rb | lib/rubocop/cop/style/redundant_file_extension_in_require.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for the presence of superfluous `.rb` extension in
# the filename provided to `require` and `require_relative`.
#
# NOTE: If the extension is omitted, Ruby tries adding '.rb', '.so',
# and so on to t... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/file_empty.rb | lib/rubocop/cop/style/file_empty.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Prefer to use `File.empty?('path/to/file')` when checking if a file is empty.
#
# @safety
# This cop is unsafe, because `File.size`, `File.read`, and `File.binread`
# raise `ENOENT` exception when there is no... | 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_module.rb | lib/rubocop/cop/style/trailing_body_on_module.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for trailing code after the module definition.
#
# @example
# # bad
# module Foo extend self
# end
#
# # good
# module Foo
# extend self
# end
#
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/empty_heredoc.rb | lib/rubocop/cop/style/empty_heredoc.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for using empty heredoc to reduce redundancy.
#
# @example
#
# # bad
# <<~EOS
# EOS
#
# <<-EOS
# EOS
#
# <<EOS
# EOS
#
# # good
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/signal_exception.rb | lib/rubocop/cop/style/signal_exception.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for uses of `fail` and `raise`.
#
# @example EnforcedStyle: only_raise (default)
# # The `only_raise` style enforces the sole use of `raise`.
# # bad
# begin
# fail
# rescue E... | 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_do_end_block.rb | lib/rubocop/cop/style/single_line_do_end_block.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for single-line `do`...`end` block.
#
# In practice a single line `do`...`end` is autocorrected when `EnforcedStyle: semantic`
# is configured for `Style/BlockDelimiters`. The autocorrection maintains the
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/map_compact_with_conditional_block.rb | lib/rubocop/cop/style/map_compact_with_conditional_block.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Prefer `select` or `reject` over `map { ... }.compact`.
# This cop also handles `filter_map { ... }`, similar to `map { ... }.compact`.
#
# @example
#
# # bad
# array.map { |e| some_condition? ? e... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/disable_cops_within_source_code_directive.rb | lib/rubocop/cop/style/disable_cops_within_source_code_directive.rb | # frozen_string_literal: true
# rubocop:disable Lint/RedundantCopDisableDirective
module RuboCop
module Cop
module Style
# Detects comments to enable/disable RuboCop.
# This is useful if want to make sure that every RuboCop error gets fixed
# and not quickly disabled with a comment.
#
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/string_chars.rb | lib/rubocop/cop/style/string_chars.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for uses of `String#split` with empty string or regexp literal argument.
#
# @safety
# This cop is unsafe because it cannot be guaranteed that the receiver
# is actually a string. If another class has ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/global_std_stream.rb | lib/rubocop/cop/style/global_std_stream.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Enforces the use of `$stdout/$stderr/$stdin` instead of `STDOUT/STDERR/STDIN`.
# `STDOUT/STDERR/STDIN` are constants, and while you can actually
# reassign (possibly to redirect some stream) constants in Ruby, you'll get
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/it_block_parameter.rb | lib/rubocop/cop/style/it_block_parameter.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for blocks with one argument where `it` block parameter can be used.
#
# It provides four `EnforcedStyle` options:
#
# 1. `allow_single_line` (default) ... Always uses the `it` block parameter in a single ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/min_max.rb | lib/rubocop/cop/style/min_max.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for potential uses of `Enumerable#minmax`.
#
# @example
#
# # bad
# bar = [foo.min, foo.max]
# return foo.min, foo.max
#
# # good
# bar = foo.minmax
# return... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/redundant_begin.rb | lib/rubocop/cop/style/redundant_begin.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for redundant `begin` blocks.
#
# Currently it checks for code like this:
#
# @example
#
# # bad
# def redundant
# begin
# ala
# bala
# res... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/stabby_lambda_parentheses.rb | lib/rubocop/cop/style/stabby_lambda_parentheses.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for parentheses around stabby lambda arguments.
# There are two different styles. Defaults to `require_parentheses`.
#
# @example EnforcedStyle: require_parentheses (default)
# # bad
# ->a,b,c { ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/redundant_format.rb | lib/rubocop/cop/style/redundant_format.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for calls to `Kernel#format` or `Kernel#sprintf` that are redundant.
#
# Calling `format` with only a single string or constant argument is redundant,
# as it can be replaced by the string or constant itself.
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/empty_case_condition.rb | lib/rubocop/cop/style/empty_case_condition.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for case statements with an empty condition.
#
# @example
#
# # bad:
# case
# when x == 0
# puts 'x is 0'
# when y == 0
# puts 'y is 0'
# else
# ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/module_function.rb | lib/rubocop/cop/style/module_function.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for use of `extend self` or `module_function` in a module.
#
# Supported styles are: `module_function` (default), `extend_self` and `forbidden`.
#
# A couple of things to keep in mind:
#
# - `f... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/sample.rb | lib/rubocop/cop/style/sample.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Identifies usages of `shuffle.first`,
# `shuffle.last`, and `shuffle[]` and change them to use
# `sample` instead.
#
# @example
# # bad
# [1, 2, 3].shuffle.first
# [1, 2, 3].shuffle.first(... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/double_cop_disable_directive.rb | lib/rubocop/cop/style/double_cop_disable_directive.rb | # frozen_string_literal: true
# rubocop:disable Lint/RedundantCopDisableDirective
# rubocop:disable Style/DoubleCopDisableDirective
module RuboCop
module Cop
module Style
# Detects double disable comments on one line. This is mostly to catch
# automatically generated comments that need to be regener... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/multiline_if_modifier.rb | lib/rubocop/cop/style/multiline_if_modifier.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for uses of if/unless modifiers with multiple-lines bodies.
#
# @example
#
# # bad
# {
# result: 'this should not happen'
# } unless cond
#
# # good
# { re... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/empty_block_parameter.rb | lib/rubocop/cop/style/empty_block_parameter.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for pipes for empty block parameters. Pipes for empty
# block parameters do not cause syntax errors, but they are redundant.
#
# @example
# # bad
# a do ||
# do_something
# end
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/redundant_freeze.rb | lib/rubocop/cop/style/redundant_freeze.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for uses of `Object#freeze` on immutable objects.
#
# NOTE: `Regexp` and `Range` literals are frozen objects since Ruby 3.0.
#
# NOTE: From Ruby 3.0, this cop allows explicit freezing of interpolated
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/redundant_interpolation.rb | lib/rubocop/cop/style/redundant_interpolation.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for strings that are just an interpolated expression.
#
# @safety
# Autocorrection is unsafe because when calling a destructive method to string,
# the resulting string may have different behavior or r... | 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.rb | lib/rubocop/cop/style/redundant_sort.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Identifies instances of sorting and then
# taking only the first or last element. The same behavior can
# be accomplished without a relatively expensive sort by using
# `Enumerable#min` instead of sorting and taking th... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/dig_chain.rb | lib/rubocop/cop/style/dig_chain.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for chained `dig` calls that can be collapsed into a single `dig`.
#
# @safety
# This cop is unsafe because it cannot be guaranteed that the receiver
# is an `Enumerable` or does not have a nonstandard... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/string_literals_in_interpolation.rb | lib/rubocop/cop/style/string_literals_in_interpolation.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks that quotes inside string, symbol, and regexp interpolations
# match the configured preference.
#
# @example EnforcedStyle: single_quotes (default)
# # bad
# string = "Tests #{success ? "PASS" : ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/redundant_heredoc_delimiter_quotes.rb | lib/rubocop/cop/style/redundant_heredoc_delimiter_quotes.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for redundant heredoc delimiter quotes.
#
# @example
#
# # bad
# do_something(<<~'EOS')
# no string interpolation style text
# EOS
#
# # good
# do_somethin... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/redundant_line_continuation.rb | lib/rubocop/cop/style/redundant_line_continuation.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for redundant line continuation.
#
# This cop marks a line continuation as redundant if removing the backslash
# does not result in a syntax error.
# However, a backslash at the end of a comment or
#... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/explicit_block_argument.rb | lib/rubocop/cop/style/explicit_block_argument.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Enforces the use of explicit block argument to avoid writing
# block literal that just passes its arguments to another block.
#
# NOTE: This cop only registers an offense if the block args match the
# yield args ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/multiline_memoization.rb | lib/rubocop/cop/style/multiline_memoization.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks expressions wrapping styles for multiline memoization.
#
# @example EnforcedStyle: keyword (default)
# # bad
# foo ||= (
# bar
# baz
# )
#
# # good
# f... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/when_then.rb | lib/rubocop/cop/style/when_then.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for `when;` uses in `case` expressions.
#
# @example
# # bad
# case foo
# when 1; 'baz'
# when 2; 'bar'
# end
#
# # good
# case foo
# when 1 then '... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/top_level_method_definition.rb | lib/rubocop/cop/style/top_level_method_definition.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Newcomers to ruby applications may write top-level methods,
# when ideally they should be organized in appropriate classes or modules.
# This cop looks for definitions of top-level methods and warns about them.
#
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/unpack_first.rb | lib/rubocop/cop/style/unpack_first.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for accessing the first element of `String#unpack`
# which can be replaced with the shorter method `unpack1`.
#
# @example
#
# # bad
# 'foo'.unpack('h*').first
# 'foo'.unpack('h*')[... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/attr.rb | lib/rubocop/cop/style/attr.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for uses of Module#attr.
#
# @example
# # bad - creates a single attribute accessor (deprecated in Ruby 1.9)
# attr :something, true
# attr :one, :two, :three # behaves as attr_reader
#
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/auto_resource_cleanup.rb | lib/rubocop/cop/style/auto_resource_cleanup.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for cases when you could use a block
# accepting version of a method that does automatic
# resource cleanup.
#
# @example
#
# # bad
# f = File.open('file')
#
# # good
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/if_with_semicolon.rb | lib/rubocop/cop/style/if_with_semicolon.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for uses of semicolon in if statements.
#
# @example
#
# # bad
# result = if some_condition; something else another_thing end
#
# # good
# result = some_condition ? somethin... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/while_until_modifier.rb | lib/rubocop/cop/style/while_until_modifier.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for while and until statements that would fit on one line
# if written as a modifier while/until. The maximum line length is
# configured in the `Layout/LineLength` cop.
#
# @example
# # bad
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/stderr_puts.rb | lib/rubocop/cop/style/stderr_puts.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Identifies places where `$stderr.puts` can be replaced by
# `warn`. The latter has the advantage of easily being disabled by,
# the `-W0` interpreter flag or setting `$VERBOSE` to `nil`.
#
# @example
# # ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/super_with_args_parentheses.rb | lib/rubocop/cop/style/super_with_args_parentheses.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Enforces the presence of parentheses in `super` containing arguments.
#
# `super` is a keyword and is provided as a distinct cop from those designed for method call.
#
# @example
#
# # bad
# ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/array_intersect.rb | lib/rubocop/cop/style/array_intersect.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# In Ruby 3.1, `Array#intersect?` has been added.
#
# This cop identifies places where:
#
# * `(array1 & array2).any?`
# * `(array1.intersection(array2)).any?`
# * `array1.any? { |elem| array2.member?(e... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/super_arguments.rb | lib/rubocop/cop/style/super_arguments.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for redundant argument forwarding when calling super with arguments identical to
# the method definition.
#
# Using zero arity `super` within a `define_method` block results in `RuntimeError`:
#
# [s... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/redundant_double_splat_hash_braces.rb | lib/rubocop/cop/style/redundant_double_splat_hash_braces.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for redundant uses of double splat hash braces.
#
# @example
#
# # bad
# do_something(**{foo: bar, baz: qux})
#
# # good
# do_something(foo: bar, baz: qux)
#
# ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/while_until_do.rb | lib/rubocop/cop/style/while_until_do.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for uses of `do` in multi-line `while/until` statements.
#
# @example
#
# # bad
# while x.any? do
# do_something(x.pop)
# end
#
# # good
# while x.any?
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/numbered_parameters.rb | lib/rubocop/cop/style/numbered_parameters.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for numbered parameters.
#
# It can either restrict the use of numbered parameters to
# single-lined blocks, or disallow completely numbered parameters.
#
# @example EnforcedStyle: allow_single_line ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/redundant_capital_w.rb | lib/rubocop/cop/style/redundant_capital_w.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for usage of the %W() syntax when %w() would do.
#
# @example
# # bad
# %W(cat dog pig)
# %W[door wall floor]
#
# # good
# %w/swim run bike/
# %w[shirt pants shoes... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/zero_length_predicate.rb | lib/rubocop/cop/style/zero_length_predicate.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for numeric comparisons that can be replaced
# by a predicate method, such as `receiver.length == 0`,
# `receiver.length > 0`, and `receiver.length != 0`,
# `receiver.length < 1` and `receiver.size == 0` that ca... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/redundant_self.rb | lib/rubocop/cop/style/redundant_self.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for redundant uses of `self`.
#
# The usage of `self` is only needed when:
#
# * Sending a message to same object with zero arguments in
# presence of a method name clash with an argument or a loca... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/negated_if.rb | lib/rubocop/cop/style/negated_if.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for uses of if with a negated condition. Only ifs
# without else are considered. There are three different styles:
#
# * both
# * prefix
# * postfix
#
# @example EnforcedStyle: both (defa... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/document_dynamic_eval_definition.rb | lib/rubocop/cop/style/document_dynamic_eval_definition.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# When using `class_eval` (or other `eval`) with string interpolation,
# add a comment block showing its appearance if interpolated (a practice used in Rails code).
#
# @example
# # from activesupport/lib/active_... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/special_global_vars.rb | lib/rubocop/cop/style/special_global_vars.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Looks for uses of Perl-style global variables.
# Correcting to global variables in the 'English' library
# will add a require statement to the top of the file if
# enabled by RequireEnglish config.
#
# @saf... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/safe_navigation.rb | lib/rubocop/cop/style/safe_navigation.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Transforms usages of a method call safeguarded by a non `nil`
# check for the variable whose method is being called to
# safe navigation (`&.`). If there is a method chain, all of the methods
# in the chain need to be ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/trailing_method_end_statement.rb | lib/rubocop/cop/style/trailing_method_end_statement.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for trailing code after the method definition.
#
# @example
# # bad
# def some_method
# do_stuff; end
#
# def do_this(x)
# baz.map { |b| b.this(x) } end
#
# ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/redundant_self_assignment.rb | lib/rubocop/cop/style/redundant_self_assignment.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for places where redundant assignments are made for in place
# modification methods.
#
# @safety
# This cop is unsafe, because it can produce false positives for
# user defined methods having one... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/ambiguous_endless_method_definition.rb | lib/rubocop/cop/style/ambiguous_endless_method_definition.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Looks for endless methods inside operations of lower precedence (`and`, `or`, and
# modifier forms of `if`, `unless`, `while`, `until`) that are ambiguous due to
# lack of parentheses. This may lead to unexpected behavior as... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/file_touch.rb | lib/rubocop/cop/style/file_touch.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for usage of `File.open` in append mode with empty block.
#
# Such a usage only creates a new file, but it doesn't update
# timestamps for an existing file, which might have been the intention.
#
# F... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/parallel_assignment.rb | lib/rubocop/cop/style/parallel_assignment.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for simple usages of parallel assignment.
# This will only complain when the number of variables
# being assigned matched the number of assigning variables.
#
# @example
# # bad
# a, b, c =... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/array_coercion.rb | lib/rubocop/cop/style/array_coercion.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Enforces the use of `Array()` instead of explicit `Array` check or `[*var]`.
#
# The cop is disabled by default due to safety concerns.
#
# @safety
# This cop is unsafe because a false positive may occur ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/next.rb | lib/rubocop/cop/style/next.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Use `next` to skip iteration instead of a condition at the end.
#
# @example EnforcedStyle: skip_modifier_ifs (default)
# # bad
# [1, 2].each do |a|
# if a == 1
# puts a
# end
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/mutable_constant.rb | lib/rubocop/cop/style/mutable_constant.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks whether some constant value isn't a
# mutable literal (e.g. array or hash).
#
# Strict mode can be used to freeze all constants, rather than
# just literals.
# Strict mode is considered an experiment... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/nil_lambda.rb | lib/rubocop/cop/style/nil_lambda.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for lambdas and procs that always return nil,
# which can be replaced with an empty lambda or proc instead.
#
# @example
# # bad
# -> { nil }
#
# lambda do
# next nil
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/eval_with_location.rb | lib/rubocop/cop/style/eval_with_location.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Ensures that eval methods (`eval`, `instance_eval`, `class_eval`
# and `module_eval`) are given filename and line number values (`+__FILE__+`
# and `+__LINE__+`). This data is used to ensure that any errors raised
# wi... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/yoda_expression.rb | lib/rubocop/cop/style/yoda_expression.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Forbids Yoda expressions, i.e. binary operations (using `*`, `+`, `&`, `|`,
# and `^` operators) where the order of expression is reversed, eg. `1 + x`.
# This cop complements `Style/YodaCondition` cop, which has a similar p... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/rescue_modifier.rb | lib/rubocop/cop/style/rescue_modifier.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for uses of `rescue` in its modifier form is added for following
# reasons:
#
# * The syntax of modifier form `rescue` can be misleading because it
# might lead us to believe that `rescue` handles the gi... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/map_to_hash.rb | lib/rubocop/cop/style/map_to_hash.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Looks for uses of `map.to_h` or `collect.to_h` that could be
# written with just `to_h` in Ruby >= 2.6.
#
# NOTE: `Style/HashTransformKeys` and `Style/HashTransformValues` will
# also change this pattern if only ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/string_methods.rb | lib/rubocop/cop/style/string_methods.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Enforces the use of consistent method names
# from the `String` class.
#
# @example
# # bad
# 'name'.intern
# 'var'.unfavored_method
#
# # good
# 'name'.to_sym
# 'v... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/redundant_array_flatten.rb | lib/rubocop/cop/style/redundant_array_flatten.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for redundant calls of `Array#flatten`.
#
# `Array#join` joins nested arrays recursively, so flattening an array
# beforehand is redundant.
#
# @safety
# Cop is unsafe because the receiver of... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/string_concatenation.rb | lib/rubocop/cop/style/string_concatenation.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for places where string concatenation
# can be replaced with string interpolation.
#
# The cop can autocorrect simple cases but will skip autocorrecting
# more complex cases where the resulting code would ... | 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_character_class.rb | lib/rubocop/cop/style/redundant_regexp_character_class.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for unnecessary single-element `Regexp` character classes.
#
# @example
#
# # bad
# r = /[x]/
#
# # good
# r = /x/
#
# # bad
# r = /[\s]/
#
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/begin_block.rb | lib/rubocop/cop/style/begin_block.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for BEGIN blocks.
#
# @example
# # bad
# BEGIN { test }
#
class BeginBlock < Base
MSG = 'Avoid the use of `BEGIN` blocks.'
def on_preexe(node)
add_offense(node.lo... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/single_argument_dig.rb | lib/rubocop/cop/style/single_argument_dig.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Sometimes using `dig` method ends up with just a single
# argument. In such cases, dig should be replaced with `[]`.
#
# Since replacing `hash&.dig(:key)` with `hash[:key]` could potentially lead to error,
# call... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/commented_keyword.rb | lib/rubocop/cop/style/commented_keyword.rb | # frozen_string_literal: true
require_relative '../../directive_comment'
module RuboCop
module Cop
module Style
# Checks for comments put on the same line as some keywords.
# These keywords are: `class`, `module`, `def`, `begin`, `end`.
#
# Note that some comments
# (`:nodoc:`, `:y... | 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_constructor.rb | lib/rubocop/cop/style/redundant_regexp_constructor.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for the instantiation of regexp using redundant `Regexp.new` or `Regexp.compile`.
# Autocorrect replaces to regexp literal which is the simplest and fastest.
#
# @example
#
# # bad
# Regexp... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/file_null.rb | lib/rubocop/cop/style/file_null.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Use `File::NULL` instead of hardcoding the null device (`/dev/null` on Unix-like
# OSes, `NUL` or `NUL:` on Windows), so that code is platform independent.
# Only looks for full string matches, substrings within a longer str... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/method_def_parentheses.rb | lib/rubocop/cop/style/method_def_parentheses.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for parentheses around the arguments in method
# definitions. Both instance and class/singleton methods are checked.
#
# Regardless of style, parentheses are necessary for:
#
# 1. Endless methods
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/inline_comment.rb | lib/rubocop/cop/style/inline_comment.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for trailing inline comments.
#
# @example
#
# # good
# foo.each do |f|
# # Standalone comment
# f.bar
# end
#
# # bad
# foo.each do |f|
# ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/yaml_file_read.rb | lib/rubocop/cop/style/yaml_file_read.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for the use of `YAML.load`, `YAML.safe_load`, and `YAML.parse` with
# `File.read` argument.
#
# NOTE: `YAML.safe_load_file` was introduced in Ruby 3.0.
#
# @example
#
# # bad
# ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/alias.rb | lib/rubocop/cop/style/alias.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Enforces the use of either `#alias` or `#alias_method`
# depending on configuration.
# It also flags uses of `alias :symbol` rather than `alias bareword`.
#
# However, it will always enforce `method_alias` when u... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/quoted_symbols.rb | lib/rubocop/cop/style/quoted_symbols.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks if the quotes used for quoted symbols match the configured defaults.
# By default uses the same configuration as `Style/StringLiterals`; if that
# cop is not enabled, the default `EnforcedStyle` is `single_quotes`.
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/multiline_block_chain.rb | lib/rubocop/cop/style/multiline_block_chain.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for chaining of a block after another block that spans
# multiple lines.
#
# @example
#
# # bad
# Thread.list.select do |t|
# t.alive?
# end.map do |t|
# t.objec... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/redundant_interpolation_unfreeze.rb | lib/rubocop/cop/style/redundant_interpolation_unfreeze.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Before Ruby 3.0, interpolated strings followed the frozen string literal
# magic comment which sometimes made it necessary to explicitly unfreeze them.
# Ruby 3.0 changed interpolated strings to always be unfrozen which make... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/redundant_argument.rb | lib/rubocop/cop/style/redundant_argument.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for a redundant argument passed to certain methods.
#
# NOTE: This cop is limited to methods with single parameter.
#
# Method names and their redundant arguments can be configured like this:
#
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/class_check.rb | lib/rubocop/cop/style/class_check.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Enforces consistent use of `Object#is_a?` or `Object#kind_of?`.
#
# @example EnforcedStyle: is_a? (default)
# # bad
# var.kind_of?(Date)
# var.kind_of?(Integer)
#
# # good
# var.... | 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_without_args_parentheses.rb | lib/rubocop/cop/style/method_call_without_args_parentheses.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for unwanted parentheses in parameterless method calls.
#
# This cop's allowed methods can be customized with `AllowedMethods`.
# By default, there are no allowed methods.
#
# NOTE: This cop allows t... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/yoda_condition.rb | lib/rubocop/cop/style/yoda_condition.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Enforces or forbids Yoda conditions,
# i.e. comparison operations where the order of expression is reversed.
# eg. `5 == x`
#
# @safety
# This cop is unsafe because comparison operators can be defined
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/option_hash.rb | lib/rubocop/cop/style/option_hash.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for options hashes and discourages them if the
# current Ruby version supports keyword arguments.
#
# @example
#
# # bad
# def fry(options = {})
# temperature = options.fetch(:tem... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/semicolon.rb | lib/rubocop/cop/style/semicolon.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for multiple expressions placed on the same line.
# It also checks for lines terminated with a semicolon.
#
# This cop has `AllowAsExpressionSeparator` configuration option.
# It allows `;` to separate sev... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/redundant_conditional.rb | lib/rubocop/cop/style/redundant_conditional.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for redundant returning of true/false in conditionals.
#
# @example
# # bad
# x == y ? true : false
#
# # bad
# if x == y
# true
# else
# false
#... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/file_write.rb | lib/rubocop/cop/style/file_write.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Favor `File.(bin)write` convenience methods.
#
# NOTE: There are different method signatures between `File.write` (class method)
# and `File#write` (instance method). The following case will be allowed because
# ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/command_literal.rb | lib/rubocop/cop/style/command_literal.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Enforces using `` or %x around command literals.
#
# @example EnforcedStyle: backticks (default)
# # bad
# folders = %x(find . -type d).split
#
# # bad
# %x(
# ln -s foo.exampl... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/negated_while.rb | lib/rubocop/cop/style/negated_while.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for uses of while with a negated condition.
#
# @example
# # bad
# while !foo
# bar
# end
#
# # good
# until foo
# bar
# end
#
# ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/redundant_constant_base.rb | lib/rubocop/cop/style/redundant_constant_base.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Avoid redundant `::` prefix on constant.
#
# How Ruby searches constant is a bit complicated, and it can often be difficult to
# understand from the code whether the `::` is intended or not. Where `Module.nesting`
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/colon_method_call.rb | lib/rubocop/cop/style/colon_method_call.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for methods invoked via the `::` operator instead
# of the `.` operator (like `FileUtils::rmdir` instead of `FileUtils.rmdir`).
#
# @example
# # bad
# Timeout::timeout(500) { 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/block_delimiters.rb | lib/rubocop/cop/style/block_delimiters.rb | # frozen_string_literal: true
# rubocop:disable Metrics/ClassLength
module RuboCop
module Cop
module Style
# Checks for uses of braces or do/end around single line or
# multi-line blocks.
#
# Methods that can be either procedural or functional and cannot be
# categorised from their ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/optional_boolean_parameter.rb | lib/rubocop/cop/style/optional_boolean_parameter.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for places where keyword arguments can be used instead of
# boolean arguments when defining methods. `respond_to_missing?` method is allowed by default.
# These are customizable with `AllowedMethods` option.
#
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/trailing_comma_in_arguments.rb | lib/rubocop/cop/style/trailing_comma_in_arguments.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for trailing comma in argument lists.
# The supported styles are:
#
# * `consistent_comma`: Requires a comma after the last argument,
# for all parenthesized multi-line method calls with arguments.
#... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.