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/class_vars.rb | lib/rubocop/cop/style/class_vars.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for uses of class variables. Offenses
# are signaled only on assignment to class variables to
# reduce the number of offenses that would be reported.
#
# You have to be careful when setting a value for a c... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/empty_lambda_parameter.rb | lib/rubocop/cop/style/empty_lambda_parameter.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for parentheses for empty lambda parameters. Parentheses
# for empty lambda parameters do not cause syntax errors, but they are
# redundant.
#
# @example
# # bad
# -> () { 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/float_division.rb | lib/rubocop/cop/style/float_division.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for division with integers coerced to floats.
# It is recommended to either always use `fdiv` or coerce one side only.
# This cop also provides other options for code consistency.
#
# For `Regexp.last_matc... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/invertible_unless_condition.rb | lib/rubocop/cop/style/invertible_unless_condition.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for usages of `unless` which can be replaced by `if` with inverted condition.
# Code without `unless` is easier to read, but that is subjective, so this cop
# is disabled by default.
#
# Methods that can b... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/missing_else.rb | lib/rubocop/cop/style/missing_else.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for `if` expressions that do not have an `else` branch.
#
# NOTE: Pattern matching is allowed to have no `else` branch because unlike `if` and `case`,
# it raises `NoMatchingPatternError` if the pattern doesn't ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/nested_ternary_operator.rb | lib/rubocop/cop/style/nested_ternary_operator.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for nested ternary op expressions.
#
# @example
# # bad
# a ? (b ? b1 : b2) : a2
#
# # good
# if a
# b ? b1 : b2
# else
# a2
# end
class ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/bisected_attr_accessor.rb | lib/rubocop/cop/style/bisected_attr_accessor.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for places where `attr_reader` and `attr_writer`
# for the same method can be combined into single `attr_accessor`.
#
# @example
# # bad
# class Foo
# attr_reader :bar
# attr_... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/empty_method.rb | lib/rubocop/cop/style/empty_method.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for the formatting of empty method definitions.
# By default it enforces empty method definitions to go on a single
# line (compact style), but it can be configured to enforce the `end`
# to go on its own line (... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/send_with_literal_method_name.rb | lib/rubocop/cop/style/send_with_literal_method_name.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Detects the use of the `public_send` method with a literal method name argument.
# Since the `send` method can be used to call private methods, by default,
# only the `public_send` method is detected.
#
# NOTE: W... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/class_methods.rb | lib/rubocop/cop/style/class_methods.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for uses of the class/module name instead of
# self, when defining class/module methods.
#
# @example
# # bad
# class SomeClass
# def SomeClass.class_method
# # ...
# ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/double_negation.rb | lib/rubocop/cop/style/double_negation.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for uses of double negation (`!!`) to convert something to a boolean value.
#
# When using `EnforcedStyle: allowed_in_returns`, allow double negation in contexts
# that use boolean as a return value. When using ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/regexp_literal.rb | lib/rubocop/cop/style/regexp_literal.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Enforces using `//` or `%r` around regular expressions.
#
# NOTE: The following `%r` cases using a regexp starts with a blank or `=`
# as a method argument allowed to prevent syntax errors.
#
# [source,ruby... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/multiple_comparison.rb | lib/rubocop/cop/style/multiple_comparison.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks against comparing a variable with multiple items, where
# `Array#include?`, `Set#include?` or a `case` could be used instead
# to avoid code repetition.
# It accepts comparisons of multiple method calls to avoid... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/array_first_last.rb | lib/rubocop/cop/style/array_first_last.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Identifies usages of `arr[0]` and `arr[-1]` and suggests to change
# them to use `arr.first` and `arr.last` instead.
#
# The cop is disabled by default due to safety concerns.
#
# @safety
# This cop... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/hash_syntax.rb | lib/rubocop/cop/style/hash_syntax.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks hash literal syntax.
#
# It can enforce either the use of the class hash rocket syntax or
# the use of the newer Ruby 1.9 syntax (when applicable).
#
# A separate offense is registered for each probl... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/variable_interpolation.rb | lib/rubocop/cop/style/variable_interpolation.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for variable interpolation (like "#@ivar").
#
# @example
# # bad
# "His name is #$name"
# /check #$pattern/
# "Let's go to the #@store"
#
# # good
# "His name is #... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/line_end_concatenation.rb | lib/rubocop/cop/style/line_end_concatenation.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for string literal concatenation at
# the end of a line.
#
# @safety
# This cop is unsafe because it cannot be guaranteed that the
# receiver is a string, in which case replacing `<<` with `\`
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/redundant_initialize.rb | lib/rubocop/cop/style/redundant_initialize.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for `initialize` methods that are redundant.
#
# An initializer is redundant if it does not do anything, or if it only
# calls `super` with the same arguments given to it. If the initializer takes
# an arg... | 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_else_condition.rb | lib/rubocop/cop/style/negated_if_else_condition.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for uses of `if-else` and ternary operators with a negated condition
# which can be simplified by inverting condition and swapping branches.
#
# @example
# # bad
# if !x
# do_something
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/if_with_boolean_literal_branches.rb | lib/rubocop/cop/style/if_with_boolean_literal_branches.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for redundant `if` with boolean literal branches.
# It checks only conditions to return boolean value (`true` or `false`) for safe detection.
# The conditions to be checked are comparison methods, predicate methods, a... | 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_class.rb | lib/rubocop/cop/style/trailing_body_on_class.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for trailing code after the class definition.
#
# @example
# # bad
# class Foo; def foo; end
# end
#
# # good
# class Foo
# def foo; 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/method_call_with_args_parentheses.rb | lib/rubocop/cop/style/method_call_with_args_parentheses.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Enforces the presence (default) or absence of parentheses in
# method calls containing arguments.
#
# In the default style (require_parentheses), macro methods are allowed.
# Additional methods can be added to th... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/bare_percent_literals.rb | lib/rubocop/cop/style/bare_percent_literals.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks if usage of %() or %Q() matches configuration.
#
# @example EnforcedStyle: bare_percent (default)
# # bad
# %Q(He said: "#{greeting}")
# %q{She said: 'Hi'}
#
# # good
# %(... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/fetch_env_var.rb | lib/rubocop/cop/style/fetch_env_var.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Suggests `ENV.fetch` for the replacement of `ENV[]`.
# `ENV[]` silently fails and returns `nil` when the environment variable is unset,
# which may cause unexpected behaviors when the developer forgets to set it.
# On ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/frozen_string_literal_comment.rb | lib/rubocop/cop/style/frozen_string_literal_comment.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Helps you transition from mutable string literals
# to frozen string literals.
# It will add the `# frozen_string_literal: true` magic comment to the top
# of files to enable frozen string literals. Frozen string liter... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/nested_modifier.rb | lib/rubocop/cop/style/nested_modifier.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for nested use of if, unless, while and until in their
# modifier form.
#
# @example
#
# # bad
# something if a if b
#
# # good
# something if b && a
class Neste... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/collection_compact.rb | lib/rubocop/cop/style/collection_compact.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for places where custom logic on rejection nils from arrays
# and hashes can be replaced with `{Array,Hash}#{compact,compact!}`.
#
# @safety
# It is unsafe by default because false positives may occur in... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/if_unless_modifier_of_if_unless.rb | lib/rubocop/cop/style/if_unless_modifier_of_if_unless.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for if and unless statements used as modifiers of other if or
# unless statements.
#
# @example
#
# # bad
# tired? ? 'stop' : 'go faster' if running?
#
# # bad
# if tired?... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/combinable_defined.rb | lib/rubocop/cop/style/combinable_defined.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for multiple `defined?` calls joined by `&&` that can be combined
# into a single `defined?`.
#
# When checking that a nested constant or chained method is defined, it is
# not necessary to check each ance... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/percent_literal_delimiters.rb | lib/rubocop/cop/style/percent_literal_delimiters.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Enforces the consistent usage of `%`-literal delimiters.
#
# Specify the 'default' key to set all preferred delimiters at once. You
# can continue to specify individual preferred delimiters to override the
# defa... | 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_argument.rb | lib/rubocop/cop/style/redundant_regexp_argument.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Identifies places where argument can be replaced from
# a deterministic regexp to a string.
#
# @example
# # bad
# 'foo'.byteindex(/f/)
# 'foo'.byterindex(/f/)
# 'foo'.gsub(/f/, 'x')
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/perl_backrefs.rb | lib/rubocop/cop/style/perl_backrefs.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Looks for uses of Perl-style regexp match
# backreferences and their English versions like
# $1, $2, $&, &+, $MATCH, $PREMATCH, etc.
#
# @example
# # bad
# puts $1
#
# # good
#... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/trivial_accessors.rb | lib/rubocop/cop/style/trivial_accessors.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Looks for trivial reader/writer methods, that could
# have been created with the attr_* family of functions automatically.
# `to_ary`, `to_a`, `to_c`, `to_enum`, `to_h`, `to_hash`, `to_i`, `to_int`, `to_io`,
# `to_open... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/arguments_forwarding.rb | lib/rubocop/cop/style/arguments_forwarding.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# In Ruby 2.7, arguments forwarding has been added.
#
# This cop identifies places where `do_something(*args, &block)`
# can be replaced by `do_something(...)`.
#
# In Ruby 3.1, anonymous block forwarding has... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/collection_querying.rb | lib/rubocop/cop/style/collection_querying.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Prefer `Enumerable` predicate methods over expressions with `count`.
#
# The cop checks calls to `count` without arguments, or with a
# block. It doesn't register offenses for `count` with a positional
# argument... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/redundant_current_directory_in_path.rb | lib/rubocop/cop/style/redundant_current_directory_in_path.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for paths given to `require_relative` that start with
# the current directory (`./`), which can be omitted.
#
# @example
#
# # bad
# require_relative './path/to/feature'
#
# #... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/if_unless_modifier.rb | lib/rubocop/cop/style/if_unless_modifier.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for `if` and `unless` statements that would fit on one line if
# written as modifier `if`/`unless`. The cop also checks for modifier
# `if`/`unless` lines that exceed the maximum line length.
#
# The maxim... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/mixin_grouping.rb | lib/rubocop/cop/style/mixin_grouping.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for grouping of mixins in `class` and `module` bodies.
# By default it enforces mixins to be placed in separate declarations,
# but it can be configured to enforce grouping them in one declaration.
#
# @ex... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/magic_comment_format.rb | lib/rubocop/cop/style/magic_comment_format.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Ensures magic comments are written consistently throughout your code base.
# Looks for discrepancies in separators (`-` vs `_`) and capitalization for
# both magic comment directives and values.
#
# Required capi... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/string_hash_keys.rb | lib/rubocop/cop/style/string_hash_keys.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for the use of strings as keys in hashes. The use of
# symbols is preferred instead.
#
# @safety
# This cop is unsafe because while symbols are preferred for hash keys,
# there are instances when... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/exponential_notation.rb | lib/rubocop/cop/style/exponential_notation.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Enforces consistency when using exponential notation
# for numbers in the code (eg 1.2e4). Different styles are supported:
#
# * `scientific` which enforces a mantissa between 1 (inclusive) and 10 (exclusive).
# ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/multiline_ternary_operator.rb | lib/rubocop/cop/style/multiline_ternary_operator.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for multi-line ternary op expressions.
#
# NOTE: `return if ... else ... end` is syntax error. If `return` is used before
# multiline ternary operator expression, it will be autocorrected to 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/identical_conditional_branches.rb | lib/rubocop/cop/style/identical_conditional_branches.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for identical expressions at the beginning or end of
# each branch of a conditional expression. Such expressions should normally
# be placed outside the conditional expression - before or after it.
#
# NOT... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/rescue_standard_error.rb | lib/rubocop/cop/style/rescue_standard_error.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for rescuing `StandardError`. There are two supported
# styles `implicit` and `explicit`. This cop will not register an offense
# if any error other than `StandardError` is specified.
#
# @example Enforced... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/nested_parenthesized_calls.rb | lib/rubocop/cop/style/nested_parenthesized_calls.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for unparenthesized method calls in the argument list
# of a parenthesized method call.
# `be`, `be_a`, `be_an`, `be_between`, `be_falsey`, `be_kind_of`, `be_instance_of`,
# `be_truthy`, `be_within`, `eq`, `eql`... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/empty_else.rb | lib/rubocop/cop/style/empty_else.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for empty else-clauses, possibly including comments and/or an
# explicit `nil` depending on the EnforcedStyle.
#
# @example EnforcedStyle: both (default)
# # warn on empty else and else with nil in it
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/percent_q_literals.rb | lib/rubocop/cop/style/percent_q_literals.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for usage of the %Q() syntax when %q() would do.
#
# @example EnforcedStyle: lower_case_q (default)
# # The `lower_case_q` style prefers `%q` unless
# # interpolation is needed.
# # bad
#... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/empty_literal.rb | lib/rubocop/cop/style/empty_literal.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for the use of a method, the result of which
# would be a literal, like an empty array, hash, or string.
#
# NOTE: When frozen string literals are enabled, `String.new`
# isn't corrected to an empty string... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/documentation.rb | lib/rubocop/cop/style/documentation.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for missing top-level documentation of classes and
# modules. Classes with no body are exempt from the check and so are
# namespace modules - modules that have nothing in their bodies except
# classes, other mod... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/redundant_percent_q.rb | lib/rubocop/cop/style/redundant_percent_q.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for usage of the %q/%Q syntax when '' or "" would do.
#
# @example
#
# # bad
# name = %q(Bruce Wayne)
# time = %q(8 o'clock)
# question = %q("What did you say?")
#
# ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/multiline_method_signature.rb | lib/rubocop/cop/style/multiline_method_signature.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for method signatures that span multiple lines.
#
# @example
#
# # good
#
# def foo(bar, baz)
# end
#
# # bad
#
# def foo(bar,
# baz)
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/static_class.rb | lib/rubocop/cop/style/static_class.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for places where classes with only class methods can be
# replaced with a module. Classes should be used only when it makes sense to create
# instances out of them.
#
# @safety
# This cop is unsafe... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/format_string.rb | lib/rubocop/cop/style/format_string.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Enforces the use of a single string formatting utility.
# Valid options include `Kernel#format`, `Kernel#sprintf`, and `String#%`.
#
# The detection of `String#%` cannot be implemented in a reliable
# manner for ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/missing_respond_to_missing.rb | lib/rubocop/cop/style/missing_respond_to_missing.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for the presence of `method_missing` without also
# defining `respond_to_missing?`.
#
# Not defining `respond_to_missing?` will cause metaprogramming
# methods like `respond_to?` to behave unexpectedly:
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/global_vars.rb | lib/rubocop/cop/style/global_vars.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Looks for uses of global variables.
# It does not report offenses for built-in global variables.
# Built-in global variables are allowed by default. Additionally
# users can allow additional variables via the AllowedVa... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/collection_methods.rb | lib/rubocop/cop/style/collection_methods.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Enforces the use of consistent method names
# from the Enumerable module.
#
# You can customize the mapping from undesired method to desired method.
#
# e.g. to use `detect` over `find`:
#
# S... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/or_assignment.rb | lib/rubocop/cop/style/or_assignment.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for potential usage of the `||=` operator.
#
# @example
# # bad
# name = name ? name : 'Bozhidar'
#
# # bad
# name = if name
# name
# else
# ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/ascii_comments.rb | lib/rubocop/cop/style/ascii_comments.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for non-ascii (non-English) characters
# in comments. You could set an array of allowed non-ascii chars in
# `AllowedChars` attribute (copyright notice "©" by default).
#
# @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/redundant_return.rb | lib/rubocop/cop/style/redundant_return.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for redundant `return` expressions.
#
# @example
# # These bad cases should be extended to handle methods whose body is
# # if/else or a case expression with a default branch.
#
# # bad
... | 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_branch.rb | lib/rubocop/cop/style/redundant_self_assignment_branch.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for places where conditional branch makes redundant self-assignment.
#
# It only detects local variable because it may replace state of instance variable,
# class variable, and global variable that have state ac... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/each_for_simple_loop.rb | lib/rubocop/cop/style/each_for_simple_loop.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for loops which iterate a constant number of times,
# using a `Range` literal and `#each`. This can be done more readably using
# `Integer#times`.
#
# This check only applies if the block takes no paramete... | 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_constructor.rb | lib/rubocop/cop/style/redundant_array_constructor.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for the instantiation of array using redundant `Array` constructor.
# Autocorrect replaces to array literal which is the simplest and fastest.
#
# @example
#
# # bad
# Array.new([])
#... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/if_inside_else.rb | lib/rubocop/cop/style/if_inside_else.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# If the `else` branch of a conditional consists solely of an `if` node,
# it can be combined with the `else` to become an `elsif`.
# This helps to keep the nesting level from getting too deep.
#
# @example
#... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/documentation_method.rb | lib/rubocop/cop/style/documentation_method.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for missing documentation comment for public methods.
# It can optionally be configured to also require documentation for
# non-public methods.
#
# NOTE: This cop allows `initialize` method because `initia... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/hash_as_last_array_item.rb | lib/rubocop/cop/style/hash_as_last_array_item.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for presence or absence of braces around hash literal as a last
# array item depending on configuration.
#
# NOTE: This cop will ignore arrays where all items are hashes, regardless of
# EnforcedStyle.
... | 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_array_literal.rb | lib/rubocop/cop/style/trailing_comma_in_array_literal.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for trailing comma in array literals.
# The configuration options are:
#
# * `consistent_comma`: Requires a comma after the last item of all non-empty, multiline array
# literals.
# * `comma`: Requir... | 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.rb | lib/rubocop/cop/style/string_literals.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks if uses of quotes match the configured preference.
#
# @example EnforcedStyle: single_quotes (default)
# # bad
# "No special symbols"
# "No string interpolation"
# "Just text"
#
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/concat_array_literals.rb | lib/rubocop/cop/style/concat_array_literals.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Enforces the use of `Array#push(item)` instead of `Array#concat([item])`
# to avoid redundant array literals.
#
# @safety
# This cop is unsafe, as it can produce false positives if the receiver
# is not... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/redundant_parentheses.rb | lib/rubocop/cop/style/redundant_parentheses.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for redundant parentheses.
#
# @example
#
# # bad
# (x) if ((y.z).nil?)
#
# # good
# x if y.z.nil?
#
class RedundantParentheses < Base # rubocop:disable Metrics/... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/nil_comparison.rb | lib/rubocop/cop/style/nil_comparison.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for comparison of something with nil using `==` and
# `nil?`.
#
# Supported styles are: predicate, comparison.
#
# @example EnforcedStyle: predicate (default)
#
# # bad
# if x =... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/array_join.rb | lib/rubocop/cop/style/array_join.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for uses of "*" as a substitute for _join_.
#
# Not all cases can reliably checked, due to Ruby's dynamic
# types, so we consider only cases when the first argument is an
# array literal or the second is a... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/module_member_existence_check.rb | lib/rubocop/cop/style/module_member_existence_check.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for usage of `Module` methods returning arrays that can be replaced
# with equivalent predicates.
#
# Calling a method returning an array then checking if an element is inside
# it is much slower than usin... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/format_string_token.rb | lib/rubocop/cop/style/format_string_token.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Use a consistent style for tokens within a format string.
#
# By default, all strings are evaluated. In some cases, this may be undesirable,
# as they could be used as arguments to a method that does not consider
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/keyword_parameters_order.rb | lib/rubocop/cop/style/keyword_parameters_order.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Enforces that optional keyword parameters are placed at the
# end of the parameters list.
#
# This improves readability, because when looking through the source,
# it is expected to find required parameters at th... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/numeric_literal_prefix.rb | lib/rubocop/cop/style/numeric_literal_prefix.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for octal, hex, binary, and decimal literals using
# uppercase prefixes and corrects them to lowercase prefix
# or no prefix (in case of decimals).
#
# @example EnforcedOctalStyle: zero_with_o (default)
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/open_struct_use.rb | lib/rubocop/cop/style/open_struct_use.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Flags uses of `OpenStruct`, as it is now officially discouraged
# to be used for performance, version compatibility, and potential security issues.
#
# @safety
# Note that this cop may flag false positives; for... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/nested_file_dirname.rb | lib/rubocop/cop/style/nested_file_dirname.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for nested `File.dirname`.
# It replaces nested `File.dirname` with the level argument introduced in Ruby 3.1.
#
# @example
#
# # bad
# File.dirname(File.dirname(path))
#
# # ... | 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_block_args.rb | lib/rubocop/cop/style/trailing_comma_in_block_args.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks whether trailing commas in block arguments are
# required. Blocks with only one argument and a trailing comma require
# that comma to be present. Blocks with more than one argument never
# require a trailing com... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/it_assignment.rb | lib/rubocop/cop/style/it_assignment.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for local variables and method parameters named `it`,
# where `it` can refer to the first anonymous parameter as of Ruby 3.4.
# Use a meaningful variable name instead.
#
# NOTE: Although Ruby allows reassi... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/strip.rb | lib/rubocop/cop/style/strip.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Identifies places where `lstrip.rstrip` can be replaced by
# `strip`.
#
# @example
# # bad
# 'abc'.lstrip.rstrip
# 'abc'.rstrip.lstrip
#
# # good
# 'abc'.strip
class ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/combinable_loops.rb | lib/rubocop/cop/style/combinable_loops.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for places where multiple consecutive loops over the same data
# can be combined into a single loop. It is very likely that combining them
# will make the code more efficient and more concise.
#
# NOTE: Au... | 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_chain_length.rb | lib/rubocop/cop/style/safe_navigation_chain_length.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Enforces safe navigation chains length to not exceed the configured maximum.
# The longer the chain is, the harder it becomes to track what on it could be
# returning `nil`.
#
# There is a potential interplay wit... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/encoding.rb | lib/rubocop/cop/style/encoding.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks ensures source files have no utf-8 encoding comments.
# @example
# # bad
# # encoding: UTF-8
# # coding: UTF-8
# # -*- coding: UTF-8 -*-
class Encoding < Base
include RangeHelp
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/preferred_hash_methods.rb | lib/rubocop/cop/style/preferred_hash_methods.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for uses of methods `Hash#has_key?` and
# `Hash#has_value?`, and suggests using `Hash#key?` and `Hash#value?` instead.
#
# It is configurable to enforce the verbose method names, by using the
# `EnforcedSt... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/accessor_grouping.rb | lib/rubocop/cop/style/accessor_grouping.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for grouping of accessors in `class` and `module` bodies.
# By default it enforces accessors to be placed in grouped declarations,
# but it can be configured to enforce separating them in multiple declarations.
... | 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_limit.rb | lib/rubocop/cop/style/numbered_parameters_limit.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Detects use of an excessive amount of numbered parameters in a
# single block. Having too many numbered parameters can make code too
# cryptic and hard to read.
#
# The cop defaults to registering an offense if t... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/hash_transform_keys.rb | lib/rubocop/cop/style/hash_transform_keys.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Looks for uses of `+_.each_with_object({}) {...}+`,
# `+_.map {...}.to_h+`, and `+Hash[_.map {...}]+` that are actually just
# transforming the keys of a hash, and tries to use a simpler & faster
# call to `transform_k... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/character_literal.rb | lib/rubocop/cop/style/character_literal.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for uses of the character literal ?x.
# Starting with Ruby 1.9 character literals are
# essentially one-character strings, so this syntax
# is mostly redundant at this point.
#
# ? character literal ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/keyword_arguments_merging.rb | lib/rubocop/cop/style/keyword_arguments_merging.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# When passing an existing hash as keyword arguments, provide additional arguments
# directly rather than using `merge`.
#
# Providing arguments directly is more performant than using `merge`, and
# also leads to s... | 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_block_params.rb | lib/rubocop/cop/style/single_line_block_params.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks whether the block parameters of a single-line
# method accepting a block match the names specified via configuration.
#
# For instance one can configure `reduce`(`inject`) to use |a, e| as
# parameters.
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/block_comments.rb | lib/rubocop/cop/style/block_comments.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Looks for uses of block comments (=begin...=end).
#
# @example
# # bad
# =begin
# Multiple lines
# of comments...
# =end
#
# # good
# # Multiple lines
# #... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/hash_slice.rb | lib/rubocop/cop/style/hash_slice.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for usages of `Hash#reject`, `Hash#select`, and `Hash#filter` methods
# that can be replaced with `Hash#slice` method.
#
# This cop should only be enabled on Ruby version 2.5 or higher.
# (`Hash#slice` was... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/send.rb | lib/rubocop/cop/style/send.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for the use of the send method.
#
# @example
# # bad
# Foo.send(bar)
# quuz.send(fred)
#
# # good
# Foo.__send__(bar)
# quuz.public_send(fred)
class Send < B... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/empty_string_inside_interpolation.rb | lib/rubocop/cop/style/empty_string_inside_interpolation.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for empty strings being assigned inside string interpolation.
#
# Empty strings are a meaningless outcome inside of string interpolation, so we remove them.
# Alternatively, when configured to do so, we prioriti... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/negated_unless.rb | lib/rubocop/cop/style/negated_unless.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for uses of unless with a negated condition. Only unless
# without else are considered. There are three different styles:
#
# * both
# * prefix
# * postfix
#
# @example EnforcedStyle: bot... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/dir.rb | lib/rubocop/cop/style/dir.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for places where the `#\_\_dir\_\_` method can replace more
# complex constructs to retrieve a canonicalized absolute path to the
# current file.
#
# @example
# # bad
# path = File.expand_p... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/hash_fetch_chain.rb | lib/rubocop/cop/style/hash_fetch_chain.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Use `Hash#dig` instead of chaining potentially null `fetch` calls.
#
# When `fetch(identifier, nil)` calls are chained on a hash, the expectation
# is that each step in the chain returns either `nil` or another hash,
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/in_pattern_then.rb | lib/rubocop/cop/style/in_pattern_then.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for `in;` uses in `case` expressions.
#
# @example
# # bad
# case expression
# in pattern_a; foo
# in pattern_b; bar
# end
#
# # good
# case expression
... | 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_hash_literal.rb | lib/rubocop/cop/style/trailing_comma_in_hash_literal.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for trailing comma in hash literals.
# The configuration options are:
#
# * `consistent_comma`: Requires a comma after the last item of all non-empty, multiline hash
# literals.
# * `comma`: Requires... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/style/operator_method_call.rb | lib/rubocop/cop/style/operator_method_call.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for redundant dot before operator method call.
# The target operator methods are `|`, `^`, `&`, ``<=>``, `==`, `===`, `=~`, `>`, `>=`, `<`,
# ``<=``, `<<`, `>>`, `+`, `-`, `*`, `/`, `%`, `**`, `~`, `!`, `!=`, and `!~`... | 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.