source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/internal_affairs/processed_source_buffer_name.rb
Ruby
mit
12,856
master
1,111
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # Enforces the use of `processed_source.file_path` instead of `processed_source.buffer.name`. # # @example # # # bad # processed_source.buffer.name # # # good # processed_s...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/internal_affairs/node_matcher_directive.rb
Ruby
mit
12,856
master
8,979
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # Checks that node matcher definitions are tagged with a YARD `@!method` # directive so that editors are able to find the dynamically defined # method. # # @example # # bad # def_node_matc...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/internal_affairs/example_heredoc_delimiter.rb
Ruby
mit
12,856
master
3,359
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # Use `RUBY` for heredoc delimiter of example Ruby code. # # Some editors may apply better syntax highlighting by using appropriate language names for # the delimiter. # # @example # # bad ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/internal_affairs/create_empty_file.rb
Ruby
mit
12,856
master
947
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # Checks for uses of `create_file` with empty string second argument. # # @example # # # bad # create_file(path, '') # # # good # create_empty_file(path) # clas...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/internal_affairs/method_name_equal.rb
Ruby
mit
12,856
master
1,244
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # Checks that method names are checked using `method?` method. # # @example # # bad # node.method_name == :do_something # # # good # node.method?(:do_something) # # ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/internal_affairs/inherit_deprecated_cop_class.rb
Ruby
mit
12,856
master
863
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # `RuboCop::Cop::Cop` is deprecated and will be removed in RuboCop 2.0. # Your custom cop class should inherit from `RuboCop::Cop::Base` instead of # `RuboCop::Cop::Cop`. # # See "v1 Upgrade Notes" for mo...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/internal_affairs/useless_message_assertion.rb
Ruby
mit
12,856
master
1,417
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # Checks that cops are not tested using `described_class::MSG`. # # @example # # # bad # expect(cop.messages).to eq([described_class::MSG]) # # # good # expect(cop.messages...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/internal_affairs/redundant_source_range.rb
Ruby
mit
12,856
master
2,814
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # Checks for redundant `source_range`. # # @example # # # bad # node.source_range.source # # # good # node.source # # # bad # add_offense(node.source_...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/internal_affairs/location_exists.rb
Ruby
mit
12,856
master
4,032
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # When a node location may not exist, `Node#loc?` or `Node#loc_is?` # can be used instead of calling `Node#respond_to?` before using # the value. # # @example # # bad # node.loc.respond_to...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/internal_affairs/cop_description.rb
Ruby
mit
12,856
master
3,986
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # Enforces the cop description to start with a word such as verb. # # @example # # bad # # This cop checks .... # class SomeCop < Base # .... # end # # # bad ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/internal_affairs/redundant_described_class_as_subject.rb
Ruby
mit
12,856
master
1,929
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # Checks for redundant `subject(:cop) { described_class.new }`. # # @example # # bad # RSpec.describe RuboCop::Cop::Department::Foo do # subject(:cop) { described_class.new(config) } #...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/internal_affairs/node_first_or_last_argument.rb
Ruby
mit
12,856
master
1,724
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # Checks for the use of `node.arguments.first` or `node.arguments.last` and # suggests the use of `node.first_argument` or `node.last_argument` instead. # # @example # # bad # node.arguments.fir...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/internal_affairs/node_type_multiple_predicates.rb
Ruby
mit
12,856
master
3,943
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # Use `node.type?(:foo, :bar)` instead of `node.foo_type? || node.bar_type?`, # and `!node.type?(:foo, :bar)` instead of `!node.foo_type? && !node.bar_type?`. # # @example # # # bad # node...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/internal_affairs/operator_keyword.rb
Ruby
mit
12,856
master
1,451
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # Enforces the use of `node.operator_keyword?` instead of `node.and_type? || node.or_type?`. # # @example # # bad # node.and_type? || node.or_type? # node.or_type? || node.and_type? # ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/internal_affairs/node_pattern_groups.rb
Ruby
mit
12,856
master
8,625
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # Use node groups (`any_block`, `argument`, `boolean`, `call`, `numeric`, `range`) # in node patterns instead of a union (`{ ... }`) of the member types of the group. # # @example # # bad # def_...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/internal_affairs/redundant_method_dispatch_node.rb
Ruby
mit
12,856
master
1,371
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # Checks for redundant `send_node` method dispatch node. # # @example # # # bad # node.send_node.method_name # # # good # node.method_name # # # bad # ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/internal_affairs/node_type_predicate.rb
Ruby
mit
12,856
master
1,087
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # Checks that node types are checked using the predicate helpers. # # @example # # # bad # node.type == :send # # # good # node.send_type? # class NodeTypePredi...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/internal_affairs/location_expression.rb
Ruby
mit
12,856
master
963
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # Enforces the use of `node.source_range` instead of `node.location.expression`. # # @example # # # bad # node.location.expression # node.loc.expression # # # good # ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/internal_affairs/node_pattern_groups/ast_processor.rb
Ruby
mit
12,856
master
2,549
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs class NodePatternGroups # AST Processor for NodePattern ASTs, for use with `InternalAffairs/NodePatternGroups`. # # Looks for sequences and subsequences where the first item is a `node_type` node, ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cop/internal_affairs/node_pattern_groups/ast_walker.rb
Ruby
mit
12,856
master
5,044
# frozen_string_literal: true module RuboCop module Cop module InternalAffairs # rubocop:disable InternalAffairs/RedundantSourceRange -- node here is a `NodePattern::Node` class NodePatternGroups # Walks an AST that has been processed by `InternalAffairs::NodePatternGroups::Processor` ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/rspec/parallel_formatter.rb
Ruby
mit
12,856
master
3,172
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/rspec/expect_offense.rb
Ruby
mit
12,856
master
12,766
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/rspec/cop_helper.rb
Ruby
mit
12,856
master
3,555
# frozen_string_literal: true require 'tempfile' # This module provides methods that make it easier to test Cops. module CopHelper extend RSpec::SharedContext @integrated_plugins = false class << self attr_accessor :integrated_plugins end let(:ruby_version) do # The minimum version Prism can pars...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/rspec/shared_contexts.rb
Ruby
mit
12,856
master
8,130
# frozen_string_literal: true require 'tmpdir' # Reset cached PathUtil.pwd before each example so that tests using Dir.chdir # or stubbing Dir.pwd get a fresh value. RSpec.configure { |c| c.before { RuboCop::PathUtil.reset_pwd } } RSpec.shared_context 'isolated environment' do # rubocop:disable Metrics/BlockLength ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/rspec/support.rb
Ruby
mit
12,856
master
1,440
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/server/cli.rb
Ruby
mit
12,856
master
4,258
# 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 ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/server/core.rb
Ruby
mit
12,856
master
2,950
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/server/errors.rb
Ruby
mit
12,856
master
485
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/server/cache.rb
Ruby
mit
12,856
master
5,182
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/server/client_command.rb
Ruby
mit
12,856
master
729
# 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 ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/server/helper.rb
Ruby
mit
12,856
master
767
# 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:...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/server/socket_reader.rb
Ruby
mit
12,856
master
1,714
# 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 ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/server/server_command.rb
Ruby
mit
12,856
master
500
# 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 ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/server/server_command/exec.rb
Ruby
mit
12,856
master
1,098
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/server/server_command/base.rb
Ruby
mit
12,856
master
1,041
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/server/server_command/stop.rb
Ruby
mit
12,856
master
484
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/server/client_command/status.rb
Ruby
mit
12,856
master
638
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/server/client_command/base.rb
Ruby
mit
12,856
master
1,354
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/server/client_command/exec.rb
Ruby
mit
12,856
master
1,657
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/server/client_command/start.rb
Ruby
mit
12,856
master
1,405
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/server/client_command/restart.rb
Ruby
mit
12,856
master
533
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/server/client_command/stop.rb
Ruby
mit
12,856
master
659
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/plugin/loader.rb
Ruby
mit
12,856
master
3,511
# 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, ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/plugin/load_error.rb
Ruby
mit
12,856
master
853
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/plugin/configuration_integrator.rb
Ruby
mit
12,856
master
5,522
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/plugin/not_supported_error.rb
Ruby
mit
12,856
master
808
# 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 ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/formatter/html_formatter.rb
Ruby
mit
12,856
master
4,621
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/formatter/colorizable.rb
Ruby
mit
12,856
master
937
# 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 ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/formatter/fuubar_style_formatter.rb
Ruby
mit
12,856
master
1,997
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/formatter/json_formatter.rb
Ruby
mit
12,856
master
2,439
# 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 = { ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/formatter/markdown_formatter.rb
Ruby
mit
12,856
master
2,126
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/formatter/simple_text_formatter.rb
Ruby
mit
12,856
master
5,099
# frozen_string_literal: true 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 include Colorizable ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/formatter/progress_formatter.rb
Ruby
mit
12,856
master
1,602
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/formatter/emacs_style_formatter.rb
Ruby
mit
12,856
master
1,039
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/formatter/file_list_formatter.rb
Ruby
mit
12,856
master
476
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/formatter/auto_gen_config_formatter.rb
Ruby
mit
12,856
master
446
# 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,...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/formatter/quiet_formatter.rb
Ruby
mit
12,856
master
386
# 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) ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/formatter/github_actions_formatter.rb
Ruby
mit
12,856
master
1,682
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/formatter/junit_formatter.rb
Ruby
mit
12,856
master
4,584
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/formatter/offense_count_formatter.rb
Ruby
mit
12,856
master
2,831
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/formatter/worst_offenders_formatter.rb
Ruby
mit
12,856
master
1,655
# 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 # -- #...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/formatter/base_formatter.rb
Ruby
mit
12,856
master
3,231
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/formatter/formatter_set.rb
Ruby
mit
12,856
master
3,829
# 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 ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/formatter/disabled_config_formatter.rb
Ruby
mit
12,856
master
10,397
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/formatter/text_util.rb
Ruby
mit
12,856
master
398
# 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}" ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/formatter/pacman_formatter.rb
Ruby
mit
12,856
master
2,277
# 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. ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/formatter/clang_style_formatter.rb
Ruby
mit
12,856
master
1,691
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/formatter/tap_formatter.rb
Ruby
mit
12,856
master
2,373
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/config_obsoletion/split_cop.rb
Ruby
mit
12,856
master
631
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/config_obsoletion/parameter_rule.rb
Ruby
mit
12,856
master
1,121
# 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) ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/config_obsoletion/cop_rule.rb
Ruby
mit
12,856
master
716
# 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_...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/config_obsoletion/changed_parameter.rb
Ruby
mit
12,856
master
976
# 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 ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/config_obsoletion/rule.rb
Ruby
mit
12,856
master
812
# 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 ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/config_obsoletion/changed_enforced_styles.rb
Ruby
mit
12,856
master
834
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/config_obsoletion/extracted_cop.rb
Ruby
mit
12,856
master
1,400
# 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) ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/config_obsoletion/renamed_cop.rb
Ruby
mit
12,856
master
1,102
# 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) ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/config_obsoletion/removed_cop.rb
Ruby
mit
12,856
master
970
# 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' ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/ext/comment.rb
Ruby
mit
12,856
master
312
# 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
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/ext/processed_source.rb
Ruby
mit
12,856
master
456
# 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 ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/ext/range.rb
Ruby
mit
12,856
master
318
# 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
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/ext/regexp_node.rb
Ruby
mit
12,856
master
1,846
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/ext/regexp_parser.rb
Ruby
mit
12,856
master
2,323
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cli/environment.rb
Ruby
mit
12,856
master
469
# 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 ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cli/command.rb
Ruby
mit
12,856
master
430
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cli/command/lsp.rb
Ruby
mit
12,856
master
440
# 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, `language-server-protocol` is heavy to require. require_rela...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cli/command/execute_runner.rb
Ruby
mit
12,856
master
3,030
# 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 ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cli/command/suggest_extensions.rb
Ruby
mit
12,856
master
4,050
# 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 ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cli/command/list_enabled_cops_for.rb
Ruby
mit
12,856
master
1,007
# frozen_string_literal: true module RuboCop class CLI module Command # Lists the cops that will inspect the given file or directory. # @api private class ListEnabledCopsFor < Base self.command_name = :list_enabled_cops_for def initialize(env) super # Load ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cli/command/version.rb
Ruby
mit
12,856
master
386
# 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 @...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cli/command/show_cops.rb
Ruby
mit
12,856
master
2,682
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cli/command/init_dotfile.rb
Ruby
mit
12,856
master
1,348
# 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...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cli/command/show_docs_url.rb
Ruby
mit
12,856
master
1,033
# 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 ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cli/command/base.rb
Ruby
mit
12,856
master
683
# 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 ...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cli/command/mcp.rb
Ruby
mit
12,856
master
363
# frozen_string_literal: true module RuboCop class CLI module Command # Start Model Context Protocol of RuboCop. # @api private class MCP < Base self.command_name = :mcp def run require_relative '../../mcp/server' RuboCop::MCP::Server.new(@config_store).sta...
github
rubocop/rubocop
https://github.com/rubocop/rubocop
lib/rubocop/cli/command/auto_generate_config.rb
Ruby
mit
12,856
master
7,097
# 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...
github
sinatra/sinatra
https://github.com/sinatra/sinatra
Rakefile
Ruby
mit
12,419
main
7,010
# frozen_string_literal: true require 'rake/clean' require 'minitest/test_task' require 'fileutils' require 'date' task default: :test def source_version @source_version ||= File.read(File.expand_path('VERSION', __dir__)).strip end def prev_feature source_version.gsub(/^(\d\.)(\d+)\..*$/) { $1 + ($2.to_i - 1).t...
github
sinatra/sinatra
https://github.com/sinatra/sinatra
Gemfile
Ruby
mit
12,419
main
2,487
# frozen_string_literal: true source 'https://rubygems.org' gemspec gem 'rake' rack_version = ENV['rack'].to_s rack_version = nil if rack_version.empty? || (rack_version == 'stable') rack_version = { github: 'rack/rack' } if rack_version == 'head' gem 'rack', rack_version rack_session_version = ENV['rack_session']....
github
sinatra/sinatra
https://github.com/sinatra/sinatra
sinatra.gemspec
Ruby
mit
12,419
main
1,995
# frozen_string_literal: true version = File.read(File.expand_path('VERSION', __dir__)).strip Gem::Specification.new 'sinatra', version do |s| s.description = 'Sinatra is a DSL for quickly creating web applications in Ruby with minimal effort.' s.summary = 'Classy web-development dressed in a DSL'...
github
sinatra/sinatra
https://github.com/sinatra/sinatra
test/middleware_test.rb
Ruby
mit
12,419
main
2,613
require_relative 'test_helper' class MiddlewareTest < Minitest::Test setup do @app = mock_app(Sinatra::Application) do get('/*')do response.headers['X-Tests'] = env['test.ran']. map { |n| n.split('::').last }. join(', ') env['PATH_INFO'] end end end class ...
github
sinatra/sinatra
https://github.com/sinatra/sinatra
test/scss_test.rb
Ruby
mit
12,419
main
2,315
require_relative 'test_helper' begin require 'sass-embedded' class ScssTest < Minitest::Test def scss_app(options = {}, &block) mock_app do set :views, __dir__ + '/views' set options get('/', &block) end get '/' end it 'renders inline Scss strings' do scss_app { scss "#scss {\...