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
sinatra/sinatra
https://github.com/sinatra/sinatra/blob/074d876e0c54ffbe605bb733cefc5a71bb22dbc1/sinatra-contrib/lib/sinatra/capture.rb
sinatra-contrib/lib/sinatra/capture.rb
require 'sinatra/base' require 'sinatra/engine_tracking' module Sinatra # # = Sinatra::Capture # # Extension that enables blocks inside other extensions. # It currently works for erb, slim and haml. # Enables mixing of different template languages. # # Example: # # # in hello_world.erb # # ...
ruby
MIT
074d876e0c54ffbe605bb733cefc5a71bb22dbc1
2026-01-04T15:37:42.068011Z
false
sinatra/sinatra
https://github.com/sinatra/sinatra/blob/074d876e0c54ffbe605bb733cefc5a71bb22dbc1/sinatra-contrib/lib/sinatra/config_file.rb
sinatra-contrib/lib/sinatra/config_file.rb
require 'sinatra/base' require 'yaml' require 'erb' module Sinatra # = Sinatra::ConfigFile # # <tt>Sinatra::ConfigFile</tt> is an extension that allows you to load the # application's configuration from YAML files. It automatically detects if # the files contain specific environment settings and it will use...
ruby
MIT
074d876e0c54ffbe605bb733cefc5a71bb22dbc1
2026-01-04T15:37:42.068011Z
false
sinatra/sinatra
https://github.com/sinatra/sinatra/blob/074d876e0c54ffbe605bb733cefc5a71bb22dbc1/sinatra-contrib/lib/sinatra/namespace.rb
sinatra-contrib/lib/sinatra/namespace.rb
# frozen_string_literal: true require 'sinatra/base' require 'mustermann' module Sinatra # = Sinatra::Namespace # # <tt>Sinatra::Namespace</tt> is an extension that adds namespaces to an # application. This namespaces will allow you to share a path prefix for the # routes within the namespace, and define f...
ruby
MIT
074d876e0c54ffbe605bb733cefc5a71bb22dbc1
2026-01-04T15:37:42.068011Z
false
sinatra/sinatra
https://github.com/sinatra/sinatra/blob/074d876e0c54ffbe605bb733cefc5a71bb22dbc1/sinatra-contrib/lib/sinatra/contrib.rb
sinatra-contrib/lib/sinatra/contrib.rb
# frozen_string_literal: true require 'sinatra/contrib/setup' module Sinatra module Contrib ## # Common middleware that doesn't bring run time overhead if not used # or breaks if external dependencies are missing. Will extend # Sinatra::Application by default. module Common register :Confi...
ruby
MIT
074d876e0c54ffbe605bb733cefc5a71bb22dbc1
2026-01-04T15:37:42.068011Z
false
sinatra/sinatra
https://github.com/sinatra/sinatra/blob/074d876e0c54ffbe605bb733cefc5a71bb22dbc1/sinatra-contrib/lib/sinatra/json.rb
sinatra-contrib/lib/sinatra/json.rb
# frozen_string_literal: true require 'sinatra/base' require 'multi_json' module Sinatra # = Sinatra::JSON # # <tt>Sinatra::JSON</tt> adds a helper method, called +json+, for (obviously) # json generation. # # == Usage # # === Classic Application # # In a classic application simply require the help...
ruby
MIT
074d876e0c54ffbe605bb733cefc5a71bb22dbc1
2026-01-04T15:37:42.068011Z
false
sinatra/sinatra
https://github.com/sinatra/sinatra/blob/074d876e0c54ffbe605bb733cefc5a71bb22dbc1/sinatra-contrib/lib/sinatra/haml_helpers.rb
sinatra-contrib/lib/sinatra/haml_helpers.rb
# frozen_string_literal: true require 'sinatra/base' require 'sinatra/capture' module Sinatra # = Sinatra::HamlHelpers # # This extension provides some of the helper methods that existed in Haml 5 # but were removed in Haml 6. To use this in your app, just +register+ it: # # require 'sinatra/base' # ...
ruby
MIT
074d876e0c54ffbe605bb733cefc5a71bb22dbc1
2026-01-04T15:37:42.068011Z
false
sinatra/sinatra
https://github.com/sinatra/sinatra/blob/074d876e0c54ffbe605bb733cefc5a71bb22dbc1/sinatra-contrib/lib/sinatra/runner.rb
sinatra-contrib/lib/sinatra/runner.rb
# frozen_string_literal: true require 'open-uri' require 'net/http' require 'timeout' module Sinatra # NOTE: This feature is experimental, and missing tests! # # Helps you spinning up and shutting down your own sinatra app. This is especially helpful for running # real network tests against a sinatra backend....
ruby
MIT
074d876e0c54ffbe605bb733cefc5a71bb22dbc1
2026-01-04T15:37:42.068011Z
false
sinatra/sinatra
https://github.com/sinatra/sinatra/blob/074d876e0c54ffbe605bb733cefc5a71bb22dbc1/sinatra-contrib/lib/sinatra/multi_route.rb
sinatra-contrib/lib/sinatra/multi_route.rb
# frozen_string_literal: true require 'sinatra/base' module Sinatra # = Sinatra::MultiRoute # # Create multiple routes with one statement. # # == Usage # # Use this extension to create a handler for multiple routes: # # get '/foo', '/bar' do # # ... # end # # Or for multiple verbs: ...
ruby
MIT
074d876e0c54ffbe605bb733cefc5a71bb22dbc1
2026-01-04T15:37:42.068011Z
false
sinatra/sinatra
https://github.com/sinatra/sinatra/blob/074d876e0c54ffbe605bb733cefc5a71bb22dbc1/sinatra-contrib/lib/sinatra/test_helpers.rb
sinatra-contrib/lib/sinatra/test_helpers.rb
# frozen_string_literal: true require 'sinatra/base' require 'rack' begin require 'rack/test' rescue LoadError abort 'Add rack-test to your Gemfile to use this module!' end require 'forwardable' module Sinatra Base.set :environment, :test # Helper methods to ease testing your Sinatra application. Partly extr...
ruby
MIT
074d876e0c54ffbe605bb733cefc5a71bb22dbc1
2026-01-04T15:37:42.068011Z
false
sinatra/sinatra
https://github.com/sinatra/sinatra/blob/074d876e0c54ffbe605bb733cefc5a71bb22dbc1/sinatra-contrib/lib/sinatra/streaming.rb
sinatra-contrib/lib/sinatra/streaming.rb
# frozen_string_literal: true require 'sinatra/base' module Sinatra # = Sinatra::Streaming # # Sinatra 1.3 introduced the +stream+ helper. This addon improves the # streaming API by making the stream object imitate an IO object, turning # it into a real Deferrable and making the body play nicer with middlew...
ruby
MIT
074d876e0c54ffbe605bb733cefc5a71bb22dbc1
2026-01-04T15:37:42.068011Z
false
sinatra/sinatra
https://github.com/sinatra/sinatra/blob/074d876e0c54ffbe605bb733cefc5a71bb22dbc1/sinatra-contrib/lib/sinatra/extension.rb
sinatra-contrib/lib/sinatra/extension.rb
# frozen_string_literal: true require 'sinatra/base' module Sinatra # = Sinatra::Extension # # <tt>Sinatra::Extension</tt> is a mixin that provides some syntactic sugar # for your extensions. It allows you to call almost any # <tt>Sinatra::Base</tt> method directly inside your extension # module. This mea...
ruby
MIT
074d876e0c54ffbe605bb733cefc5a71bb22dbc1
2026-01-04T15:37:42.068011Z
false
sinatra/sinatra
https://github.com/sinatra/sinatra/blob/074d876e0c54ffbe605bb733cefc5a71bb22dbc1/sinatra-contrib/lib/sinatra/link_header.rb
sinatra-contrib/lib/sinatra/link_header.rb
require 'sinatra/base' module Sinatra # = Sinatra::LinkHeader # # <tt>Sinatra::LinkHeader</tt> adds a set of helper methods to generate link # HTML tags and their corresponding Link HTTP headers. # # == Usage # # Once you had set up the helpers in your application (see below), you will # be able to c...
ruby
MIT
074d876e0c54ffbe605bb733cefc5a71bb22dbc1
2026-01-04T15:37:42.068011Z
false
sinatra/sinatra
https://github.com/sinatra/sinatra/blob/074d876e0c54ffbe605bb733cefc5a71bb22dbc1/sinatra-contrib/lib/sinatra/content_for.rb
sinatra-contrib/lib/sinatra/content_for.rb
# frozen_string_literal: true require 'sinatra/base' require 'sinatra/capture' module Sinatra # = Sinatra::ContentFor # # <tt>Sinatra::ContentFor</tt> is a set of helpers that allows you to capture # blocks inside views to be rendered later during the request. The most # common use is to populate different ...
ruby
MIT
074d876e0c54ffbe605bb733cefc5a71bb22dbc1
2026-01-04T15:37:42.068011Z
false
sinatra/sinatra
https://github.com/sinatra/sinatra/blob/074d876e0c54ffbe605bb733cefc5a71bb22dbc1/sinatra-contrib/lib/sinatra/quiet_logger.rb
sinatra-contrib/lib/sinatra/quiet_logger.rb
# frozen_string_literal: true module Sinatra # = Sinatra::QuietLogger # # QuietLogger extension allows you to define paths excluded # from logging using the +quiet_logger_prefixes+ setting. # It is inspired from rails quiet_logger, but handles multiple paths. # # == Usage # # === Classic Application ...
ruby
MIT
074d876e0c54ffbe605bb733cefc5a71bb22dbc1
2026-01-04T15:37:42.068011Z
false
sinatra/sinatra
https://github.com/sinatra/sinatra/blob/074d876e0c54ffbe605bb733cefc5a71bb22dbc1/sinatra-contrib/lib/sinatra/reloader.rb
sinatra-contrib/lib/sinatra/reloader.rb
# frozen_string_literal: true require 'sinatra/base' module Sinatra # = Sinatra::Reloader # # <b>DEPRECATED:<b> Please consider using an alternative like # <tt>rerun</tt> or <tt>rack-unreloader</tt> instead. # # Extension to reload modified files. Useful during development, # since it will automaticall...
ruby
MIT
074d876e0c54ffbe605bb733cefc5a71bb22dbc1
2026-01-04T15:37:42.068011Z
false
sinatra/sinatra
https://github.com/sinatra/sinatra/blob/074d876e0c54ffbe605bb733cefc5a71bb22dbc1/sinatra-contrib/lib/sinatra/custom_logger.rb
sinatra-contrib/lib/sinatra/custom_logger.rb
# frozen_string_literal: true module Sinatra # = Sinatra::CustomLogger # # CustomLogger extension allows you to define your own logger instance # using +logger+ setting. That logger then will be available # as #logger helper method in your routes and views. # # == Usage # # === Classic Application ...
ruby
MIT
074d876e0c54ffbe605bb733cefc5a71bb22dbc1
2026-01-04T15:37:42.068011Z
false
sinatra/sinatra
https://github.com/sinatra/sinatra/blob/074d876e0c54ffbe605bb733cefc5a71bb22dbc1/sinatra-contrib/lib/sinatra/contrib/version.rb
sinatra-contrib/lib/sinatra/contrib/version.rb
# frozen_string_literal: true module Sinatra module Contrib VERSION = '4.2.1' end end
ruby
MIT
074d876e0c54ffbe605bb733cefc5a71bb22dbc1
2026-01-04T15:37:42.068011Z
false
sinatra/sinatra
https://github.com/sinatra/sinatra/blob/074d876e0c54ffbe605bb733cefc5a71bb22dbc1/sinatra-contrib/lib/sinatra/contrib/setup.rb
sinatra-contrib/lib/sinatra/contrib/setup.rb
# frozen_string_literal: true require 'sinatra/base' require 'sinatra/contrib/version' module Sinatra module Contrib module Loader def extensions @extensions ||= { helpers: [], register: [] } end def register(name, path) autoload name, path, :register end def help...
ruby
MIT
074d876e0c54ffbe605bb733cefc5a71bb22dbc1
2026-01-04T15:37:42.068011Z
false
sinatra/sinatra
https://github.com/sinatra/sinatra/blob/074d876e0c54ffbe605bb733cefc5a71bb22dbc1/sinatra-contrib/lib/sinatra/contrib/all.rb
sinatra-contrib/lib/sinatra/contrib/all.rb
# frozen_string_literal: true require 'sinatra/contrib' Sinatra.register Sinatra::Contrib::All
ruby
MIT
074d876e0c54ffbe605bb733cefc5a71bb22dbc1
2026-01-04T15:37:42.068011Z
false
matteocrippa/awesome-swift
https://github.com/matteocrippa/awesome-swift/blob/48e4464479e7701d4453730a07912ab84e787283/.github/convert.rb
.github/convert.rb
README = 'README.md' CONTENTS = 'contents.json' def get_json() require 'json' JSON.parse(File.read CONTENTS) end def output_linux(tags) return '' if tags.nil? return ':penguin: ' if tags.include? 'linux' '' end def output_projects(proj, id) o = '' proj.select {|p| p['category']==id } .sort_by {...
ruby
CC0-1.0
48e4464479e7701d4453730a07912ab84e787283
2026-01-04T15:37:27.381814Z
false
greatghoul/remote-working
https://github.com/greatghoul/remote-working/blob/01dc10c52bb4b234bbaaa50692d99addd3d33ed1/scripts/contributors.rb
scripts/contributors.rb
#!/usr/bin/env ruby require 'net/http' require 'openssl' require 'json' API_HOST = 'api.github.com'.freeze API_URL = '/repos/greatghoul/remote-working/stats/contributors'.freeze http = Net::HTTP.new(API_HOST, 443) http.use_ssl = true response = http.send_request( 'GET', API_URL, nil, Accept: 'application/vnd.git...
ruby
MIT
01dc10c52bb4b234bbaaa50692d99addd3d33ed1
2026-01-04T15:38:08.021240Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/tasks/changelog.rb
tasks/changelog.rb
# frozen_string_literal: true # Changelog utility class Changelog ENTRIES_PATH = 'changelog/' FIRST_HEADER = /#{Regexp.escape("## master (unreleased)\n")}/m.freeze ENTRIES_PATH_TEMPLATE = "#{ENTRIES_PATH}%<type>s_%<name>s_%<timestamp>s.md" TYPE_REGEXP = /#{Regexp.escape(ENTRIES_PATH)}([a-z]+)_/.freeze TYPE_T...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/isolated_environment_spec.rb
spec/isolated_environment_spec.rb
# frozen_string_literal: true RSpec.describe 'isolated environment', :isolated_environment, type: :feature do include_context 'cli spec behavior' let(:cli) { RuboCop::CLI.new } # Configuration files above the work directory shall not disturb the # tests. This is especially important on Windows where the temp...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/project_spec.rb
spec/project_spec.rb
# frozen_string_literal: true RSpec.describe 'RuboCop Project', type: :feature do let(:cop_names) do RuboCop::Cop::Registry .global .without_department(:InternalAffairs) .reject { |cop| cop.cop_name.start_with?('Test/') } .map(&:cop_name) end version_regexp = /\A\d+\.\d+\z|\A<<next>>...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/spec_helper.rb
spec/spec_helper.rb
# frozen_string_literal: true # Disable colors in specs require 'rainbow' Rainbow.enabled = false require_relative 'support/strict_warnings' StrictWarnings.enable! require 'rubocop' require 'rubocop/cop/internal_affairs' require 'rubocop/server' require 'webmock/rspec' require_relative 'core_ext/string' begin r...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/tasks/changelog_spec.rb
spec/tasks/changelog_spec.rb
# frozen_string_literal: true require_relative '../../tasks/changelog' RSpec.describe Changelog do subject(:changelog) do list = entries.to_h { |e| [e.path, e.content] } described_class.new(content: <<~CHANGELOG, entries: list) # Change log <!--- Do NOT edit this CHANGELOG.md file by ha...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/support/empty_lines_around_body_shared_examples.rb
spec/support/empty_lines_around_body_shared_examples.rb
# frozen_string_literal: true RSpec.shared_examples 'empty_lines_around_class_or_module_body' do |type| context 'when EnforcedStyle is empty_lines_special' do let(:cop_config) { { 'EnforcedStyle' => 'empty_lines_special' } } context 'when first child is a method' do it "requires blank line at the begi...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/support/fake_location.rb
spec/support/fake_location.rb
# frozen_string_literal: true # Tests may use this to fake out a location structure in an Offense. FakeLocation = Struct.new(:line, :column, keyword_init: true)
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/support/strict_warnings.rb
spec/support/strict_warnings.rb
# frozen_string_literal: true # NOTE: Prevents the cause from being obscured by `uninitialized constant StrictWarnings::StringIO` # when there is a warning or syntax error in the product code. require 'stringio' # Ensure that RuboCop runs warning-free. This hooks into Ruby's `warn` # method and raises when an unexpec...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/support/lsp_helper.rb
spec/support/lsp_helper.rb
# frozen_string_literal: true require 'rubocop/lsp/server' module LSPHelper def run_server_on_requests(*requests) stdin = StringIO.new(requests.map { |request| to_jsonrpc(request) }.join) RuboCop::Server::Helper.redirect(stdin: stdin) do config_store = RuboCop::ConfigStore.new RuboCop::LSP::Se...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/support/suppress_pending_warning.rb
spec/support/suppress_pending_warning.rb
# frozen_string_literal: true # # This is a file that supports testing. An open class has been applied to # `RuboCop::PendingCopsReporter.warn_on_pending_cops` to suppress pending cop # warnings during testing. # module RuboCop class PendingCopsReporter class << self remove_method :warn_on_pending_cops ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/support/encoding_helper.rb
spec/support/encoding_helper.rb
# frozen_string_literal: true # Overwrite the default internal/external encoding for the duration of a block. # Ruby discourages this by emitting a warning when modifying, these helpers exist # to suppress these warnings during tests. module EncodingHelper def with_default_internal_encoding(encoding) orig_encodi...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/support/multiline_literal_brace_layout_method_argument_examples.rb
spec/support/multiline_literal_brace_layout_method_argument_examples.rb
# frozen_string_literal: true RSpec.shared_examples 'multiline literal brace layout method argument' do include MultilineLiteralBraceHelper context 'when arguments to a method' do let(:prefix) { 'bar(' } let(:suffix) { ')' } context 'and a comment after the last element' do let(:b_comment) { ' ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/support/cli_spec_behavior.rb
spec/support/cli_spec_behavior.rb
# frozen_string_literal: true RSpec.shared_context 'cli spec behavior' do include_context 'mock console output' include FileHelper def abs(path) File.expand_path(path) end before do RuboCop::ConfigLoader.debug = false RuboCop::ConfigLoader.default_configuration = nil # OPTIMIZE: Makes the...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/support/multiline_literal_brace_layout_trailing_comma_examples.rb
spec/support/multiline_literal_brace_layout_trailing_comma_examples.rb
# frozen_string_literal: true RSpec.shared_examples 'multiline literal brace layout trailing comma' do let(:prefix) { '' } # A prefix before the opening brace. let(:suffix) { '' } # A suffix for the line after the closing brace. let(:a) { 'a' } # The first element. let(:b) { 'b' } # The second element. cont...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/support/file_helper.rb
spec/support/file_helper.rb
# frozen_string_literal: true require 'fileutils' module FileHelper # rubocop:disable Metrics/MethodLength def create_file(file_path, content, retain_line_terminators: false) file_path = File.expand_path(file_path) # On Windows, when a file is opened in 'w' mode, LF line terminators (`\n`) # are auto...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/support/condition_modifier_cop.rb
spec/support/condition_modifier_cop.rb
# frozen_string_literal: true RSpec.shared_examples 'condition modifier cop' do |keyword, extra_message = nil| let(:other_cops) { { 'Layout/LineLength' => { 'Max' => 80 } } } context "for a multiline '#{keyword}'" do it 'accepts it if single line would not fit on one line' do # This statement is one cha...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/support/multiline_literal_brace_helper.rb
spec/support/multiline_literal_brace_helper.rb
# frozen_string_literal: true module MultilineLiteralBraceHelper # Construct the source code for the braces. For instance, for an array # the `open` brace would be `[` and the `close` brace would be `]`, so # you could construct the following: # # braces(true, 'a', 'b', 'c', false) # # [ # line b...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/support/multiline_literal_brace_layout_examples.rb
spec/support/multiline_literal_brace_layout_examples.rb
# frozen_string_literal: true RSpec.shared_examples 'multiline literal brace layout' do include MultilineLiteralBraceHelper let(:prefix) { '' } # A prefix before the opening brace. let(:suffix) { '' } # A suffix for the line after the closing brace. let(:a) { 'a' } # The first element. let(:b) { 'b' } # The...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/support/custom_matchers.rb
spec/support/custom_matchers.rb
# frozen_string_literal: true RSpec::Matchers.define :exit_with_code do |code| supports_block_expectations actual = nil match do |block| begin block.call rescue SystemExit => e actual = e.status end actual && actual == code end failure_message do "expected block to call exi...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/support/misc_helper.rb
spec/support/misc_helper.rb
# frozen_string_literal: true def trailing_whitespace ' ' end
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/support/alignment_examples.rb
spec/support/alignment_examples.rb
# frozen_string_literal: true # `cop` and `source` must be declared with #let. RSpec.shared_examples 'misaligned' do |annotated_source, used_style| config_to_allow_offenses = if used_style { 'EnforcedStyleAlignWith' => used_style.to_s } else ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/support/cops/infinite_loop_during_autocorrect_with_change.rb
spec/support/cops/infinite_loop_during_autocorrect_with_change.rb
# frozen_string_literal: true module RuboCop module Cop module Test class InfiniteLoopDuringAutocorrectWithChangeCop < RuboCop::Cop::Base extend AutoCorrector def on_class(node) add_offense(node, message: 'Class must be a Module') do |corrector| corrector.replace(node...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/support/cops/b_to_a_cop.rb
spec/support/cops/b_to_a_cop.rb
# frozen_string_literal: true module RuboCop module Cop module Test # This cop is only used to test infinite loop detection class BtoA < RuboCop::Cop::Base extend AutoCorrector def on_class(node) return unless node.loc.name.source.include?('B') add_offense(node.l...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/support/cops/b_to_c_cop.rb
spec/support/cops/b_to_c_cop.rb
# frozen_string_literal: true module RuboCop module Cop module Test # This cop is only used to test infinite loop detection class BtoC < RuboCop::Cop::Base extend AutoCorrector def on_class(node) return unless node.loc.name.source.include?('B') add_offense(node.l...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/support/cops/c_to_a_cop.rb
spec/support/cops/c_to_a_cop.rb
# frozen_string_literal: true module RuboCop module Cop module Test # This cop is only used to test infinite loop detection class CtoA < RuboCop::Cop::Base extend AutoCorrector def on_class(node) return unless node.loc.name.source.include?('C') add_offense(node.l...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/support/cops/module_must_be_a_class_cop.rb
spec/support/cops/module_must_be_a_class_cop.rb
# frozen_string_literal: true module RuboCop module Cop module Test class ModuleMustBeAClassCop < RuboCop::Cop::Base extend AutoCorrector def on_module(node) add_offense(node, message: 'Module must be a Class') do |corrector| corrector.replace(node.loc.keyword, 'class...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/support/cops/class_must_be_a_module_cop.rb
spec/support/cops/class_must_be_a_module_cop.rb
# frozen_string_literal: true module RuboCop module Cop module Test class ClassMustBeAModuleCop < RuboCop::Cop::Base extend AutoCorrector def on_class(node) add_offense(node, message: 'Class must be a Module') do |corrector| corrector.replace(node.loc.keyword, 'module...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/support/cops/same_name_in_multiple_namespace.rb
spec/support/cops/same_name_in_multiple_namespace.rb
# frozen_string_literal: true module RuboCop module Cop module Test class SameNameInMultipleNamespace < RuboCop::Cop::Base; end module Foo class SameNameInMultipleNamespace < RuboCop::Cop::Base; end end module Bar class SameNameInMultipleNamespace < RuboCop::Cop::Base; e...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/support/cops/infinite_loop_during_autocorrect.rb
spec/support/cops/infinite_loop_during_autocorrect.rb
# frozen_string_literal: true module RuboCop module Cop module Test class InfiniteLoopDuringAutocorrectCop < RuboCop::Cop::Base extend AutoCorrector def on_class(node) add_offense(node, message: 'Class must be a Module') do |corrector| # Replace the offense with itsel...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/support/cops/alignment_directive.rb
spec/support/cops/alignment_directive.rb
# frozen_string_literal: true module RuboCop module Cop module Test # This cop allows us to test the {AlignmentCorrector}. A node that is # annotated with a comment of the form `# << delta` or `# >> delta` where # `delta` is an integer will be shifted by `delta` columns in the # indicated...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/support/cops/a_to_b_cop.rb
spec/support/cops/a_to_b_cop.rb
# frozen_string_literal: true module RuboCop module Cop module Test # This cop is only used to test infinite loop detection class AtoB < RuboCop::Cop::Base extend AutoCorrector def on_class(node) return unless node.loc.name.source.include?('A') add_offense(node.l...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/string_interpreter_spec.rb
spec/rubocop/string_interpreter_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::StringInterpreter do describe '.interpret' do shared_examples 'simple escape' do |escaped| it "handles #{escaped}" do expect(described_class.interpret(escaped)).to eq escaped[1..] end end it 'handles hex' do expect(described...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/runner_formatter_invocation_spec.rb
spec/rubocop/runner_formatter_invocation_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Runner, :isolated_environment do describe 'how formatter is invoked' do subject(:runner) { described_class.new({}, RuboCop::ConfigStore.new) } include_context 'cli spec behavior' let(:formatter) { instance_double(RuboCop::Formatter::BaseFormatter).a...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cops_documentation_generator_spec.rb
spec/rubocop/cops_documentation_generator_spec.rb
# frozen_string_literal: true require 'rubocop/cops_documentation_generator' RSpec.describe CopsDocumentationGenerator do around do |example| new_global = RuboCop::Cop::Registry.new([RuboCop::Cop::Style::HashSyntax]) RuboCop::Cop::Registry.with_temporary_global(new_global) { example.run } end it 'gener...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/version_spec.rb
spec/rubocop/version_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Version do include FileHelper describe '.version' do subject { described_class.version(debug: debug) } context 'debug is false (default)' do let(:debug) { false } it { is_expected.to match(/\d+\.\d+\.\d+/) } it { is_expected.not_to ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/lsp_spec.rb
spec/rubocop/lsp_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::LSP, :lsp do describe '.enabled?' do context 'when `RuboCop::LSP.enable` is called' do before { described_class.enable } it 'returns true' do expect(described_class).to be_enabled end end context 'when `RuboCop::LSP.disable...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/file_finder_spec.rb
spec/rubocop/file_finder_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::FileFinder, :isolated_environment do include FileHelper subject(:finder) { Class.new.include(described_class).new } before do create_empty_file('file') create_empty_file(File.join('dir', 'file')) end describe '#find_file_upwards' do it 'ret...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/remote_config_spec.rb
spec/rubocop/remote_config_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::RemoteConfig do include FileHelper subject(:remote_config) { described_class.new(remote_config_url, base_dir).file } let(:remote_config_url) { 'http://example.com/rubocop.yml' } let(:base_dir) { '.' } let(:cached_file_name) { '.rubocop-remote-e32e465e27...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/config_regeneration_spec.rb
spec/rubocop/config_regeneration_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::ConfigRegeneration, :isolated_environment do include FileHelper subject(:config_regeneration) { described_class.new } describe '#options' do subject { config_regeneration.options } context 'when no todo file exists' do it { is_expected.to eq(...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/magic_comment_spec.rb
spec/rubocop/magic_comment_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::MagicComment do shared_examples 'magic comment' do |comment, expectations = {}| encoding = expectations[:encoding] frozen_string = expectations[:frozen_string_literal] shareable_constant_value = expectations[:shareable_constant_value] typed = expe...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/yaml_duplication_checker_spec.rb
spec/rubocop/yaml_duplication_checker_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::YAMLDuplicationChecker do def check(yaml, &block) described_class.check(yaml, 'dummy.yaml', &block) end shared_examples 'call block' do it 'calls block' do called = false check(yaml) { called = true } expect(called).to be(true) ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/target_ruby_spec.rb
spec/rubocop/target_ruby_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::TargetRuby, :isolated_environment do include FileHelper subject(:target_ruby) { described_class.new(configuration) } let(:configuration) { RuboCop::Config.new(hash, loaded_path) } let(:default_version) { described_class::DEFAULT_VERSION } let(:hash) { ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/target_finder_spec.rb
spec/rubocop/target_finder_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::TargetFinder, :isolated_environment do include FileHelper ruby_extensions = %w[.rb .arb .axlsx .builder .fcgi .gemfile .ge...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/feature_loader_spec.rb
spec/rubocop/feature_loader_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::FeatureLoader do describe '.load' do subject(:load) do described_class.load(config_directory_path: config_directory_path, feature: feature) end let(:config_directory_path) do 'path-to-config' end let(:feature) do 'feature' ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/pending_cops_reporter_spec.rb
spec/rubocop/pending_cops_reporter_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::PendingCopsReporter do include FileHelper describe 'when pending cops exist', :isolated_environment do subject(:report_pending_cops) { described_class.warn_if_needed(config) } let(:config) { RuboCop::Config.new(parent_config) } before do cr...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/config_obsoletion_spec.rb
spec/rubocop/config_obsoletion_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::ConfigObsoletion do include FileHelper subject(:config_obsoletion) { described_class.new(configuration) } let(:configuration) { RuboCop::Config.new(hash, loaded_path) } let(:loaded_path) { 'example/.rubocop.yml' } let(:plugins) { [] } let(:requires) {...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
true
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/cli_spec.rb
spec/rubocop/cli_spec.rb
# frozen_string_literal: true require 'timeout' RSpec.describe RuboCop::CLI, :isolated_environment do subject(:cli) { described_class.new } include_context 'cli spec behavior' context 'when interrupted' do it 'returns 130' do allow_any_instance_of(RuboCop::Runner).to receive(:aborting?).and_return(t...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
true
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/comment_config_spec.rb
spec/rubocop/comment_config_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::CommentConfig do subject(:comment_config) { described_class.new(parse_source(source)) } describe '#cop_enabled_at_line?' do let(:source) do # rubocop:disable Lint/EmptyExpression, Lint/EmptyInterpolation <<~RUBY # rubocop:disable Metric...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/directive_comment_spec.rb
spec/rubocop/directive_comment_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::DirectiveComment do let(:directive_comment) { described_class.new(comment, cop_registry) } let(:comment) { instance_double(Parser::Source::Comment, text: text) } let(:cop_registry) do instance_double(RuboCop::Cop::Registry, names: all_cop_names, departmen...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/config_store_spec.rb
spec/rubocop/config_store_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::ConfigStore do subject(:config_store) { described_class.new } before do allow(RuboCop::ConfigLoader).to receive(:configuration_file_for) do |arg| # File tree: # file1 # dir/.rubocop.yml # dir/file2 # dir/subdir/file3 "#{...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/plugin_spec.rb
spec/rubocop/plugin_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Plugin do describe '.plugin_capable?' do subject { described_class.plugin_capable?(feature) } context 'when feature is a built-in plugin' do let(:feature) { 'rubocop/cop/internal_affairs' } it { is_expected.to be(true) } end context...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/lockfile_spec.rb
spec/rubocop/lockfile_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Lockfile, :isolated_environment do include FileHelper subject { described_class.new } let(:lockfile) do create_file('Gemfile.lock', <<~LOCKFILE) GEM specs: rake (13.0.1) rspec (3.9.0) dep (1.0.0) d...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/config_loader_spec.rb
spec/rubocop/config_loader_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::ConfigLoader do include FileHelper include_context 'cli spec behavior' before do described_class.debug = true # Force reload of default configuration described_class.default_configuration = nil RuboCop::ConfigFinder.project_root = nil end ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
true
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/rake_task_spec.rb
spec/rubocop/rake_task_spec.rb
# frozen_string_literal: true require 'rubocop/rake_task' require 'support/file_helper' RSpec.describe RuboCop::RakeTask do include FileHelper before { Rake::Task.clear } after { Rake::Task.clear } describe 'defining tasks' do # rubocop:todo Naming/InclusiveLanguage it 'creates a rubocop task and a...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/result_cache_spec.rb
spec/rubocop/result_cache_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::ResultCache, :isolated_environment do include EncodingHelper include FileHelper subject(:cache) { described_class.new(file, team, options, config_store, cache_root) } let(:registry) { RuboCop::Cop::Registry.global } let(:team) do RuboCop::Cop::Team....
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/runner_spec.rb
spec/rubocop/runner_spec.rb
# frozen_string_literal: true module RuboCop class Runner attr_writer :errors # Needed only for testing. end end RSpec.describe RuboCop::Runner, :isolated_environment do include FileHelper let(:formatter_output_path) { 'formatter_output.txt' } let(:formatter_output) { File.read(formatter_output_path) }...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/config_spec.rb
spec/rubocop/config_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Config do include FileHelper subject(:configuration) { described_class.new(hash, loaded_path) } let(:hash) { {} } let(:loaded_path) { 'example/.rubocop.yml' } describe '.new' do context 'without arguments' do subject(:configuration) { describ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/path_util_spec.rb
spec/rubocop/path_util_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::PathUtil do describe '#relative_path' do it 'builds paths relative to PWD by default as a stop-gap' do relative = File.join(Dir.pwd, 'relative') expect(described_class.relative_path(relative)).to eq('relative') end it 'supports custom bas...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/options_spec.rb
spec/rubocop/options_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Options, :isolated_environment do include FileHelper subject(:options) { described_class.new } include_context 'mock console output' def abs(path) File.expand_path(path) end describe 'option' do describe '-h/--help' do # HACK: `help` o...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
true
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/intentionally_empty_file.rb
spec/rubocop/intentionally_empty_file.rb
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/rspec/expect_offense_spec.rb
spec/rubocop/rspec/expect_offense_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::RSpec::ExpectOffense, :config do context 'with a cop that loops during autocorrection' do let(:cop_class) { RuboCop::Cop::Test::InfiniteLoopDuringAutocorrectCop } it '`expect_no_corrections` raises' do expect_offense(<<~RUBY) class Test ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/plugin/loader_spec.rb
spec/rubocop/plugin/loader_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Plugin::Loader do describe '.load' do subject(:plugins) { described_class.load(plugin_configs) } context 'when plugin config is a string' do let(:plugin_configs) { ['rubocop/cop/internal_affairs'] } let(:plugin) { plugins.first } it 'r...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/plugin/configuration_integrator_spec.rb
spec/rubocop/plugin/configuration_integrator_spec.rb
# frozen_string_literal: true require 'lint_roller' RSpec.describe RuboCop::Plugin::ConfigurationIntegrator, :isolated_environment do include FileHelper describe '.integrate_plugins_into_rubocop_config' do subject(:integrated_config) do described_class.integrate_plugins_into_rubocop_config(rubocop_conf...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/lsp/server_spec.rb
spec/rubocop/lsp/server_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::LSP::Server, :isolated_environment do include LSPHelper subject(:result) { run_server_on_requests(*requests) } after do RuboCop::LSP.disable end let(:messages) { result[0] } let(:stderr) { result[1].string } let(:eol) do if RuboCop::Platfo...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
true
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/lsp/severity_spec.rb
spec/rubocop/lsp/severity_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::LSP::Severity do describe '.find_by' do subject(:lsp_severity) { described_class.find_by(rubocop_severity) } context 'when RuboCop severity is fatal' do let(:rubocop_severity) { 'fatal' } it { is_expected.to eq(LanguageServer::Protocol::Cons...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/formatter/auto_gen_config_formatter_spec.rb
spec/rubocop/formatter/auto_gen_config_formatter_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Formatter::AutoGenConfigFormatter do subject(:formatter) { described_class.new(output) } let(:output) { StringIO.new } let(:files) do %w[lib/rubocop.rb spec/spec_helper.rb exe/rubocop].map do |path| File.expand_path(path) end end describe...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/formatter/fuubar_style_formatter_spec.rb
spec/rubocop/formatter/fuubar_style_formatter_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Formatter::FuubarStyleFormatter do subject(:formatter) { described_class.new(output) } let(:output) { StringIO.new } let(:files) { %w[lib/rubocop.rb spec/spec_helper.rb].map { |path| File.expand_path(path) } } describe '#with_color' do around do |exa...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/formatter/colorizable_spec.rb
spec/rubocop/formatter/colorizable_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Formatter::Colorizable do let(:formatter_class) do Class.new(RuboCop::Formatter::BaseFormatter) do include RuboCop::Formatter::Colorizable end end let(:options) { {} } let(:formatter) { formatter_class.new(output, options) } let(:output) ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/formatter/emacs_style_formatter_spec.rb
spec/rubocop/formatter/emacs_style_formatter_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Formatter::EmacsStyleFormatter, :config do subject(:formatter) { described_class.new(output) } let(:cop_class) { RuboCop::Cop::Base } let(:source) { %w[a b cdefghi].join("\n") } let(:output) { StringIO.new } before { cop.send(:begin_investigation, proce...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/formatter/html_formatter_spec.rb
spec/rubocop/formatter/html_formatter_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Formatter::HTMLFormatter, :isolated_environment do spec_root = File.expand_path('../..', __dir__) around do |example| project_path = File.join(spec_root, 'fixtures/html_formatter/project') FileUtils.cp_r(project_path, '.') Dir.chdir(File.basename(...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/formatter/simple_text_formatter_spec.rb
spec/rubocop/formatter/simple_text_formatter_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Formatter::SimpleTextFormatter do subject(:formatter) { described_class.new(output) } before { Rainbow.enabled = true } after { Rainbow.enabled = false } let(:output) { StringIO.new } shared_examples 'report for severity' do |severity| let(:offens...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/formatter/text_util_spec.rb
spec/rubocop/formatter/text_util_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Formatter::TextUtil do describe 'pluralize' do it 'does not change 0 to no' do pluralized_text = described_class.pluralize(0, 'file') expect(pluralized_text).to eq('0 files') end it 'changes 0 to no when configured' do pluralized_t...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/formatter/disabled_config_formatter_spec.rb
spec/rubocop/formatter/disabled_config_formatter_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Formatter::DisabledConfigFormatter, :isolated_environment, :restore_registry do include FileHelper subject(:formatter) { described_class.new(output) } include_context 'mock console output' let(:output) do io = StringIO.new def io....
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/formatter/quiet_formatter_spec.rb
spec/rubocop/formatter/quiet_formatter_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Formatter::QuietFormatter do subject(:formatter) { described_class.new(output) } before { Rainbow.enabled = true } after { Rainbow.enabled = false } let(:output) { StringIO.new } describe '#report_file' do before { formatter.report_file(file, [off...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/formatter/file_list_formatter_spec.rb
spec/rubocop/formatter/file_list_formatter_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Formatter::FileListFormatter, :config do subject(:formatter) { described_class.new(output) } let(:output) { StringIO.new } let(:cop_class) { RuboCop::Cop::Base } let(:source) { %w[a b cdefghi].join("\n") } before { cop.send(:begin_investigation, process...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/formatter/worst_offenders_formatter_spec.rb
spec/rubocop/formatter/worst_offenders_formatter_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Formatter::WorstOffendersFormatter do subject(:formatter) { described_class.new(output) } let(:output) { StringIO.new } let(:files) do %w[lib/rubocop.rb spec/spec_helper.rb exe/rubocop].map do |path| File.expand_path(path) end end describ...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/formatter/json_formatter_spec.rb
spec/rubocop/formatter/json_formatter_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Formatter::JSONFormatter do subject(:formatter) { described_class.new(output) } let(:output) { StringIO.new } let(:files) { %w[/path/to/file1 /path/to/file2] } let(:location) do source_buffer = Parser::Source::Buffer.new('test', 1) source_buffer.so...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/formatter/tap_formatter_spec.rb
spec/rubocop/formatter/tap_formatter_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Formatter::TapFormatter do subject(:formatter) { described_class.new(output) } let(:output) { StringIO.new } let(:files) do %w[lib/rubocop.rb spec/spec_helper.rb exe/rubocop].map do |path| File.expand_path(path) end end describe '#file_fi...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false
rubocop/rubocop
https://github.com/rubocop/rubocop/blob/99fa0fdd0481910d7d052f4c2ed01ad36178f404/spec/rubocop/formatter/pacman_formatter_spec.rb
spec/rubocop/formatter/pacman_formatter_spec.rb
# frozen_string_literal: true RSpec.describe RuboCop::Formatter::PacmanFormatter do subject(:formatter) { described_class.new(output) } let(:output) { StringIO.new } describe '#next_step' do subject(:next_step) { formatter.next_step(offenses) } context 'when no offenses are detected' do let(:off...
ruby
MIT
99fa0fdd0481910d7d052f4c2ed01ad36178f404
2026-01-04T15:37:41.211519Z
false