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/gemspec/attribute_assignment.rb | lib/rubocop/cop/gemspec/attribute_assignment.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Gemspec
# Use consistent style for Gemspec attributes assignment.
#
# @example
#
# # bad
# # This example uses two styles for assignment of metadata attribute.
# Gem::Specification.new do |spec|
#... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/gemspec/duplicated_assignment.rb | lib/rubocop/cop/gemspec/duplicated_assignment.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Gemspec
# An attribute assignment method calls should be listed only once
# in a gemspec.
#
# Assigning to an attribute with the same name using `spec.foo =` or
# `spec.attribute#[]=` will be an unintended usage. On the ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/migration/department_name.rb | lib/rubocop/cop/migration/department_name.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Migration
# Check that cop names in rubocop:disable comments are given with
# department name.
class DepartmentName < Base
include RangeHelp
extend AutoCorrector
MSG = 'Department name is missing.'
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/legacy/corrector.rb | lib/rubocop/cop/legacy/corrector.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Legacy
# Legacy Corrector for v0 API support.
# See https://docs.rubocop.org/rubocop/v1_upgrade_notes.html
class Corrector < RuboCop::Cop::Corrector
# Support legacy second argument
def initialize(source, corr = [])
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/legacy/corrections_proxy.rb | lib/rubocop/cop/legacy/corrections_proxy.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Legacy
# Legacy support for Corrector#corrections
# See https://docs.rubocop.org/rubocop/v1_upgrade_notes.html
class CorrectionsProxy
def initialize(corrector)
@corrector = corrector
end
def <<(cal... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/security/yaml_load.rb | lib/rubocop/cop/security/yaml_load.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Security
# Checks for the use of YAML class methods which have
# potential security issues leading to remote code execution when
# loading from an untrusted source.
#
# NOTE: Ruby 3.1+ (Psych 4) uses `Psych.load` as `Psy... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/security/marshal_load.rb | lib/rubocop/cop/security/marshal_load.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Security
# Checks for the use of Marshal class methods which have
# potential security issues leading to remote code execution when
# loading from an untrusted source.
#
# @example
# # bad
# Marshal.load(... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/security/io_methods.rb | lib/rubocop/cop/security/io_methods.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Security
# Checks for the first argument to `IO.read`, `IO.binread`, `IO.write`, `IO.binwrite`,
# `IO.foreach`, and `IO.readlines`.
#
# If argument starts with a pipe character (`'|'`) and the receiver is the `IO` class,
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/security/open.rb | lib/rubocop/cop/security/open.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Security
# Checks for the use of `Kernel#open` and `URI.open` with dynamic
# data.
#
# `Kernel#open` and `URI.open` enable not only file access but also process
# invocation by prefixing a pipe symbol (e.g., `open("| ls"... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/security/compound_hash.rb | lib/rubocop/cop/security/compound_hash.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Security
# Checks for implementations of the `hash` method which combine
# values using custom logic instead of delegating to `Array#hash`.
#
# Manually combining hashes is error prone and hard to follow, especially
# wh... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/security/eval.rb | lib/rubocop/cop/security/eval.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Security
# Checks for the use of `Kernel#eval` and `Binding#eval`.
#
# @example
#
# # bad
#
# eval(something)
# binding.eval(something)
# Kernel.eval(something)
class Eval < Base
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/security/json_load.rb | lib/rubocop/cop/security/json_load.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Security
# Checks for the use of JSON class methods which have potential
# security issues.
#
# `JSON.load` and similar methods allow deserialization of arbitrary ruby objects:
#
# [source,ruby]
# ----
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/bundler/gem_comment.rb | lib/rubocop/cop/bundler/gem_comment.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Bundler
# Each gem in the Gemfile should have a comment explaining
# its purpose in the project, or the reason for its version
# or source.
#
# The optional "OnlyFor" configuration array
# can be used to only regis... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/bundler/insecure_protocol_source.rb | lib/rubocop/cop/bundler/insecure_protocol_source.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Bundler
# Passing symbol arguments to `source` (e.g. `source :rubygems`) is
# deprecated because they default to using HTTP requests. Instead, specify
# `'https://rubygems.org'` if possible, or `'http://rubygems.org'` if not.
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/bundler/ordered_gems.rb | lib/rubocop/cop/bundler/ordered_gems.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Bundler
# Gems should be alphabetically sorted within groups.
#
# @example
# # bad
# gem 'rubocop'
# gem 'rspec'
#
# # good
# gem 'rspec'
# gem 'rubocop'
#
# # good... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/bundler/duplicated_gem.rb | lib/rubocop/cop/bundler/duplicated_gem.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Bundler
# A Gem's requirements should be listed only once in a Gemfile.
#
# @example
# # bad
# gem 'rubocop'
# gem 'rubocop'
#
# # bad
# group :development do
# gem 'rubocop'
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/bundler/gem_filename.rb | lib/rubocop/cop/bundler/gem_filename.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Bundler
# Verifies that a project contains Gemfile or gems.rb file and correct
# associated lock file based on the configuration.
#
# @example EnforcedStyle: Gemfile (default)
# # bad
# Project contains gems.rb... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/bundler/gem_version.rb | lib/rubocop/cop/bundler/gem_version.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Bundler
# Enforce that Gem version specifications or a commit reference (branch,
# ref, or tag) are either required or forbidden.
#
# @example EnforcedStyle: required (default)
# # bad
# gem 'rubocop'
#
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/bundler/duplicated_group.rb | lib/rubocop/cop/bundler/duplicated_group.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Bundler
# A Gem group, or a set of groups, should be listed only once in a Gemfile.
#
# For example, if the values of `source`, `git`, `platforms`, or `path`
# surrounding `group` are different, no offense will be registered:
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/naming/method_name.rb | lib/rubocop/cop/naming/method_name.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Naming
# Makes sure that all methods use the configured style,
# snake_case or camelCase, for their names.
#
# Method names matching patterns are always allowed.
#
# The cop can be configured with `AllowedPatterns`... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/naming/accessor_method_name.rb | lib/rubocop/cop/naming/accessor_method_name.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Naming
# Avoid prefixing accessor method names with `get_` or `set_`.
# Applies to both instance and class methods.
#
# NOTE: Method names starting with `get_` or `set_` only register an offense
# when the methods match ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/naming/block_parameter_name.rb | lib/rubocop/cop/naming/block_parameter_name.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Naming
# Checks block parameter names for how descriptive they
# are. It is highly configurable.
#
# The `MinNameLength` config option takes an integer. It represents
# the minimum amount of characters the name must be. ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/naming/method_parameter_name.rb | lib/rubocop/cop/naming/method_parameter_name.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Naming
# Checks method parameter names for how descriptive they
# are. It is highly configurable.
#
# The `MinNameLength` config option takes an integer. It represents
# the minimum amount of characters the name must be.... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb | lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Naming
# Makes sure that rescued exceptions variables are named as
# expected.
#
# The `PreferredName` config option takes a `String`. It represents
# the required name of the variable. Its default is `e`.
#
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/naming/heredoc_delimiter_naming.rb | lib/rubocop/cop/naming/heredoc_delimiter_naming.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Naming
# Checks that your heredocs are using meaningful delimiters.
# By default it disallows `END` and `EO*`, and can be configured through
# forbidden listing additional delimiters.
#
# @example
#
# # goo... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/naming/variable_name.rb | lib/rubocop/cop/naming/variable_name.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Naming
# Checks that the configured style (snake_case or camelCase) is used for all variable names.
# This includes local variables, instance variables, class variables, method arguments
# (positional, keyword, rest or block), and b... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/naming/ascii_identifiers.rb | lib/rubocop/cop/naming/ascii_identifiers.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Naming
# Checks for non-ascii characters in identifier and constant names.
# Identifiers are always checked and whether constants are checked
# can be controlled using AsciiConstants config.
#
# @example
# # bad
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/naming/file_name.rb | lib/rubocop/cop/naming/file_name.rb | # frozen_string_literal: true
require 'pathname'
module RuboCop
module Cop
module Naming
# Makes sure that Ruby source files have snake_case
# names. Ruby scripts (i.e. source files with a shebang in the
# first line) are ignored.
#
# The cop also ignores `.gemspec` files, because ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/naming/class_and_module_camel_case.rb | lib/rubocop/cop/naming/class_and_module_camel_case.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Naming
# Checks for class and module names with
# an underscore in them.
#
# `AllowedNames` config takes an array of permitted names.
# Its default value is `['module_parent']`.
# These names can be full class/modu... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/naming/memoized_instance_variable_name.rb | lib/rubocop/cop/naming/memoized_instance_variable_name.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Naming
# Checks for memoized methods whose instance variable name
# does not match the method name. Applies to both regular methods
# (defined with `def`) and dynamic methods (defined with
# `define_method` or `define_singleto... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/naming/variable_number.rb | lib/rubocop/cop/naming/variable_number.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Naming
# Makes sure that all numbered variables use the
# configured style, snake_case, normalcase, or non_integer,
# for their numbering.
#
# Additionally, `CheckMethodNames` and `CheckSymbols` configuration options
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/naming/inclusive_language.rb | lib/rubocop/cop/naming/inclusive_language.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Naming
# Recommends the use of inclusive language instead of problematic terms.
# The cop can check the following locations for offenses:
#
# - identifiers
# - constants
# - variables
# - strings
# - sy... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/naming/predicate_method.rb | lib/rubocop/cop/naming/predicate_method.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Naming
# Checks that predicate methods end with `?` and non-predicate methods do not.
#
# The names of predicate methods (methods that return a boolean value) should end
# in a question mark. Methods that don't return a boolea... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/naming/predicate_prefix.rb | lib/rubocop/cop/naming/predicate_prefix.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Naming
# Checks that predicate method names end with a question mark and
# do not start with a forbidden prefix.
#
# A method is determined to be a predicate method if its name starts with
# one of the prefixes listed in... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/naming/heredoc_delimiter_case.rb | lib/rubocop/cop/naming/heredoc_delimiter_case.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Naming
# Checks that your heredocs are using the configured case.
# By default it is configured to enforce uppercase heredocs.
#
# @example EnforcedStyle: uppercase (default)
# # bad
# <<-sql
# SELECT... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/naming/block_forwarding.rb | lib/rubocop/cop/naming/block_forwarding.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Naming
# In Ruby 3.1, anonymous block forwarding has been added.
#
# This cop identifies places where `do_something(&block)` can be replaced
# by `do_something(&)`.
#
# It also supports the opposite style by altern... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/naming/binary_operator_parameter_name.rb | lib/rubocop/cop/naming/binary_operator_parameter_name.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Naming
# Makes sure that certain binary operator methods have their
# sole parameter named `other`.
#
# @example
#
# # bad
# def +(amount); end
#
# # good
# def +(other); end
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/naming/constant_name.rb | lib/rubocop/cop/naming/constant_name.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Naming
# Checks whether constant names are written using
# SCREAMING_SNAKE_CASE.
#
# To avoid false positives, it ignores cases in which we cannot know
# for certain the type of value that would be assigned to a constant... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/variable_force/reference.rb | lib/rubocop/cop/variable_force/reference.rb | # frozen_string_literal: true
module RuboCop
module Cop
class VariableForce
# This class represents each reference of a variable.
class Reference
include Branchable
VARIABLE_REFERENCE_TYPES = (
[VARIABLE_REFERENCE_TYPE] + OPERATOR_ASSIGNMENT_TYPES + [ZERO_ARITY_SUPER_TYPE, ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/variable_force/branchable.rb | lib/rubocop/cop/variable_force/branchable.rb | # frozen_string_literal: true
module RuboCop
module Cop
class VariableForce
# Mix-in module for classes which own a node and need branch information
# of the node. The user classes must implement #node and #scope.
module Branchable
def branch
return @branch if instance_variabl... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/variable_force/assignment.rb | lib/rubocop/cop/variable_force/assignment.rb | # frozen_string_literal: true
module RuboCop
module Cop
class VariableForce
# This class represents each assignment of a variable.
class Assignment
include Branchable
MULTIPLE_LEFT_HAND_SIDE_TYPE = :mlhs
attr_reader :node, :variable, :referenced, :references, :reassigned
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/variable_force/scope.rb | lib/rubocop/cop/variable_force/scope.rb | # frozen_string_literal: true
module RuboCop
module Cop
class VariableForce
# A Scope represents a context of local variable visibility.
# This is a place where local variables belong to.
# A scope instance holds a scope node and variable entries.
class Scope
OUTER_SCOPE_CHILD_IND... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/variable_force/variable.rb | lib/rubocop/cop/variable_force/variable.rb | # frozen_string_literal: true
module RuboCop
module Cop
class VariableForce
# A Variable represents existence of a local variable.
# This holds a variable declaration node and some states of the variable.
class Variable
VARIABLE_DECLARATION_TYPES = (VARIABLE_ASSIGNMENT_TYPES + ARGUMENT_... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/variable_force/variable_table.rb | lib/rubocop/cop/variable_force/variable_table.rb | # frozen_string_literal: true
module RuboCop
module Cop
class VariableForce
# A VariableTable manages the lifetime of all scopes and local variables
# in a program.
# This holds scopes as stack structure, provides a way to add local
# variables to current scope, and find local variables b... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/variable_force/branch.rb | lib/rubocop/cop/variable_force/branch.rb | # frozen_string_literal: true
module RuboCop
module Cop
class VariableForce
# Namespace for branch classes for each control structure.
module Branch
def self.of(target_node, scope: nil)
([target_node] + target_node.ancestors).each do |node|
return nil unless node.parent
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/server/core.rb | lib/rubocop/server/core.rb | # frozen_string_literal: true
require 'securerandom'
require 'socket'
require 'stringio'
#
# This code is based on https://github.com/fohte/rubocop-daemon.
#
# Copyright (c) 2018 Hayato Kawai
#
# The MIT License (MIT)
#
# https://github.com/fohte/rubocop-daemon/blob/master/LICENSE.txt
#
module RuboCop
module Server... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/server/errors.rb | lib/rubocop/server/errors.rb | # frozen_string_literal: true
#
# This code is based on https://github.com/fohte/rubocop-daemon.
#
# Copyright (c) 2018 Hayato Kawai
#
# The MIT License (MIT)
#
# https://github.com/fohte/rubocop-daemon/blob/master/LICENSE.txt
#
module RuboCop
module Server
# @api private
class InvalidTokenError < StandardEr... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/server/client_command.rb | lib/rubocop/server/client_command.rb | # frozen_string_literal: true
#
# This code is based on https://github.com/fohte/rubocop-daemon.
#
# Copyright (c) 2018 Hayato Kawai
#
# The MIT License (MIT)
#
# https://github.com/fohte/rubocop-daemon/blob/master/LICENSE.txt
#
module RuboCop
autoload :Version, 'rubocop/version'
module Server
# @api private
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/server/socket_reader.rb | lib/rubocop/server/socket_reader.rb | # frozen_string_literal: true
#
# This code is based on https://github.com/fohte/rubocop-daemon.
#
# Copyright (c) 2018 Hayato Kawai
#
# The MIT License (MIT)
#
# https://github.com/fohte/rubocop-daemon/blob/master/LICENSE.txt
#
module RuboCop
module Server
# This class sends the request read from the socket to ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/server/cli.rb | lib/rubocop/server/cli.rb | # frozen_string_literal: true
require_relative '../arguments_env'
require_relative '../arguments_file'
#
# This code is based on https://github.com/fohte/rubocop-daemon.
#
# Copyright (c) 2018 Hayato Kawai
#
# The MIT License (MIT)
#
# https://github.com/fohte/rubocop-daemon/blob/master/LICENSE.txt
#
module RuboCop
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/server/server_command.rb | lib/rubocop/server/server_command.rb | # frozen_string_literal: true
#
# This code is based on https://github.com/fohte/rubocop-daemon.
#
# Copyright (c) 2018 Hayato Kawai
#
# The MIT License (MIT)
#
# https://github.com/fohte/rubocop-daemon/blob/master/LICENSE.txt
#
module RuboCop
module Server
# @api private
module ServerCommand
autoload ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/server/helper.rb | lib/rubocop/server/helper.rb | # frozen_string_literal: true
#
# This code is based on https://github.com/fohte/rubocop-daemon.
#
# Copyright (c) 2018 Hayato Kawai
#
# The MIT License (MIT)
#
# https://github.com/fohte/rubocop-daemon/blob/master/LICENSE.txt
#
module RuboCop
module Server
# This module has a helper method for `RuboCop::Server:... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/server/cache.rb | lib/rubocop/server/cache.rb | # frozen_string_literal: true
require 'digest'
require 'pathname'
require 'yaml'
require_relative '../cache_config'
require_relative '../config_finder'
require_relative '../path_util'
#
# This code is based on https://github.com/fohte/rubocop-daemon.
#
# Copyright (c) 2018 Hayato Kawai
#
# The MIT License (MIT)
#
# h... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/server/server_command/exec.rb | lib/rubocop/server/server_command/exec.rb | # frozen_string_literal: true
#
# This code is based on https://github.com/fohte/rubocop-daemon.
#
# Copyright (c) 2018 Hayato Kawai
#
# The MIT License (MIT)
#
# https://github.com/fohte/rubocop-daemon/blob/master/LICENSE.txt
#
module RuboCop
module Server
module ServerCommand
# This class is a server com... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/server/server_command/base.rb | lib/rubocop/server/server_command/base.rb | # frozen_string_literal: true
#
# This code is based on https://github.com/fohte/rubocop-daemon.
#
# Copyright (c) 2018 Hayato Kawai
#
# The MIT License (MIT)
#
# https://github.com/fohte/rubocop-daemon/blob/master/LICENSE.txt
#
module RuboCop
module Server
module ServerCommand
# Abstract base class for se... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/server/server_command/stop.rb | lib/rubocop/server/server_command/stop.rb | # frozen_string_literal: true
#
# This code is based on https://github.com/fohte/rubocop-daemon.
#
# Copyright (c) 2018 Hayato Kawai
#
# The MIT License (MIT)
#
# https://github.com/fohte/rubocop-daemon/blob/master/LICENSE.txt
#
module RuboCop
module Server
module ServerCommand
# This class is a server com... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/server/client_command/start.rb | lib/rubocop/server/client_command/start.rb | # frozen_string_literal: true
#
# This code is based on https://github.com/fohte/rubocop-daemon.
#
# Copyright (c) 2018 Hayato Kawai
#
# The MIT License (MIT)
#
# https://github.com/fohte/rubocop-daemon/blob/master/LICENSE.txt
#
module RuboCop
module Server
module ClientCommand
# This class is a client com... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/server/client_command/exec.rb | lib/rubocop/server/client_command/exec.rb | # frozen_string_literal: true
#
# This code is based on https://github.com/fohte/rubocop-daemon.
#
# Copyright (c) 2018 Hayato Kawai
#
# The MIT License (MIT)
#
# https://github.com/fohte/rubocop-daemon/blob/master/LICENSE.txt
#
module RuboCop
module Server
module ClientCommand
# This class is a client com... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/server/client_command/base.rb | lib/rubocop/server/client_command/base.rb | # frozen_string_literal: true
require 'shellwords'
require 'socket'
#
# This code is based on https://github.com/fohte/rubocop-daemon.
#
# Copyright (c) 2018 Hayato Kawai
#
# The MIT License (MIT)
#
# https://github.com/fohte/rubocop-daemon/blob/master/LICENSE.txt
#
module RuboCop
module Server
module ClientCom... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/server/client_command/stop.rb | lib/rubocop/server/client_command/stop.rb | # frozen_string_literal: true
#
# This code is based on https://github.com/fohte/rubocop-daemon.
#
# Copyright (c) 2018 Hayato Kawai
#
# The MIT License (MIT)
#
# https://github.com/fohte/rubocop-daemon/blob/master/LICENSE.txt
#
module RuboCop
module Server
module ClientCommand
# This class is a client com... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/server/client_command/status.rb | lib/rubocop/server/client_command/status.rb | # frozen_string_literal: true
#
# This code is based on https://github.com/fohte/rubocop-daemon.
#
# Copyright (c) 2018 Hayato Kawai
#
# The MIT License (MIT)
#
# https://github.com/fohte/rubocop-daemon/blob/master/LICENSE.txt
#
module RuboCop
module Server
module ClientCommand
# This class is a client com... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/server/client_command/restart.rb | lib/rubocop/server/client_command/restart.rb | # frozen_string_literal: true
#
# This code is based on https://github.com/fohte/rubocop-daemon.
#
# Copyright (c) 2018 Hayato Kawai
#
# The MIT License (MIT)
#
# https://github.com/fohte/rubocop-daemon/blob/master/LICENSE.txt
#
module RuboCop
module Server
module ClientCommand
# This class is a client com... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cli/command.rb | lib/rubocop/cli/command.rb | # frozen_string_literal: true
module RuboCop
class CLI
# Home of subcommands in the CLI.
# @api private
module Command
class << self
# Find the command with a given name and run it in an environment.
def run(env, name)
class_for(name).new(env).run
end
priv... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cli/environment.rb | lib/rubocop/cli/environment.rb | # frozen_string_literal: true
module RuboCop
class CLI
# Execution environment for a CLI command.
# @api private
class Environment
attr_reader :options, :config_store, :paths
def initialize(options, config_store, paths)
@options = options
@config_store = config_store
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cli/command/version.rb | lib/rubocop/cli/command/version.rb | # frozen_string_literal: true
module RuboCop
class CLI
module Command
# Display version.
# @api private
class Version < Base
self.command_name = :version
def run
puts RuboCop::Version::STRING if @options[:version]
puts RuboCop::Version.verbose(env: env) if @... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cli/command/show_docs_url.rb | lib/rubocop/cli/command/show_docs_url.rb | # frozen_string_literal: true
module RuboCop
class CLI
module Command
# Prints out url to documentation of provided cops
# or documentation base url by default.
# @api private
class ShowDocsUrl < Base
self.command_name = :show_docs_url
def initialize(env)
super
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cli/command/lsp.rb | lib/rubocop/cli/command/lsp.rb | # frozen_string_literal: true
module RuboCop
class CLI
module Command
# Start Language Server Protocol of RuboCop.
# @api private
class LSP < Base
self.command_name = :lsp
def run
# Load on demand, `languge-server-protocol` is heavy to require.
require_relat... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cli/command/execute_runner.rb | lib/rubocop/cli/command/execute_runner.rb | # frozen_string_literal: true
module RuboCop
class CLI
module Command
# Run all the selected cops and report the result.
# @api private
class ExecuteRunner < Base
include Formatter::TextUtil
# Combination of short and long formatter names.
INTEGRATION_FORMATTERS = %w[h ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cli/command/auto_generate_config.rb | lib/rubocop/cli/command/auto_generate_config.rb | # frozen_string_literal: true
module RuboCop
class CLI
module Command
# Generate a configuration file acting as a TODO list.
# @api private
class AutoGenerateConfig < Base
self.command_name = :auto_gen_config
AUTO_GENERATED_FILE = '.rubocop_todo.yml'
YAML_OPTIONAL_DOC_S... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cli/command/base.rb | lib/rubocop/cli/command/base.rb | # frozen_string_literal: true
module RuboCop
class CLI
module Command
# A subcommand in the CLI.
# @api private
class Base
attr_reader :env
@subclasses = []
class << self
attr_accessor :command_name
def inherited(subclass)
super
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cli/command/show_cops.rb | lib/rubocop/cli/command/show_cops.rb | # frozen_string_literal: true
module RuboCop
class CLI
module Command
# Shows the given cops, or all cops by default, and their configurations
# for the current directory.
# @api private
class ShowCops < Base
self.command_name = :show_cops
ExactMatcher = Struct.new(:patte... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cli/command/suggest_extensions.rb | lib/rubocop/cli/command/suggest_extensions.rb | # frozen_string_literal: true
module RuboCop
class CLI
module Command
# Suggest RuboCop extensions to install based on Gemfile dependencies.
# Only primary dependencies are evaluated, so if a dependency depends on a
# gem with an extension, it is not suggested. However, if an extension is
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cli/command/init_dotfile.rb | lib/rubocop/cli/command/init_dotfile.rb | # frozen_string_literal: true
module RuboCop
class CLI
module Command
# Generate a .rubocop.yml file in the current directory.
# @api private
class InitDotfile < Base
DOTFILE = ConfigFinder::DOTFILE
self.command_name = :init
def run
path = File.expand_path(DO... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/ruby_lsp/rubocop/addon.rb | lib/ruby_lsp/rubocop/addon.rb | # frozen_string_literal: true
require_relative '../../rubocop'
require_relative '../../rubocop/lsp/logger'
require_relative 'runtime_adapter'
module RubyLsp
module RuboCop
# A Ruby LSP add-on for RuboCop.
class Addon < RubyLsp::Addon
RESTART_WATCHERS = %w[.rubocop.yml .rubocop_todo.yml .rubocop].freez... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/ruby_lsp/rubocop/runtime_adapter.rb | lib/ruby_lsp/rubocop/runtime_adapter.rb | # frozen_string_literal: true
require_relative '../../rubocop/lsp/runtime'
module RubyLsp
module RuboCop
# Provides an adapter to bridge RuboCop's built-in LSP runtime with Ruby LSP's add-on.
# @api private
class RuntimeAdapter
def initialize(message_queue)
@message_queue = message_queue
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
ruby-grape/grape | https://github.com/ruby-grape/grape/blob/17fb0cf64296e9c9c968ea7b62f7614538070be4/benchmark/large_model.rb | benchmark/large_model.rb | # frozen_string_literal: true
# gem 'grape', '=1.0.1'
require 'grape'
require 'ruby-prof'
require 'hashie'
class API < Grape::API
# include Grape::Extensions::Hash::ParamBuilder
# include Grape::Extensions::Hashie::Mash::ParamBuilder
rescue_from do |e|
warn "\n\n#{e.class} (#{e.message}):\n #{e.backtra... | ruby | MIT | 17fb0cf64296e9c9c968ea7b62f7614538070be4 | 2026-01-04T15:38:22.454413Z | false |
ruby-grape/grape | https://github.com/ruby-grape/grape/blob/17fb0cf64296e9c9c968ea7b62f7614538070be4/benchmark/compile_many_routes.rb | benchmark/compile_many_routes.rb | # frozen_string_literal: true
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'grape'
require 'benchmark/ips'
class API < Grape::API
prefix :api
version 'v1', using: :path
2000.times do |index|
get "/test#{index}/" do
'hello'
end
end
end
Benchmark.ips do |ips|
ips.... | ruby | MIT | 17fb0cf64296e9c9c968ea7b62f7614538070be4 | 2026-01-04T15:38:22.454413Z | false |
ruby-grape/grape | https://github.com/ruby-grape/grape/blob/17fb0cf64296e9c9c968ea7b62f7614538070be4/benchmark/nested_params.rb | benchmark/nested_params.rb | # frozen_string_literal: true
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'grape'
require 'benchmark/ips'
class API < Grape::API
prefix :api
version 'v1', using: :path
params do
requires :address, type: Hash do
requires :street, type: String
requires :postal_code,... | ruby | MIT | 17fb0cf64296e9c9c968ea7b62f7614538070be4 | 2026-01-04T15:38:22.454413Z | false |
ruby-grape/grape | https://github.com/ruby-grape/grape/blob/17fb0cf64296e9c9c968ea7b62f7614538070be4/benchmark/simple.rb | benchmark/simple.rb | # frozen_string_literal: true
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'grape'
require 'benchmark/ips'
class API < Grape::API
prefix :api
version 'v1', using: :path
get '/' do
'hello'
end
end
options = {
method: Rack::GET
}
env = Rack::MockRequest.env_for('/api/v1', o... | ruby | MIT | 17fb0cf64296e9c9c968ea7b62f7614538070be4 | 2026-01-04T15:38:22.454413Z | false |
ruby-grape/grape | https://github.com/ruby-grape/grape/blob/17fb0cf64296e9c9c968ea7b62f7614538070be4/benchmark/remounting.rb | benchmark/remounting.rb | # frozen_string_literal: true
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'grape'
require 'benchmark/memory'
class VotingApi < Grape::API
logger Logger.new($stdout)
helpers do
def logger
VotingApi.logger
end
end
namespace 'votes' do
get do
logger
en... | ruby | MIT | 17fb0cf64296e9c9c968ea7b62f7614538070be4 | 2026-01-04T15:38:22.454413Z | false |
ruby-grape/grape | https://github.com/ruby-grape/grape/blob/17fb0cf64296e9c9c968ea7b62f7614538070be4/benchmark/issue_mounting.rb | benchmark/issue_mounting.rb | # frozen_string_literal: true
require 'bundler/inline'
gemfile(true) do
source 'https://rubygems.org'
gem 'grape'
gem 'rack'
gem 'minitest'
gem 'rack-test'
end
require 'minitest/autorun'
require 'rack/test'
require 'grape'
class GrapeAPIBugTest < Minitest::Test
include Rack::Test::Methods
RootAPI = C... | ruby | MIT | 17fb0cf64296e9c9c968ea7b62f7614538070be4 | 2026-01-04T15:38:22.454413Z | false |
ruby-grape/grape | https://github.com/ruby-grape/grape/blob/17fb0cf64296e9c9c968ea7b62f7614538070be4/spec/spec_helper.rb | spec/spec_helper.rb | # frozen_string_literal: true
require 'simplecov'
require 'rubygems'
require 'bundler'
Bundler.require :default, :test
Grape.deprecator.behavior = :raise
%w[config support].each do |dir|
Dir["#{File.dirname(__FILE__)}/#{dir}/**/*.rb"].each do |file|
require file
end
end
Grape.config.lint = true # lint all a... | ruby | MIT | 17fb0cf64296e9c9c968ea7b62f7614538070be4 | 2026-01-04T15:38:22.454413Z | false |
ruby-grape/grape | https://github.com/ruby-grape/grape/blob/17fb0cf64296e9c9c968ea7b62f7614538070be4/spec/support/endpoint_faker.rb | spec/support/endpoint_faker.rb | # frozen_string_literal: true
module Spec
module Support
class EndpointFaker
class FakerAPI < Grape::API
get('/')
end
def initialize(app, endpoint = FakerAPI.endpoints.first)
@app = app
@endpoint = endpoint
end
def call(env)
@endpoint.instance_exec ... | ruby | MIT | 17fb0cf64296e9c9c968ea7b62f7614538070be4 | 2026-01-04T15:38:22.454413Z | false |
ruby-grape/grape | https://github.com/ruby-grape/grape/blob/17fb0cf64296e9c9c968ea7b62f7614538070be4/spec/support/cookie_jar.rb | spec/support/cookie_jar.rb | # frozen_string_literal: true
require 'uri'
module Spec
module Support
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie
class CookieJar
attr_reader :attributes
def initialize(raw)
@attributes = raw.split(/;\s*/).flat_map.with_index do |attribute, i|
attrib... | ruby | MIT | 17fb0cf64296e9c9c968ea7b62f7614538070be4 | 2026-01-04T15:38:22.454413Z | false |
ruby-grape/grape | https://github.com/ruby-grape/grape/blob/17fb0cf64296e9c9c968ea7b62f7614538070be4/spec/support/integer_helpers.rb | spec/support/integer_helpers.rb | # frozen_string_literal: true
module Spec
module Support
module Helpers
INTEGER_CLASS_NAME = 0.class.to_s.freeze
def integer_class_name
INTEGER_CLASS_NAME
end
end
end
end
| ruby | MIT | 17fb0cf64296e9c9c968ea7b62f7614538070be4 | 2026-01-04T15:38:22.454413Z | false |
ruby-grape/grape | https://github.com/ruby-grape/grape/blob/17fb0cf64296e9c9c968ea7b62f7614538070be4/spec/support/chunked_response.rb | spec/support/chunked_response.rb | # frozen_string_literal: true
# this is a copy of Rack::Chunked which has been removed in rack > 3.0
class ChunkedResponse
class Body
TERM = "\r\n"
TAIL = "0#{TERM}".freeze
# Store the response body to be chunked.
def initialize(body)
@body = body
end
# For each element yielded by th... | ruby | MIT | 17fb0cf64296e9c9c968ea7b62f7614538070be4 | 2026-01-04T15:38:22.454413Z | false |
ruby-grape/grape | https://github.com/ruby-grape/grape/blob/17fb0cf64296e9c9c968ea7b62f7614538070be4/spec/support/basic_auth_encode_helpers.rb | spec/support/basic_auth_encode_helpers.rb | # frozen_string_literal: true
module Spec
module Support
module Helpers
def encode_basic_auth(username, password)
"Basic #{Base64.encode64("#{username}:#{password}")}"
end
end
end
end
| ruby | MIT | 17fb0cf64296e9c9c968ea7b62f7614538070be4 | 2026-01-04T15:38:22.454413Z | false |
ruby-grape/grape | https://github.com/ruby-grape/grape/blob/17fb0cf64296e9c9c968ea7b62f7614538070be4/spec/support/content_type_helpers.rb | spec/support/content_type_helpers.rb | # frozen_string_literal: true
module Spec
module Support
module Helpers
%w[put patch post delete].each do |method|
define_method :"#{method}_with_json" do |uri, params = {}, env = {}, &block|
params = params.to_json
env['CONTENT_TYPE'] ||= 'application/json'
__send__(m... | ruby | MIT | 17fb0cf64296e9c9c968ea7b62f7614538070be4 | 2026-01-04T15:38:22.454413Z | false |
ruby-grape/grape | https://github.com/ruby-grape/grape/blob/17fb0cf64296e9c9c968ea7b62f7614538070be4/spec/support/deprecated_warning_handlers.rb | spec/support/deprecated_warning_handlers.rb | # frozen_string_literal: true
Warning[:deprecated] = true
module DeprecatedWarningHandler
class DeprecationWarning < StandardError; end
DEPRECATION_REGEX = /is deprecated/
def warn(message)
return super unless message.match?(DEPRECATION_REGEX)
exception = DeprecationWarning.new(message)
exception... | ruby | MIT | 17fb0cf64296e9c9c968ea7b62f7614538070be4 | 2026-01-04T15:38:22.454413Z | false |
ruby-grape/grape | https://github.com/ruby-grape/grape/blob/17fb0cf64296e9c9c968ea7b62f7614538070be4/spec/support/versioned_helpers.rb | spec/support/versioned_helpers.rb | # frozen_string_literal: true
# Versioning
module Spec
module Support
module Helpers
# Returns the path with options[:version] prefixed if options[:using] is :path.
# Returns normal path otherwise.
def versioned_path(options)
case options[:using]
when :path
File.join('... | ruby | MIT | 17fb0cf64296e9c9c968ea7b62f7614538070be4 | 2026-01-04T15:38:22.454413Z | false |
ruby-grape/grape | https://github.com/ruby-grape/grape/blob/17fb0cf64296e9c9c968ea7b62f7614538070be4/spec/support/file_streamer.rb | spec/support/file_streamer.rb | # frozen_string_literal: true
class FileStreamer
def initialize(file_path)
@file_path = file_path
end
def each(&blk)
File.open(@file_path, 'rb') do |file|
file.each(10, &blk)
end
end
end
| ruby | MIT | 17fb0cf64296e9c9c968ea7b62f7614538070be4 | 2026-01-04T15:38:22.454413Z | false |
ruby-grape/grape | https://github.com/ruby-grape/grape/blob/17fb0cf64296e9c9c968ea7b62f7614538070be4/spec/support/deregister.rb | spec/support/deregister.rb | # frozen_string_literal: true
module Deregister
def deregister(key)
registry.delete(key)
end
end
| ruby | MIT | 17fb0cf64296e9c9c968ea7b62f7614538070be4 | 2026-01-04T15:38:22.454413Z | false |
ruby-grape/grape | https://github.com/ruby-grape/grape/blob/17fb0cf64296e9c9c968ea7b62f7614538070be4/spec/integration/dry_validation/dry_validation_spec.rb | spec/integration/dry_validation/dry_validation_spec.rb | # frozen_string_literal: true
describe 'Dry::Schema', if: defined?(Dry::Schema) do
describe 'Grape::DSL::Validations' do
subject { app }
let(:app) do
Class.new do
extend Grape::DSL::Validations
extend Grape::DSL::Settings
end
end
describe '.contract' do
it 'saves t... | ruby | MIT | 17fb0cf64296e9c9c968ea7b62f7614538070be4 | 2026-01-04T15:38:22.454413Z | false |
ruby-grape/grape | https://github.com/ruby-grape/grape/blob/17fb0cf64296e9c9c968ea7b62f7614538070be4/spec/integration/rails/mounting_spec.rb | spec/integration/rails/mounting_spec.rb | # frozen_string_literal: true
describe 'Rails', if: defined?(Rails) do
context 'rails mounted' do
let(:api) do
Class.new(Grape::API) do
lint!
get('/test_grape') { 'rails mounted' }
end
end
let(:app) do
require 'rails'
require 'action_controller/railtie'
# h... | ruby | MIT | 17fb0cf64296e9c9c968ea7b62f7614538070be4 | 2026-01-04T15:38:22.454413Z | false |
ruby-grape/grape | https://github.com/ruby-grape/grape/blob/17fb0cf64296e9c9c968ea7b62f7614538070be4/spec/integration/rails/railtie_spec.rb | spec/integration/rails/railtie_spec.rb | # frozen_string_literal: true
if defined?(Rails)
describe Grape::Railtie do
describe '.railtie' do
subject { test_app.deprecators[:grape] }
let(:test_app) do
# https://github.com/rails/rails/issues/51784
# same error as described if not redefining the following
ActiveSupport:... | ruby | MIT | 17fb0cf64296e9c9c968ea7b62f7614538070be4 | 2026-01-04T15:38:22.454413Z | false |
ruby-grape/grape | https://github.com/ruby-grape/grape/blob/17fb0cf64296e9c9c968ea7b62f7614538070be4/spec/integration/multi_json/json_spec.rb | spec/integration/multi_json/json_spec.rb | # frozen_string_literal: true
# grape_entity depends on multi-json and it breaks the test.
describe Grape::Json, if: defined?(MultiJson) && !defined?(Grape::Entity) do
subject { described_class }
it { is_expected.to eq(MultiJson) }
end
| ruby | MIT | 17fb0cf64296e9c9c968ea7b62f7614538070be4 | 2026-01-04T15:38:22.454413Z | false |
ruby-grape/grape | https://github.com/ruby-grape/grape/blob/17fb0cf64296e9c9c968ea7b62f7614538070be4/spec/integration/grape_entity/entity_spec.rb | spec/integration/grape_entity/entity_spec.rb | # frozen_string_literal: true
require 'rack/contrib/jsonp'
describe 'Grape::Entity', if: defined?(Grape::Entity) do
describe '#present' do
subject { Class.new(Grape::API) }
let(:app) { subject }
before do
stub_const('TestObject', Class.new)
stub_const('FakeCollection', Class.new do
... | ruby | MIT | 17fb0cf64296e9c9c968ea7b62f7614538070be4 | 2026-01-04T15:38:22.454413Z | false |
ruby-grape/grape | https://github.com/ruby-grape/grape/blob/17fb0cf64296e9c9c968ea7b62f7614538070be4/spec/integration/hashie/hashie_spec.rb | spec/integration/hashie/hashie_spec.rb | # frozen_string_literal: true
describe 'Hashie', if: defined?(Hashie) do
subject { app }
let(:app) { Class.new(Grape::API) }
describe 'Grape::ParamsBuilder::HashieMash' do
describe 'in an endpoint' do
describe '#params' do
before do
subject.params do
build_with :hashie_m... | ruby | MIT | 17fb0cf64296e9c9c968ea7b62f7614538070be4 | 2026-01-04T15:38:22.454413Z | false |
ruby-grape/grape | https://github.com/ruby-grape/grape/blob/17fb0cf64296e9c9c968ea7b62f7614538070be4/spec/integration/multi_xml/xml_spec.rb | spec/integration/multi_xml/xml_spec.rb | # frozen_string_literal: true
describe Grape::Xml, if: defined?(MultiXml) do
subject { described_class }
it { is_expected.to eq(MultiXml) }
end
| ruby | MIT | 17fb0cf64296e9c9c968ea7b62f7614538070be4 | 2026-01-04T15:38:22.454413Z | false |
ruby-grape/grape | https://github.com/ruby-grape/grape/blob/17fb0cf64296e9c9c968ea7b62f7614538070be4/spec/grape/endpoint_spec.rb | spec/grape/endpoint_spec.rb | # frozen_string_literal: true
describe Grape::Endpoint do
subject { Class.new(Grape::API) }
def app
subject
end
describe '.before_each' do
after { described_class.before_each.clear }
it 'is settable via block' do
block = ->(_endpoint) { 'noop' }
described_class.before_each(&block)
... | ruby | MIT | 17fb0cf64296e9c9c968ea7b62f7614538070be4 | 2026-01-04T15:38:22.454413Z | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.