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/warning.rb | lib/rubocop/warning.rb | # frozen_string_literal: true
module RuboCop
# A Warning exception is different from an Offense with severity 'warning'
# When a Warning is raised, this means that RuboCop was unable to perform a
# requested operation (such as inspecting or correcting a source file) due to
# user error
# For example, a confi... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/plugin.rb | lib/rubocop/plugin.rb | # frozen_string_literal: true
require_relative 'plugin/configuration_integrator'
require_relative 'plugin/loader'
module RuboCop
# Provides a plugin for RuboCop extensions that conform to lint_roller.
# https://github.com/standardrb/lint_roller
# @api private
module Plugin
BUILTIN_INTERNAL_PLUGINS = {
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/ast_aliases.rb | lib/rubocop/ast_aliases.rb | # frozen_string_literal: true
# These aliases are for compatibility.
module RuboCop
NodePattern = AST::NodePattern
ProcessedSource = AST::ProcessedSource
Token = AST::Token
end
| ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cache_config.rb | lib/rubocop/cache_config.rb | # frozen_string_literal: true
module RuboCop
# This class represents the cache config of the caching RuboCop runs.
# @api private
class CacheConfig
def self.root_dir
root = ENV.fetch('RUBOCOP_CACHE_ROOT', nil)
root ||= yield
root ||= if ENV.key?('XDG_CACHE_HOME')
# Include ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/name_similarity.rb | lib/rubocop/name_similarity.rb | # frozen_string_literal: true
module RuboCop
# Common functionality for finding names that are similar to a given name.
# @api private
module NameSimilarity
module_function
def find_similar_name(target_name, names)
similar_names = find_similar_names(target_name, names)
similar_names.first
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/comment_config.rb | lib/rubocop/comment_config.rb | # frozen_string_literal: true
module RuboCop
# This class parses the special `rubocop:disable` comments in a source
# and provides a way to check if each cop is enabled at arbitrary line.
class CommentConfig
extend SimpleForwardable
CONFIG_DISABLED_LINE_RANGE_MIN = -Float::INFINITY
# This class pro... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/rake_task.rb | lib/rubocop/rake_task.rb | # frozen_string_literal: true
require 'rake'
require 'rake/tasklib'
module RuboCop
# Provides a custom rake task.
#
# require 'rubocop/rake_task'
# RuboCop::RakeTask.new
#
# Use global Rake namespace here to avoid namespace issues with custom
# rubocop-rake tasks
class RakeTask < ::Rake::TaskLib
a... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/yaml_duplication_checker.rb | lib/rubocop/yaml_duplication_checker.rb | # frozen_string_literal: true
module RuboCop
# Find duplicated keys from YAML.
# @api private
module YAMLDuplicationChecker
def self.check(yaml_string, filename, &on_duplicated)
handler = DuplicationCheckHandler.new(&on_duplicated)
parser = Psych::Parser.new(handler)
parser.parse(yaml_strin... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/config_store.rb | lib/rubocop/config_store.rb | # frozen_string_literal: true
module RuboCop
# Handles caching of configurations and association of inspected
# ruby files to configurations.
class ConfigStore
attr_reader :validated
alias validated? validated
def initialize
# @options_config stores a config that is specified in the command li... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/runner.rb | lib/rubocop/runner.rb | # frozen_string_literal: true
require 'parallel'
module RuboCop
# This class handles the processing of files, which includes dealing with
# formatters and letting cops inspect the files.
class Runner # rubocop:disable Metrics/ClassLength
# An exception indicating that the inspection loop got stuck correctin... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/magic_comment.rb | lib/rubocop/magic_comment.rb | # frozen_string_literal: true
module RuboCop
# Parse different formats of magic comments.
#
# @abstract parent of three different magic comment handlers
class MagicComment
# IRB's pattern for matching magic comment tokens.
# @see https://github.com/ruby/ruby/blob/b4a55c1/lib/irb/magic-file.rb#L5
TO... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/string_interpreter.rb | lib/rubocop/string_interpreter.rb | # frozen_string_literal: true
module RuboCop
# Take a string with embedded escapes, and convert the escapes as the Ruby
# interpreter would when reading a double-quoted string literal.
# For example, "\\n" will be converted to "\n".
class StringInterpreter
STRING_ESCAPES = {
'\a' => "\a", '\b' => "\b... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/target_ruby.rb | lib/rubocop/target_ruby.rb | # frozen_string_literal: true
module RuboCop
# The kind of Ruby that code inspected by RuboCop is written in.
# @api private
class TargetRuby
KNOWN_RUBIES = [
2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 3.0, 3.1, 3.2, 3.3, 3.4, 4.0, 4.1
].freeze
DEFAULT_VERSION = 2.7
OBSOLETE_RUBIES = {
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cli.rb | lib/rubocop/cli.rb | # frozen_string_literal: true
require 'fileutils'
module RuboCop
# The CLI is a class responsible of handling all the command line interface
# logic.
class CLI
STATUS_SUCCESS = 0
STATUS_OFFENSES = 1
STATUS_ERROR = 2
STATUS_INTERRUPTED = Signal.list['INT'] + 128
DEFAULT_PARALLEL_... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/file_patterns.rb | lib/rubocop/file_patterns.rb | # frozen_string_literal: true
module RuboCop
# A wrapper around patterns array to perform optimized search.
#
# For projects with a large set of rubocop todo files, most items in `Exclude`/`Include`
# are exact file names. It is wasteful to linearly check the list of patterns over and over
# to check if the ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/directive_comment.rb | lib/rubocop/directive_comment.rb | # frozen_string_literal: true
module RuboCop
# This class wraps the `Parser::Source::Comment` object that represents a
# special `rubocop:disable` and `rubocop:enable` comment and exposes what
# cops it contains.
class DirectiveComment
# @api private
LINT_DEPARTMENT = 'Lint'
# @api private
LINT... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cached_data.rb | lib/rubocop/cached_data.rb | # frozen_string_literal: true
require 'json'
module RuboCop
# Converts RuboCop objects to and from the serialization format JSON.
# @api private
class CachedData
def initialize(filename)
@filename = filename
end
def from_json(text)
deserialize_offenses(JSON.parse(text))
end
def... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/config.rb | lib/rubocop/config.rb | # frozen_string_literal: true
# FIXME: Moving Rails department code to RuboCop Rails will remove
# the following rubocop:disable comment.
# rubocop:disable Metrics/ClassLength
module RuboCop
# This class represents the configuration of the RuboCop application
# and all its cops. A Config is associated with a YAML ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/server.rb | lib/rubocop/server.rb | # frozen_string_literal: true
require_relative 'platform'
#
# 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
# The bootstrap module for server.
# @api ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/arguments_file.rb | lib/rubocop/arguments_file.rb | # frozen_string_literal: true
module RuboCop
# This is a class that reads optional command line arguments to rubocop from .rubocop file.
# @api private
class ArgumentsFile
def self.read_as_arguments
if File.exist?('.rubocop') && !File.directory?('.rubocop')
require 'shellwords'
File.re... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/config_finder.rb | lib/rubocop/config_finder.rb | # frozen_string_literal: true
require_relative 'file_finder'
module RuboCop
# This class has methods related to finding configuration path.
# @api private
class ConfigFinder
DOTFILE = '.rubocop.yml'
XDG_CONFIG = 'config.yml'
RUBOCOP_HOME = File.realpath(File.join(File.dirname(__FILE__), '..', '..'))... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/formatter.rb | lib/rubocop/formatter.rb | # frozen_string_literal: true
module RuboCop
# The bootstrap module for formatter.
module Formatter
require_relative 'formatter/text_util'
require_relative 'formatter/base_formatter'
require_relative 'formatter/simple_text_formatter'
# relies on simple text
require_relative 'formatter/clang_s... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/result_cache.rb | lib/rubocop/result_cache.rb | # frozen_string_literal: true
require 'digest/sha1'
require 'find'
require 'zlib'
require_relative 'cache_config'
module RuboCop
# Provides functionality for caching RuboCop runs.
# @api private
class ResultCache
NON_CHANGING = %i[color format formatters out debug display_time fail_level
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/target_finder.rb | lib/rubocop/target_finder.rb | # frozen_string_literal: true
module RuboCop
# This class finds target files to inspect by scanning the directory tree and picking ruby files.
# @api private
class TargetFinder
HIDDEN_PATH_SUBSTRING = "#{File::SEPARATOR}."
def initialize(config_store, 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/cops_documentation_generator.rb | lib/rubocop/cops_documentation_generator.rb | # frozen_string_literal: true
require 'fileutils'
require 'yard'
# Class for generating documentation of all cops departments
# @api private
class CopsDocumentationGenerator # rubocop:disable Metrics/ClassLength
include ::RuboCop::Cop::Documentation
CopData = Struct.new(
:cop, :description, :example_objects,... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/error.rb | lib/rubocop/error.rb | # frozen_string_literal: true
module RuboCop
# An Error exception is different from an Offense with severity 'error'
# When this exception is raised, it means that RuboCop is unable to perform
# a requested action (probably due to misconfiguration) and must stop
# immediately, rather than carrying on
class E... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/util.rb | lib/rubocop/util.rb | # frozen_string_literal: true
module RuboCop
# This module contains a collection of useful utility methods.
module Util
def self.silence_warnings
# Replaces Kernel::silence_warnings since it hides any warnings,
# including the RuboCop ones
old_verbose = $VERBOSE
$VERBOSE = nil
yie... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/rspec/shared_contexts.rb | lib/rubocop/rspec/shared_contexts.rb | # frozen_string_literal: true
require 'tmpdir'
RSpec.shared_context 'isolated environment' do # rubocop:disable Metrics/BlockLength
around do |example|
Dir.mktmpdir do |tmpdir|
original_home = Dir.home
original_xdg_config_home = ENV.fetch('XDG_CONFIG_HOME', nil)
# Make sure to expand all syml... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/rspec/cop_helper.rb | lib/rubocop/rspec/cop_helper.rb | # frozen_string_literal: true
require 'tempfile'
# This module provides methods that make it easier to test Cops.
module CopHelper
extend RSpec::SharedContext
let(:ruby_version) do
# The minimum version Prism can parse is 3.3.
ENV['PARSER_ENGINE'] == 'parser_prism' ? 3.3 : RuboCop::TargetRuby::DEFAULT_VE... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/rspec/parallel_formatter.rb | lib/rubocop/rspec/parallel_formatter.rb | # frozen_string_literal: true
RSpec::Support.require_rspec_core 'formatters/base_text_formatter'
RSpec::Support.require_rspec_core 'formatters/console_codes'
module RuboCop
module RSpec
# RSpec formatter for use with running `rake spec` in parallel. This formatter
# removes much of the noise from RSpec so t... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/rspec/expect_offense.rb | lib/rubocop/rspec/expect_offense.rb | # frozen_string_literal: true
module RuboCop
module RSpec
# Mixin for `expect_offense` and `expect_no_offenses`
#
# This mixin makes it easier to specify strict offense expectations
# in a declarative and visual fashion. Just type out the code that
# should generate an offense, annotate code by w... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/rspec/support.rb | lib/rubocop/rspec/support.rb | # frozen_string_literal: true
# Require this file to load code that supports testing using RSpec.
require_relative 'cop_helper'
require_relative 'expect_offense'
require_relative 'parallel_formatter'
require_relative 'shared_contexts'
RSpec.configure do |config|
config.include CopHelper
config.include RuboCop::R... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/plugin/load_error.rb | lib/rubocop/plugin/load_error.rb | # frozen_string_literal: true
module RuboCop
module Plugin
# An exception raised when a plugin fails to load.
# @api private
class LoadError < Error
def initialize(plugin_name)
super
@plugin_name = plugin_name
end
def message
<<~MESSAGE
Failed to load... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/plugin/loader.rb | lib/rubocop/plugin/loader.rb | # frozen_string_literal: true
require_relative '../feature_loader'
require_relative 'load_error'
module RuboCop
module Plugin
# A class for loading and resolving plugins.
# @api private
class Loader
# rubocop:disable Layout/LineLength
DEFAULT_PLUGIN_CONFIG = {
'enabled' => true,
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/plugin/not_supported_error.rb | lib/rubocop/plugin/not_supported_error.rb | # frozen_string_literal: true
module RuboCop
module Plugin
# An exception raised when a plugin is not supported by the RuboCop engine.
# @api private
class NotSupportedError < Error
def initialize(unsupported_plugins)
super
@unsupported_plugins = unsupported_plugins
end
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/plugin/configuration_integrator.rb | lib/rubocop/plugin/configuration_integrator.rb | # frozen_string_literal: true
require 'lint_roller/context'
require_relative 'not_supported_error'
module RuboCop
module Plugin
# A class for integrating plugin configurations into RuboCop.
# Handles configuration merging, validation, and compatibility for plugins.
# @api private
class Configuration... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/lsp/stdin_runner.rb | lib/rubocop/lsp/stdin_runner.rb | # frozen_string_literal: true
#
# This code is based on https://github.com/standardrb/standard.
#
# Copyright (c) 2023 Test Double, Inc.
#
# The MIT License (MIT)
#
# https://github.com/standardrb/standard/blob/main/LICENSE.txt
#
module RuboCop
module Lsp
# Originally lifted from:
# https://github.com/Shopif... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/lsp/severity.rb | lib/rubocop/lsp/severity.rb | # frozen_string_literal: true
module RuboCop
module LSP
# Severity for Language Server Protocol of RuboCop.
# @api private
class Severity
SEVERITIES = {
fatal: LanguageServer::Protocol::Constant::DiagnosticSeverity::ERROR,
error: LanguageServer::Protocol::Constant::DiagnosticSeverit... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/lsp/logger.rb | lib/rubocop/lsp/logger.rb | # frozen_string_literal: true
#
# This code is based on https://github.com/standardrb/standard.
#
# Copyright (c) 2023 Test Double, Inc.
#
# The MIT License (MIT)
#
# https://github.com/standardrb/standard/blob/main/LICENSE.txt
#
module RuboCop
module LSP
# Log for Language Server Protocol of RuboCop.
# @api... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/lsp/routes.rb | lib/rubocop/lsp/routes.rb | # frozen_string_literal: true
require_relative 'severity'
#
# This code is based on https://github.com/standardrb/standard.
#
# Copyright (c) 2023 Test Double, Inc.
#
# The MIT License (MIT)
#
# https://github.com/standardrb/standard/blob/main/LICENSE.txt
#
module RuboCop
module LSP
# Routes for Language Server... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/lsp/diagnostic.rb | lib/rubocop/lsp/diagnostic.rb | # frozen_string_literal: true
require_relative 'severity'
#
# This code is based on https://github.com/standardrb/standard.
#
# Copyright (c) 2023 Test Double, Inc.
#
# The MIT License (MIT)
#
# https://github.com/standardrb/standard/blob/main/LICENSE.txt
#
module RuboCop
module LSP
# Diagnostic for Language Se... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/lsp/runtime.rb | lib/rubocop/lsp/runtime.rb | # frozen_string_literal: true
require_relative 'diagnostic'
require_relative 'stdin_runner'
#
# This code is based on https://github.com/standardrb/standard.
#
# Copyright (c) 2023 Test Double, Inc.
#
# The MIT License (MIT)
#
# https://github.com/standardrb/standard/blob/main/LICENSE.txt
#
module RuboCop
module LS... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/lsp/server.rb | lib/rubocop/lsp/server.rb | # frozen_string_literal: true
require 'language_server-protocol'
require_relative 'logger'
require_relative 'routes'
require_relative 'runtime'
#
# This code is based on https://github.com/standardrb/standard.
#
# Copyright (c) 2023 Test Double, Inc.
#
# The MIT License (MIT)
#
# https://github.com/standardrb/standar... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/formatter/file_list_formatter.rb | lib/rubocop/formatter/file_list_formatter.rb | # frozen_string_literal: true
module RuboCop
module Formatter
# This formatter displays just a list of the files with offenses in them,
# separated by newlines. The output is machine-parsable.
#
# Here's the format:
#
# /some/file
# /some/other/file
class FileListFormatter < BaseForma... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/formatter/json_formatter.rb | lib/rubocop/formatter/json_formatter.rb | # frozen_string_literal: true
require 'json'
module RuboCop
module Formatter
# This formatter formats the report data in JSON format.
class JSONFormatter < BaseFormatter
include PathUtil
attr_reader :output_hash
def initialize(output, options = {})
super
@output_hash = { ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/formatter/text_util.rb | lib/rubocop/formatter/text_util.rb | # frozen_string_literal: true
module RuboCop
module Formatter
# Common logic for UI texts.
module TextUtil
module_function
def pluralize(number, thing, options = {})
if number.zero? && options[:no_for_zero]
"no #{thing}s"
elsif number == 1
"1 #{thing}"
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/formatter/fuubar_style_formatter.rb | lib/rubocop/formatter/fuubar_style_formatter.rb | # frozen_string_literal: true
require 'ruby-progressbar'
module RuboCop
module Formatter
# This formatter displays a progress bar and shows details of offenses as
# soon as they are detected.
# This is inspired by the Fuubar formatter for RSpec by Jeff Kreeftmeijer.
# https://github.com/jeffkreeftme... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/formatter/clang_style_formatter.rb | lib/rubocop/formatter/clang_style_formatter.rb | # frozen_string_literal: true
module RuboCop
module Formatter
# This formatter formats report data in clang style.
# The precise location of the problem is shown together with the
# relevant source code.
class ClangStyleFormatter < SimpleTextFormatter
ELLIPSES = '...'
def report_file(fil... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/formatter/formatter_set.rb | lib/rubocop/formatter/formatter_set.rb | # frozen_string_literal: true
require 'fileutils'
module RuboCop
module Formatter
# This is a collection of formatters. A FormatterSet can hold multiple
# formatter instances and provides transparent formatter API methods
# which invoke same method of each formatters.
class FormatterSet < Array
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/formatter/emacs_style_formatter.rb | lib/rubocop/formatter/emacs_style_formatter.rb | # frozen_string_literal: true
module RuboCop
module Formatter
# This formatter displays the report data in format that's
# easy to process in the Emacs text editor.
# The output is machine-parsable.
class EmacsStyleFormatter < BaseFormatter
def file_finished(file, offenses)
offenses.eac... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/formatter/worst_offenders_formatter.rb | lib/rubocop/formatter/worst_offenders_formatter.rb | # frozen_string_literal: true
require 'pathname'
module RuboCop
module Formatter
# This formatter displays the list of offensive files, sorted by number of
# offenses with the worst offenders first.
#
# Here's the format:
#
# 26 this/file/is/really/bad.rb
# 3 just/ok.rb
# --
#... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/formatter/html_formatter.rb | lib/rubocop/formatter/html_formatter.rb | # frozen_string_literal: true
require 'cgi/escape'
require 'erb'
module RuboCop
module Formatter
# This formatter saves the output as an html file.
class HTMLFormatter < BaseFormatter
ELLIPSES = '<span class="extra-code">...</span>'
TEMPLATE_PATH = File.expand_path('../../../assets/output.html.e... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/formatter/colorizable.rb | lib/rubocop/formatter/colorizable.rb | # frozen_string_literal: true
module RuboCop
module Formatter
# This mix-in module provides string coloring methods for terminals.
# It automatically disables coloring if coloring is disabled in the process
# globally or the formatter's output is not a terminal.
module Colorizable
def rainbow
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/formatter/auto_gen_config_formatter.rb | lib/rubocop/formatter/auto_gen_config_formatter.rb | # frozen_string_literal: true
module RuboCop
module Formatter
# Does not show individual offenses in the console.
class AutoGenConfigFormatter < ProgressFormatter
def finished(inspected_files)
output.puts
report_summary(inspected_files.size,
@total_offense_count,... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/formatter/quiet_formatter.rb | lib/rubocop/formatter/quiet_formatter.rb | # frozen_string_literal: true
module RuboCop
module Formatter
# If no offenses are found, no output is displayed.
# Otherwise, SimpleTextFormatter's output is displayed.
class QuietFormatter < SimpleTextFormatter
def report_summary(file_count, offense_count, correction_count, correctable_count)
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/formatter/markdown_formatter.rb | lib/rubocop/formatter/markdown_formatter.rb | # frozen_string_literal: true
module RuboCop
module Formatter
# This formatter displays the report data in markdown
class MarkdownFormatter < BaseFormatter
include TextUtil
include PathUtil
attr_reader :files, :summary
def initialize(output, options = {})
super
@file... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/formatter/base_formatter.rb | lib/rubocop/formatter/base_formatter.rb | # frozen_string_literal: true
module RuboCop
module Formatter
# Abstract base class for formatter, implements all public API methods.
#
# ## Creating Custom Formatter
#
# You can create a custom formatter by subclassing
# `RuboCop::Formatter::BaseFormatter` and overriding some methods
# o... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/formatter/github_actions_formatter.rb | lib/rubocop/formatter/github_actions_formatter.rb | # frozen_string_literal: true
module RuboCop
module Formatter
# This formatter formats report data as GitHub Workflow commands resulting
# in GitHub check annotations when run within GitHub Actions.
class GitHubActionsFormatter < BaseFormatter
ESCAPE_MAP = { '%' => '%25', "\n" => '%0A', "\r" => '%0... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/formatter/junit_formatter.rb | lib/rubocop/formatter/junit_formatter.rb | # frozen_string_literal: true
#
# This code is based on https://github.com/mikian/rubocop-junit-formatter.
#
# Copyright (c) 2015 Mikko Kokkonen
#
# MIT License
#
# https://github.com/mikian/rubocop-junit-formatter/blob/master/LICENSE.txt
#
module RuboCop
module Formatter
# This formatter formats the report data... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/formatter/progress_formatter.rb | lib/rubocop/formatter/progress_formatter.rb | # frozen_string_literal: true
module RuboCop
module Formatter
# This formatter display dots for files with no offenses and
# letters for files with problems in the them. In the end it
# appends the regular report data in the clang style format.
class ProgressFormatter < ClangStyleFormatter
incl... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/formatter/pacman_formatter.rb | lib/rubocop/formatter/pacman_formatter.rb | # frozen_string_literal: true
module RuboCop
module Formatter
# This formatter prints a PACDOT per every file to be analyzed.
# Pacman will "eat" one PACDOT per file when no offense is detected.
# Otherwise it will print a Ghost.
# This is inspired by the Pacman formatter for RSpec by Carlos Rojas.
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/formatter/offense_count_formatter.rb | lib/rubocop/formatter/offense_count_formatter.rb | # frozen_string_literal: true
require 'ruby-progressbar'
module RuboCop
module Formatter
# This formatter displays the list of offended cops with a count of how
# many offenses of their kind were found. Ordered by desc offense count
#
# Here's the format:
#
# 26 LineLength
# 3 OneLine... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/formatter/simple_text_formatter.rb | lib/rubocop/formatter/simple_text_formatter.rb | # frozen_string_literal: true
require_relative 'colorizable'
module RuboCop
module Formatter
# A basic formatter that displays only files with offenses.
# Offenses are displayed at compact form - just the
# location of the problem and the associated message.
class SimpleTextFormatter < BaseFormatter... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/formatter/tap_formatter.rb | lib/rubocop/formatter/tap_formatter.rb | # frozen_string_literal: true
module RuboCop
module Formatter
# This formatter formats report data using the Test Anything Protocol.
# TAP allows for to communicate tests results in a language agnostics way.
class TapFormatter < ClangStyleFormatter
def started(target_files)
super
@p... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/formatter/disabled_config_formatter.rb | lib/rubocop/formatter/disabled_config_formatter.rb | # frozen_string_literal: true
module RuboCop
module Formatter
# This formatter displays a YAML configuration file where all cops that
# detected any offenses are configured to not detect the offense.
class DisabledConfigFormatter < BaseFormatter # rubocop:disable Metrics/ClassLength
include PathUti... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/config_obsoletion/renamed_cop.rb | lib/rubocop/config_obsoletion/renamed_cop.rb | # frozen_string_literal: true
module RuboCop
class ConfigObsoletion
# Encapsulation of a ConfigObsoletion rule for renaming
# a cop or moving it to a new department.
# @api private
class RenamedCop < CopRule
attr_reader :new_name, :metadata
def initialize(config, old_name, name_or_hash)
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/config_obsoletion/parameter_rule.rb | lib/rubocop/config_obsoletion/parameter_rule.rb | # frozen_string_literal: true
module RuboCop
class ConfigObsoletion
# Base class for ConfigObsoletion rules relating to parameters
# @api private
class ParameterRule < Rule
attr_reader :cop, :parameter, :metadata
def initialize(config, cop, parameter, metadata)
super(config)
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/config_obsoletion/split_cop.rb | lib/rubocop/config_obsoletion/split_cop.rb | # frozen_string_literal: true
module RuboCop
class ConfigObsoletion
# Encapsulation of a ConfigObsoletion rule for splitting a cop's
# functionality into multiple new cops.
# @api private
class SplitCop < CopRule
attr_reader :metadata
def initialize(config, old_name, metadata)
su... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/config_obsoletion/changed_enforced_styles.rb | lib/rubocop/config_obsoletion/changed_enforced_styles.rb | # frozen_string_literal: true
module RuboCop
class ConfigObsoletion
# Encapsulation of a ConfigObsoletion rule for changing a parameter
# @api private
class ChangedEnforcedStyles < ParameterRule
BASE_MESSAGE = 'obsolete `%<parameter>s: %<value>s` (for `%<cop>s`) found in %<path>s'
def violat... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/config_obsoletion/changed_parameter.rb | lib/rubocop/config_obsoletion/changed_parameter.rb | # frozen_string_literal: true
module RuboCop
class ConfigObsoletion
# Encapsulation of a ConfigObsoletion rule for changing a parameter
# @api private
class ChangedParameter < ParameterRule
BASE_MESSAGE = 'obsolete parameter `%<parameter>s` (for `%<cop>s`) found in %<path>s'
def message
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/config_obsoletion/rule.rb | lib/rubocop/config_obsoletion/rule.rb | # frozen_string_literal: true
module RuboCop
class ConfigObsoletion
# Abstract base class for ConfigObsoletion rules
# @api private
class Rule
def initialize(config)
@config = config
end
# Does this rule relate to cops?
def cop_rule?
false
end
# Does ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/config_obsoletion/extracted_cop.rb | lib/rubocop/config_obsoletion/extracted_cop.rb | # frozen_string_literal: true
module RuboCop
class ConfigObsoletion
# Encapsulation of a ConfigObsoletion rule for splitting a cop's
# functionality into multiple new cops.
# @api private
class ExtractedCop < CopRule
attr_reader :gem, :department
def initialize(config, old_name, gem)
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/config_obsoletion/cop_rule.rb | lib/rubocop/config_obsoletion/cop_rule.rb | # frozen_string_literal: true
module RuboCop
class ConfigObsoletion
# Base class for ConfigObsoletion rules relating to cops
# @api private
class CopRule < Rule
attr_reader :old_name
def initialize(config, old_name)
super(config)
@old_name = old_name
end
def cop_... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/config_obsoletion/removed_cop.rb | lib/rubocop/config_obsoletion/removed_cop.rb | # frozen_string_literal: true
module RuboCop
class ConfigObsoletion
# Encapsulation of a ConfigObsoletion rule for removing
# a previously defined cop.
# @api private
class RemovedCop < CopRule
attr_reader :old_name, :metadata
BASE_MESSAGE = 'The `%<old_name>s` cop has been removed'
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/core_ext/string.rb | lib/rubocop/core_ext/string.rb | # frozen_string_literal: true
# Extensions to the core String class
class String
unless method_defined?(:blank?) && ' '.blank?
# Checks whether a string is blank. A string is considered blank if it
# is either empty or contains only whitespace characters.
#
# @return [Boolean] true is the string is b... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/ext/regexp_node.rb | lib/rubocop/ext/regexp_node.rb | # frozen_string_literal: true
module RuboCop
module Ext
# Extensions to AST::RegexpNode for our cached parsed regexp info
module RegexpNode
ANY = Object.new
def ANY.==(_)
true
end
private_constant :ANY
# @return [Regexp::Expression::Root, nil]
# Note: we extend Re... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/ext/range.rb | lib/rubocop/ext/range.rb | # frozen_string_literal: true
module RuboCop
module Ext
# Extensions to Parser::Source::Range
module Range
# Adds `Range#single_line?` to parallel `Node#single_line?`
def single_line?
first_line == last_line
end
end
end
end
Parser::Source::Range.include RuboCop::Ext::Range
| ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/ext/regexp_parser.rb | lib/rubocop/ext/regexp_parser.rb | # frozen_string_literal: true
module RuboCop
module Ext
# Extensions for `regexp_parser` gem
module RegexpParser
# Source map for RegexpParser nodes
class Map < ::Parser::Source::Map
attr_reader :body, :quantifier, :begin, :end
def initialize(expression, body:, quantifier: nil, b... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/ext/processed_source.rb | lib/rubocop/ext/processed_source.rb | # frozen_string_literal: true
module RuboCop
module Ext
# Extensions to AST::ProcessedSource for our cached comment_config
module ProcessedSource
attr_accessor :registry, :config
def comment_config
@comment_config ||= CommentConfig.new(self)
end
def disabled_line_ranges
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/ext/comment.rb | lib/rubocop/ext/comment.rb | # frozen_string_literal: true
module RuboCop
module Ext
# Extensions to `Parser::Source::Comment`.
module Comment
def source
loc.expression.source
end
def source_range
loc.expression
end
end
end
end
Parser::Source::Comment.include RuboCop::Ext::Comment
| ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/severity.rb | lib/rubocop/cop/severity.rb | # frozen_string_literal: true
module RuboCop
module Cop
# Severity class is simple value object about severity
class Severity
include Comparable
NAMES = %i[info refactor convention warning error fatal].freeze
# @api private
CODE_TABLE = { I: :info, R: :refactor, C: :convention,
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/cop.rb | lib/rubocop/cop/cop.rb | # frozen_string_literal: true
require 'uri'
require_relative 'legacy/corrections_proxy'
module RuboCop
module Cop
# @deprecated Use Cop::Base instead
# Legacy scaffold for Cops.
# See https://docs.rubocop.org/rubocop/v1_upgrade_notes.html
class Cop < Base
attr_reader :offenses
exclude_f... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/corrector.rb | lib/rubocop/cop/corrector.rb | # frozen_string_literal: true
module RuboCop
module Cop
# This class takes a source buffer and rewrite its source
# based on the different correction rules supplied.
#
# Important!
# The nodes modified by the corrections should be part of the
# AST of the source_buffer.
class Corrector < ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/variable_force.rb | lib/rubocop/cop/variable_force.rb | # frozen_string_literal: true
module RuboCop
module Cop
# This force provides a way to track local variables and scopes of Ruby.
# Cops interact with this force need to override some of the hook methods.
#
# def before_entering_scope(scope, variable_table)
# end
#
# def after_... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/force.rb | lib/rubocop/cop/force.rb | # frozen_string_literal: true
module RuboCop
module Cop
# A scaffold for concrete forces.
class Force
# @api private
class HookError < StandardError
attr_reader :joining_cop
def initialize(joining_cop)
super
@joining_cop = joining_cop
end
end
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/autocorrect_logic.rb | lib/rubocop/cop/autocorrect_logic.rb | # frozen_string_literal: true
module RuboCop
module Cop
# This module encapsulates the logic for autocorrect behavior for a cop.
module AutocorrectLogic
def autocorrect?
autocorrect_requested? && correctable? && autocorrect_enabled?
end
def autocorrect_with_disable_uncorrectable?
... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/offense.rb | lib/rubocop/cop/offense.rb | # frozen_string_literal: true
module RuboCop
module Cop
# An offense represents a style violation detected by RuboCop.
class Offense
include Comparable
# @api private
COMPARISON_ATTRIBUTES = %i[line column cop_name message severity].freeze
# @api public
#
# @!attribute [... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/message_annotator.rb | lib/rubocop/cop/message_annotator.rb | # frozen_string_literal: true
module RuboCop
module Cop
# Message Annotator class annotates a basic offense message
# based on params passed into initializer.
#
# @see #initialize
#
# @example
# RuboCop::Cop::MessageAnnotator.new(
# config, cop_name, cop_config, @options
# ... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/ignored_node.rb | lib/rubocop/cop/ignored_node.rb | # frozen_string_literal: true
module RuboCop
module Cop
# Handles adding and checking ignored nodes.
module IgnoredNode
def ignore_node(node)
ignored_nodes << node
end
def part_of_ignored_node?(node)
ignored_nodes.map(&:loc).any? do |ignored_loc|
next false if ign... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/documentation.rb | lib/rubocop/cop/documentation.rb | # frozen_string_literal: true
module RuboCop
module Cop
# Helpers for builtin documentation
module Documentation
module_function
# @api private
def department_to_basename(department)
"cops_#{department.to_s.downcase.tr('/', '_')}"
end
# @api private
def url_for(c... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/registry.rb | lib/rubocop/cop/registry.rb | # frozen_string_literal: true
module RuboCop
module Cop
# Error raised when an unqualified cop name is used that could
# refer to two or more cops under different departments
class AmbiguousCopName < RuboCop::Error
MSG = 'Ambiguous cop name `%<name>s` used in %<origin>s needs ' \
'depar... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/exclude_limit.rb | lib/rubocop/cop/exclude_limit.rb | # frozen_string_literal: true
module RuboCop
# Allows specified configuration options to have an exclude limit
# ie. a maximum value tracked that it can be used by `--auto-gen-config`.
module ExcludeLimit
# Sets up a configuration option to have an exclude limit tracked.
# The parameter name given is tra... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/badge.rb | lib/rubocop/cop/badge.rb | # frozen_string_literal: true
module RuboCop
module Cop
# Identifier of all cops containing a department and cop name.
#
# All cops are identified by their badge. For example, the badge for
# `RuboCop::Cop::Layout::IndentationStyle` is `Layout/IndentationStyle`.
# Badges can be parsed as either `... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/base.rb | lib/rubocop/cop/base.rb | # frozen_string_literal: true
module RuboCop
module Cop
# A scaffold for concrete cops.
#
# The Cop::Base class is meant to be extended.
#
# Cops track offenses and can autocorrect them on the fly.
#
# A commissioner object is responsible for traversing the AST and invoking
# the spec... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/internal_affairs.rb | lib/rubocop/cop/internal_affairs.rb | # frozen_string_literal: true
require_relative 'internal_affairs/cop_description'
require_relative 'internal_affairs/cop_enabled'
require_relative 'internal_affairs/create_empty_file'
require_relative 'internal_affairs/empty_line_between_expect_offense_and_correction'
require_relative 'internal_affairs/example_descrip... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/generator.rb | lib/rubocop/cop/generator.rb | # frozen_string_literal: true
module RuboCop
module Cop
# Source and spec generator for new cops
#
# This generator will take a cop name and generate a source file
# and spec file when given a valid qualified cop name.
# @api private
class Generator
SOURCE_TEMPLATE = <<~RUBY
# f... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/commissioner.rb | lib/rubocop/cop/commissioner.rb | # frozen_string_literal: true
module RuboCop
module Cop
# Commissioner class is responsible for processing the AST and delegating
# work to the specified cops.
class Commissioner
include RuboCop::AST::Traversal
RESTRICTED_CALLBACKS = %i[on_send on_csend after_send after_csend].freeze
p... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/team.rb | lib/rubocop/cop/team.rb | # frozen_string_literal: true
module RuboCop
module Cop
# A group of cops, ready to be called on duty to inspect files.
# Team is responsible for selecting only relevant cops to be sent on duty,
# as well as insuring that the needed forces are sent along with them.
#
# For performance reasons, Te... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/util.rb | lib/rubocop/cop/util.rb | # frozen_string_literal: true
module RuboCop
module Cop
# This module contains a collection of useful utility methods.
# rubocop:disable Metrics/ModuleLength
module Util
include PathUtil
# Match literal regex characters, not including anchors, character
# classes, alternatives, groups,... | ruby | MIT | 99fa0fdd0481910d7d052f4c2ed01ad36178f404 | 2026-01-04T15:37:41.211519Z | false |
rubocop/rubocop | https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/lib/rubocop/cop/lint/useless_assignment.rb | lib/rubocop/cop/lint/useless_assignment.rb | # frozen_string_literal: true
module RuboCop
module Cop
module Lint
# Checks for every useless assignment to local variable in every
# scope.
# The basic idea for this cop was from the warning of `ruby -cw`:
#
# [source,console]
# ----
# assigned but unused variable - fo... | 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.