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
whitequark/ast
https://github.com/whitequark/ast
spec/ast_spec.rb
Ruby
mit
200
master
8,064
require 'helper' RSpec.describe AST::Node do include AST::Sexp class MetaNode < AST::Node attr_reader :meta end class SubclassNode < AST::Node def initialize(*) super nil end end before do @node = AST::Node.new(:node, [ 0, 1 ]) @metanode = MetaNode.new(:node, [ 0, 1 ], :m...
github
whitequark/ast
https://github.com/whitequark/ast
spec/helper.rb
Ruby
mit
200
master
280
require 'simplecov' require 'coveralls' SimpleCov.start do self.formatter = SimpleCov::Formatter::MultiFormatter.new([ SimpleCov::Formatter::HTMLFormatter, Coveralls::SimpleCov::Formatter ]) # Exclude the testsuite itself. add_filter "/test/" end require 'ast'
github
chrislee35/passivedns-client
https://github.com/chrislee35/passivedns-client
passivedns-client.gemspec
Ruby
mit
200
master
1,413
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'passivedns/client/version' Gem::Specification.new do |spec| spec.name = "passivedns-client" spec.version = PassiveDNS::Client::VERSION spec.authors = ["chrislee35"] spec....
github
chrislee35/passivedns-client
https://github.com/chrislee35/passivedns-client
Rakefile
Ruby
mit
200
master
382
#!/usr/bin/env rake require "bundler/gem_tasks" require 'rake/testtask' require 'rdoc/task' Rake::TestTask.new do |t| t.libs << 'lib' t.test_files = FileList['test/test_*.rb'] t.verbose = true end RDoc::Task.new do |rd| rd.main = "README.doc" rd.rdoc_files.include("README.md", "lib/**/*.rb") rd.options << "...
github
chrislee35/passivedns-client
https://github.com/chrislee35/passivedns-client
test/test_passivedns-client.rb
Ruby
mit
200
master
4,637
unless Kernel.respond_to?(:require_relative) module Kernel def require_relative(path) require File.join(File.dirname(caller[0]), path.to_str) end end end require_relative 'helper' require 'configparser' class TestPassiveDnsQuery < Minitest::Test def setup configfile="#{ENV['HOME']}/.passivedn...
github
chrislee35/passivedns-client
https://github.com/chrislee35/passivedns-client
test/test_cli.rb
Ruby
mit
200
master
6,955
unless Kernel.respond_to?(:require_relative) module Kernel def require_relative(path) require File.join(File.dirname(caller[0]), path.to_str) end end end require_relative 'helper' require 'configparser' require_relative '../lib/passivedns/client/cli.rb' class TestCLI < Minitest::Test def test_letter_map ...
github
chrislee35/passivedns-client
https://github.com/chrislee35/passivedns-client
lib/passivedns/client.rb
Ruby
mit
200
master
4,105
require "passivedns/client/version" # DESCRIPTION: queries passive DNS databases # This code is released under the LGPL: http://www.gnu.org/licenses/lgpl-3.0.txt # Please note that use of any passive dns database is subject to the terms of use of that passive dns database. Use of this script in violation of their ter...
github
chrislee35/passivedns-client
https://github.com/chrislee35/passivedns-client
lib/passivedns/client/state.rb
Ruby
mit
200
master
9,689
require 'sqlite3' require 'yaml' require 'structformatter' module PassiveDNS # :nodoc: # struct to hold pending entries for query class PDNSQueueEntry < Struct.new(:query, :state, :level); end # holds state in memory of the queue to be queried, records returned, and the level of recursion class PDNSToolState ...
github
chrislee35/passivedns-client
https://github.com/chrislee35/passivedns-client
lib/passivedns/client/passivedb.rb
Ruby
mit
200
master
835
module PassiveDNS #:nodoc: don't document this # abstract class that all PassiveDNS::Provider should subclass class PassiveDB # raises an exception that this should be implemented by the subclass def self.name raise "You should implement your own version of .name" end # raises an exceptio...
github
chrislee35/passivedns-client
https://github.com/chrislee35/passivedns-client
lib/passivedns/client/cli.rb
Ruby
mit
200
master
10,637
require 'getoptlong' require 'structformatter' require 'getoptlong' require 'yaml' require 'pp' module PassiveDNS # :nodoc: # Handles all the command-line parsing, state tracking, and dispatching queries to the PassiveDNS::Client instance # CLInterface is aliased by CLI class CLInterface # generates a mappi...
github
chrislee35/passivedns-client
https://github.com/chrislee35/passivedns-client
lib/passivedns/client/provider/osc.rb
Ruby
mit
200
master
4,734
# DESCRIPTION: this is a module for Open Source Context's PassiveDNS archive. require 'net/http' require 'net/https' module PassiveDNS #:nodoc: don't document this # The Provider module contains all the Passive DNS provider client code module Provider # Queries OSContext's passive DNS database class OSC < ...
github
chrislee35/passivedns-client
https://github.com/chrislee35/passivedns-client
lib/passivedns/client/provider/riskiq.rb
Ruby
mit
200
master
5,256
# DESCRIPTION: Module to query PassiveTotal's passive DNS repository require 'net/http' require 'net/https' require 'openssl' require 'pp' module PassiveDNS #:nodoc: don't document this # The Provider module contains all the Passive DNS provider client code module Provider # Queries RiskIQ's passive DNS datab...
github
chrislee35/passivedns-client
https://github.com/chrislee35/passivedns-client
lib/passivedns/client/provider/dnsdb.rb
Ruby
mit
200
master
4,635
# DESCRIPTION: this is a module for pdns.rb, primarily used by pdnstool.rb, to query the Farsight Security passive DNS database # details on the API are at https://api.dnsdb.info/ # to request an API key, please email dnsdb-api at farsightsecurity dot com. require 'net/http' require 'net/https' module PassiveDNS #:nod...
github
chrislee35/passivedns-client
https://github.com/chrislee35/passivedns-client
lib/passivedns/client/provider/virustotal.rb
Ruby
mit
200
master
4,396
# DESCRIPTION: this is a module for pdns.rb, primarily used by pdnstool.rb, to query VirusTotal's passive DNS database require 'net/http' require 'net/https' require 'openssl' module PassiveDNS #:nodoc: don't document this # The Provider module contains all the Passive DNS provider client code module Provider ...
github
chrislee35/passivedns-client
https://github.com/chrislee35/passivedns-client
lib/passivedns/client/provider/passivetotal.rb
Ruby
mit
200
master
4,477
# DESCRIPTION: Module to query PassiveTotal's passive DNS repository require 'net/http' require 'net/https' require 'openssl' require 'pp' module PassiveDNS #:nodoc: don't document this # The Provider module contains all the Passive DNS provider client code module Provider # Queries PassiveTotal's passive DNS...
github
chrislee35/passivedns-client
https://github.com/chrislee35/passivedns-client
lib/passivedns/client/provider/circl.rb
Ruby
mit
200
master
4,426
# DESCRIPTION: Module to query PassiveTotal's passive DNS repository require 'net/http' require 'net/https' require 'openssl' module PassiveDNS #:nodoc: don't document this # The Provider module contains all the Passive DNS provider client code module Provider # Queries CIRCL.LU's passive DNS database # C...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
rubocop-sorbet.gemspec
Ruby
mit
200
main
1,362
# frozen_string_literal: true require_relative "lib/rubocop/sorbet/version" Gem::Specification.new do |spec| spec.name = "rubocop-sorbet" spec.version = RuboCop::Sorbet::VERSION spec.authors = ["Ufuk Kayserilioglu", "Alan Wu", "Alexandre Terrasa", "Peter Zhu"] spec.email = ["ruby@...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
Rakefile
Ruby
mit
200
main
2,916
# frozen_string_literal: true require("bundler/gem_tasks") Dir["tasks/**/*.rake"].each { |t| load t } require "rubocop/rake_task" require "rubocop/cop/minitest_generator" require "minitest/test_task" Minitest::TestTask.create(:test) do |test| test.test_globs = FileList["test/**/*_test.rb"] end task(default: [:d...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
Gemfile
Ruby
mit
200
main
289
# frozen_string_literal: true source "https://rubygems.org" # Specify your gem's dependencies in rubocop-sorbet.gemspec gemspec gem "debug" gem "rake", ">= 12.3.3" gem "minitest" gem "rubocop-minitest", ">= 0.38.1" gem "mocha" gem "rubocop-shopify", require: false gem "yard", "~> 0.9"
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop-sorbet.rb
Ruby
mit
200
main
211
# frozen_string_literal: true require "rubocop" require_relative "rubocop/sorbet" require_relative "rubocop/sorbet/version" require_relative "rubocop/sorbet/plugin" require_relative "rubocop/cop/sorbet_cops"
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/sorbet.rb
Ruby
mit
200
main
646
# frozen_string_literal: true require "rubocop" require "rubocop/sorbet/version" require "rubocop/sorbet/plugin" require "pathname" require "yaml" module RuboCop module Sorbet class Error < StandardError; end unless defined?(::RuboCop::Sorbet::Plugin) PROJECT_ROOT = Pathname.new(__dir__).parent.par...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet_cops.rb
Ruby
mit
200
main
3,328
# frozen_string_literal: true require_relative "sorbet/mixin/target_sorbet_version" require_relative "sorbet/mixin/t_enum" require_relative "sorbet/mixin/signature_help" require_relative "sorbet/binding_constant_without_type_alias" require_relative "sorbet/block_method_definition" require_relative "sorbet/constants_f...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/forbid_t_any_with_nil.rb
Ruby
mit
200
main
1,624
# frozen_string_literal: true module RuboCop module Cop module Sorbet # Detect and autocorrect `T.any(..., NilClass, ...)` to `T.nilable(...)` # # @example # # # bad # T.any(String, NilClass) # T.any(NilClass, String) # T.any(NilClass, Symbol, String) ...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/redundant_extend_t_sig.rb
Ruby
mit
200
main
1,360
# frozen_string_literal: true module RuboCop module Cop module Sorbet # Forbids the use of redundant `extend T::Sig`. Only for use in # applications that monkey patch `Module.include(T::Sig)` globally, # which would make it redundant. # # @safety # This cop should not be ena...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/forbid_t_helpers.rb
Ruby
mit
200
main
1,159
# frozen_string_literal: true module RuboCop module Cop module Sorbet # Forbids `extend T::Helpers` and `include T::Helpers` in classes and modules. # # This is useful when using RBS or RBS-inline syntax for type signatures, # where `T::Helpers` is not needed and including it is redundant...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/forbid_t_let.rb
Ruby
mit
200
main
642
# frozen_string_literal: true require "rubocop" module RuboCop module Cop module Sorbet # Disallows using `T.let` anywhere. # # @example # # # bad # T.let(foo, Integer) # # # good # foo #: Integer class ForbidTLet < RuboCop::Cop::Base M...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/obsolete_strict_memoization.rb
Ruby
mit
200
main
3,613
# frozen_string_literal: true require "rubocop" module RuboCop module Cop module Sorbet # Checks for the obsolete pattern for initializing instance variables that was required for older Sorbet # versions in `#typed: strict` files. # # It's no longer required, as of Sorbet 0.5.10210 ...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/forbid_type_aliased_shapes.rb
Ruby
mit
200
main
1,019
# frozen_string_literal: true require "rubocop" module RuboCop module Cop module Sorbet # Disallows defining type aliases that contain shapes # # @example # # # bad # Foo = T.type_alias { { foo: Integer } } # # # good # class Foo # extend T::Sig...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/forbid_t_sig.rb
Ruby
mit
200
main
1,115
# frozen_string_literal: true module RuboCop module Cop module Sorbet # Forbids `extend T::Sig` and `include T::Sig` in classes and modules. # # This is useful when using RBS or RBS-inline syntax for type signatures, # where `T::Sig` is not needed and including it is redundant. # ...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/implicit_conversion_method.rb
Ruby
mit
200
main
1,655
# frozen_string_literal: true require "rubocop" module RuboCop module Cop module Sorbet # Disallows declaring implicit conversion methods. # Since Sorbet is a nominal (not structural) type system, # implicit conversion is currently unsupported. # # @example # # # bad ...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/forbid_t_type_alias.rb
Ruby
mit
200
main
732
# frozen_string_literal: true require "rubocop" module RuboCop module Cop module Sorbet # Disallows using `T.type_alias` anywhere. # # @example # # # bad # STRING_OR_INTEGER = T.type_alias { T.any(Integer, String) } # # # good # #: type string_or_int...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/forbid_t_untyped.rb
Ruby
mit
200
main
759
# frozen_string_literal: true require "rubocop" module RuboCop module Cop module Sorbet # Disallows using `T.untyped` anywhere. # # @example # # # bad # sig { params(my_argument: T.untyped).void } # def foo(my_argument); end # # # good # sig ...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/refinement.rb
Ruby
mit
200
main
1,280
# frozen_string_literal: true module RuboCop module Cop module Sorbet # Checks for the use of Ruby Refinements library. Refinements add # complexity and incur a performance penalty that can be significant # for large code bases. Good examples are cases of unrelated # methods that happen t...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/forbid_t_absurd.rb
Ruby
mit
200
main
655
# frozen_string_literal: true require "rubocop" module RuboCop module Cop module Sorbet # Disallows using `T.absurd` anywhere. # # @example # # # bad # T.absurd(foo) # # # good # x #: absurd class ForbidTAbsurd < RuboCop::Cop::Base MSG ...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/forbid_mixes_in_class_methods.rb
Ruby
mit
200
main
1,208
# frozen_string_literal: true module RuboCop module Cop module Sorbet # Check that code does not call `mixes_in_class_methods` from Sorbet `T::Helpers`. # # Good: # # ``` # module M # extend ActiveSupport::Concern # # class_methods do # ... ...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/forbid_t_bind.rb
Ruby
mit
200
main
656
# frozen_string_literal: true require "rubocop" module RuboCop module Cop module Sorbet # Disallows using `T.bind` anywhere. # # @example # # # bad # T.bind(self, Integer) # # # good # #: self as Integer class ForbidTBind < RuboCop::Cop::Base ...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/binding_constant_without_type_alias.rb
Ruby
mit
200
main
3,025
# frozen_string_literal: true require "rubocop" module RuboCop module Cop module Sorbet # Disallows binding the return value of `T.any`, `T.all`, `T.enum` # to a constant directly. To bind the value, one must use `T.type_alias`. # # @example # # # bad # FooOrBar = T...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/redundant_t_let_for_literal.rb
Ruby
mit
200
main
2,499
# frozen_string_literal: true require "rubocop" module RuboCop module Cop module Sorbet # Checks for redundant `T.let` declarations where the first argument # is a simple literal (not a collection like Array or Hash) and the # second argument is the matching class name. Sorbet can infer the ty...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/forbid_t_cast.rb
Ruby
mit
200
main
654
# frozen_string_literal: true require "rubocop" module RuboCop module Cop module Sorbet # Disallows using `T.cast` anywhere. # # @example # # # bad # T.cast(foo, Integer) # # # good # foo #: as Integer class ForbidTCast < RuboCop::Cop::Base ...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/forbid_untyped_struct_props.rb
Ruby
mit
200
main
1,816
# encoding: utf-8 # frozen_string_literal: true require "rubocop" module RuboCop module Cop module Sorbet # Disallows use of `T.untyped` or `T.nilable(T.untyped)` # as a prop type for `T::Struct` or `T::ImmutableStruct`. # # @example # # # bad # class SomeClass < T:...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/forbid_t_must.rb
Ruby
mit
200
main
640
# frozen_string_literal: true require "rubocop" module RuboCop module Cop module Sorbet # Disallows using `T.must` anywhere. # # @example # # # bad # T.must(foo) # # # good # foo #: as !nil class ForbidTMust < RuboCop::Cop::Base MSG = "...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/redundant_t_let.rb
Ruby
mit
200
main
2,796
# frozen_string_literal: true module RuboCop module Cop module Sorbet # Prevents unnecessary `T.let` in `initialize` methods. When a signature parameter is assigned to an instance variable, the type is inferred automatically. # # @example # # # bad # sig { params(a: Integer)...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/forbid_t_unsafe.rb
Ruby
mit
200
main
647
# frozen_string_literal: true require "rubocop" module RuboCop module Cop module Sorbet # Disallows using `T.unsafe` anywhere. # # @example # # # bad # T.unsafe(foo) # # # good # foo class ForbidTUnsafe < RuboCop::Cop::Base MSG = "Do no...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/mutable_constant_sorbet_aware_behaviour.rb
Ruby
mit
200
main
706
# frozen_string_literal: true require "rubocop/cop/style/mutable_constant" module RuboCop module Cop module Sorbet module MutableConstantSorbetAwareBehaviour class << self def prepended(base) # @!method t_let(node) base.def_node_matcher(:t_let, <<~PATTERN) ...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/forbid_superclass_const_literal.rb
Ruby
mit
200
main
1,151
# encoding: utf-8 # frozen_string_literal: true require "rubocop" module RuboCop module Cop module Sorbet # Correct superclass `send` expressions by constant literals. # # Sorbet, the static checker, is not (yet) able to support constructs on the # following form: # # ```ruby...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/forbid_include_const_literal.rb
Ruby
mit
200
main
1,921
# encoding: utf-8 # frozen_string_literal: true require "rubocop" module RuboCop module Cop module Sorbet # Correct `send` expressions in include statements by constant literals. # # Sorbet, the static checker, is not (yet) able to support constructs on the # following form: # ...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/constants_from_strings.rb
Ruby
mit
200
main
1,486
# frozen_string_literal: true require "rubocop" module RuboCop module Cop module Sorbet # Disallows the calls that are used to get constants fom Strings # such as +constantize+, +const_get+, and +constants+. # # The goal of this cop is to make the code easier to statically analyze, ...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/type_alias_name.rb
Ruby
mit
200
main
941
# frozen_string_literal: true require "rubocop" module RuboCop module Cop module Sorbet # Ensures all constants used as `T.type_alias` are using CamelCase. # # @example # # # bad # FOO_OR_BAR = T.type_alias { T.any(Foo, Bar) } # # # good # FooOrBar =...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/block_method_definition.rb
Ruby
mit
200
main
5,798
# frozen_string_literal: true module RuboCop module Cop module Sorbet # Disallow defining methods in blocks, to prevent running into issues # caused by https://github.com/sorbet/sorbet/issues/3609. # # As a workaround, use `define_method` instead. # # The one exception is for ...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/select_by_is_a.rb
Ruby
mit
200
main
1,886
# frozen_string_literal: true require "rubocop" module RuboCop module Cop module Sorbet # Suggests using `grep` over `select` when using it only for type narrowing. # # @example # # # bad # strings_or_integers.select { |e| e.is_a?(String) } # strings_or_integers.f...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/buggy_obsolete_strict_memoization.rb
Ruby
mit
200
main
3,502
# frozen_string_literal: true require "rubocop" module RuboCop module Cop module Sorbet # Checks for the a mistaken variant of the "obsolete memoization pattern" that used to be required # for older Sorbet versions in `#typed: strict` files. The mistaken variant would overwrite the ivar with `nil` ...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/forbid_t_struct.rb
Ruby
mit
200
main
8,291
# frozen_string_literal: true require "rubocop" module RuboCop module Cop module Sorbet # Disallow using `T::Struct` and `T::Props`. # # @example # # # bad # class MyStruct < T::Struct # const :foo, String # prop :bar, Integer, default: 0 # ...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/forbid_t_enum.rb
Ruby
mit
200
main
809
# frozen_string_literal: true require "rubocop" module RuboCop module Cop module Sorbet # Disallow using `T::Enum`. # # @example # # # bad # class MyEnum < T::Enum # enums do # A = new # B = new # end # end # ...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/callback_conditionals_binding.rb
Ruby
mit
200
main
4,932
# frozen_string_literal: true module RuboCop module Cop module Sorbet # Ensures that callback conditionals are bound to the right type # so that they are type checked properly. # # @safety # Auto-correction is unsafe because other libraries define similar style callbacks as Rails, b...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/mixin/signature_help.rb
Ruby
mit
200
main
1,438
# frozen_string_literal: true module RuboCop module Cop module Sorbet # Mixin for writing cops for signatures, providing a `signature?` node matcher and an `on_signature` trigger. module SignatureHelp extend RuboCop::NodePattern::Macros # @!method signature?(node) def_node_ma...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/mixin/target_sorbet_version.rb
Ruby
mit
200
main
1,805
# frozen_string_literal: true module RuboCop module Cop module Sorbet module TargetSorbetVersion class << self def included(target) target.extend(ClassMethods) end end module ClassMethods # Sets the version of the Sorbet static type checker...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/mixin/t_enum.rb
Ruby
mit
200
main
688
# frozen_string_literal: true module RuboCop module Cop module Sorbet # Mixing for writing cops that deal with `T::Enum`s module TEnum extend RuboCop::NodePattern::Macros def initialize(*) @scopes = [] super end # @!method t_enum?(node) def...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/signatures/forbid_sig.rb
Ruby
mit
200
main
575
# frozen_string_literal: true require "stringio" module RuboCop module Cop module Sorbet # Check that definitions do not use a `sig` block. # # Good: # # ``` # #: -> void # def foo; end # ``` # # Bad: # # ``` # sig { void } # de...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb
Ruby
mit
200
main
9,370
# frozen_string_literal: true module RuboCop module Cop module Sorbet # Checks that every method definition and attribute accessor has a Sorbet signature. # # It also suggest an autocorrect with placeholders so the following code: # # ``` # def foo(a, b, c); end # ``` ...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/signatures/forbid_sig_without_runtime.rb
Ruby
mit
200
main
877
# frozen_string_literal: true require "stringio" module RuboCop module Cop module Sorbet # Check that `sig` is used instead of `T::Sig::WithoutRuntime.sig`. # # Good: # # ``` # sig { void } # def foo; end # ``` # # Bad: # # ``` # T::S...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/signatures/checked_true_in_signature.rb
Ruby
mit
200
main
1,775
# frozen_string_literal: true module RuboCop module Cop module Sorbet # Disallows the usage of `checked(true)`. This usage could cause # confusion; it could lead some people to believe that a method would be checked # even if runtime checks have not been enabled on the class or globally. ...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/signatures/capitalized_type_parameters.rb
Ruby
mit
200
main
1,880
# frozen_string_literal: true module RuboCop module Cop module Sorbet # Ensure type parameters used in generic methods are always capitalized. # # @example # # # bad # sig { type_parameters(:x).params(a: T.type_parameter(:x)).void } # def foo(a); end # ...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/signatures/keyword_argument_ordering.rb
Ruby
mit
200
main
1,466
# frozen_string_literal: true module RuboCop module Cop module Sorbet # Checks for the ordering of keyword arguments required by # sorbet-runtime. The ordering requires that all keyword arguments # are at the end of the parameters list, and all keyword arguments # with a default value mus...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/signatures/forbid_sig_with_runtime.rb
Ruby
mit
200
main
605
# frozen_string_literal: true require "stringio" module RuboCop module Cop module Sorbet # Check that definitions do not use a `sig` block. # # Good: # # ``` # #: -> void # def foo; end # ``` # # Bad: # # ``` # T::Sig.sig { void } ...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/signatures/empty_line_after_sig.rb
Ruby
mit
200
main
2,729
# frozen_string_literal: true module RuboCop module Cop module Sorbet # Checks for blank lines after signatures. # # @example # # bad # sig { void } # # def foo; end # # # good # sig { void } # def foo; end class EmptyLineAfterSi...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/signatures/allow_incompatible_override.rb
Ruby
mit
200
main
2,180
# frozen_string_literal: true require "rubocop" module RuboCop module Cop module Sorbet # Disallows using `.override(allow_incompatible: true)`. # Using `allow_incompatible` suggests a violation of the Liskov # Substitution Principle, meaning that a subclass is not a valid # subtype of i...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/signatures/void_checked_tests.rb
Ruby
mit
200
main
3,164
# frozen_string_literal: true module RuboCop module Cop module Sorbet # Disallows the usage of `.void.checked(:tests)`. # # Using `.void` changes the value returned from the method, but only if # runtime type checking is enabled for the method. Methods marked `.void` # will return d...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/signatures/signature_build_order.rb
Ruby
mit
200
main
3,291
# frozen_string_literal: true module RuboCop module Cop module Sorbet # Checks for the correct order of `sig` builder methods. # # Options: # # * `Order`: The order in which to enforce the builder methods are called. # # @example # # bad # sig { void.abst...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/signatures/runtime_on_failure_depends_on_checked.rb
Ruby
mit
200
main
1,359
# frozen_string_literal: true module RuboCop module Cop module Sorbet # Checks that `on_failure` is not used without `checked(:tests)` or `checked(:always)`. # # @example # # # bad # sig { params(x: Integer).returns(Integer).on_failure(:raise) } # def plus_one(x) ...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/rbi/forbid_extend_t_sig_helpers_in_shims.rb
Ruby
mit
200
main
1,241
# frozen_string_literal: true module RuboCop module Cop module Sorbet # Ensures RBI shims do not include a call to extend T::Sig # or to extend T::Helpers # # @example # # # bad # module SomeModule # extend T::Sig # extend T::Helpers # ...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/rbi/forbid_rbi_outside_of_allowed_paths.rb
Ruby
mit
200
main
1,600
# frozen_string_literal: true require "pathname" module RuboCop module Cop module Sorbet # Makes sure that RBI files are always located under the defined allowed paths. # # Options: # # * `AllowedPaths`: A list of the paths where RBI files are allowed (default: ["rbi/**", "sorbet/r...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/rbi/single_line_rbi_class_module_definitions.rb
Ruby
mit
200
main
1,002
# frozen_string_literal: true module RuboCop module Cop module Sorbet # Ensures empty class/module definitions in RBI files are # done on a single line rather than being split across multiple lines. # # @example # # # bad # module SomeModule # end # ...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/t_enum/multiple_t_enum_values.rb
Ruby
mit
200
main
1,486
# frozen_string_literal: true module RuboCop module Cop module Sorbet # Disallow creating a `T::Enum` with less than two values. # # @example # # # bad # class ErrorMessages < T::Enum # enums do # ServerError = new("There was a server error.") # ...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/t_enum/forbid_comparable_t_enum.rb
Ruby
mit
200
main
1,075
# frozen_string_literal: true module RuboCop module Cop module Sorbet # Disallow including the `Comparable` module in `T::Enum`. # # @example # # # bad # class Priority < T::Enum # include Comparable # # enums do # High = new(3) # ...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/sigils/valid_sigil.rb
Ruby
mit
200
main
7,372
# frozen_string_literal: true require "rubocop" module RuboCop module Cop module Sorbet # Checks that every Ruby file contains a valid Sorbet sigil. # Adapted from: https://gist.github.com/clarkdave/85aca4e16f33fd52aceb6a0a29936e52 # # Options: # # * `RequireSigilOnAllFiles`:...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/sigils/enforce_sigil_order.rb
Ruby
mit
200
main
3,725
# frozen_string_literal: true require "rubocop" module RuboCop module Cop module Sorbet # Checks that the Sorbet sigil comes as the first magic comment in the file, after the encoding comment if any. # # The expected order for magic comments is: (en)?coding, typed, warn_indent then frozen_stri...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/sigils/true_sigil.rb
Ruby
mit
200
main
308
# frozen_string_literal: true require "rubocop" require_relative "has_sigil" module RuboCop module Cop module Sorbet # Makes the Sorbet `true` sigil mandatory in all files. class TrueSigil < HasSigil def minimum_strictness "true" end end end end end
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/sigils/false_sigil.rb
Ruby
mit
200
main
311
# frozen_string_literal: true require "rubocop" require_relative "has_sigil" module RuboCop module Cop module Sorbet # Makes the Sorbet `false` sigil mandatory in all files. class FalseSigil < HasSigil def minimum_strictness "false" end end end end end
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/sigils/has_sigil.rb
Ruby
mit
200
main
763
# frozen_string_literal: true require "rubocop" require_relative "valid_sigil" module RuboCop module Cop module Sorbet # Makes the Sorbet typed sigil mandatory in all files. # # Options: # # * `SuggestedStrictness`: Sorbet strictness level suggested in offense messages (default: 'f...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/sigils/strict_sigil.rb
Ruby
mit
200
main
604
# frozen_string_literal: true require "rubocop" require_relative "has_sigil" module RuboCop module Cop module Sorbet # Makes the Sorbet `strict` sigil mandatory in all files. # # @safety # This cop is unsafe because Sorbet sigils may not exist yet when it is run. # # @examp...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/sigils/strong_sigil.rb
Ruby
mit
200
main
314
# frozen_string_literal: true require "rubocop" require_relative "has_sigil" module RuboCop module Cop module Sorbet # Makes the Sorbet `strong` sigil mandatory in all files. class StrongSigil < HasSigil def minimum_strictness "strong" end end end end end
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/sigils/enforce_single_sigil.rb
Ruby
mit
200
main
1,744
# frozen_string_literal: true module RuboCop module Cop module Sorbet # Checks that there is only one Sorbet sigil in a given file # # For example, the following class with two sigils # # ```ruby # # typed: true # # typed: true # # frozen_string_literal: true ...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/sigils/ignore_sigil.rb
Ruby
mit
200
main
314
# frozen_string_literal: true require "rubocop" require_relative "has_sigil" module RuboCop module Cop module Sorbet # Makes the Sorbet `ignore` sigil mandatory in all files. class IgnoreSigil < HasSigil def minimum_strictness "ignore" end end end end end
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/rbi_versioning/valid_gem_version_annotations.rb
Ruby
mit
200
main
1,689
# frozen_string_literal: true module RuboCop module Cop module Sorbet # Checks that gem versions in RBI annotations are properly formatted per the Bundler gem specification. # # @example # # bad # # @version > not a version number # # # good # # @version = ...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/cop/sorbet/rbi_versioning/gem_version_annotation_helper.rb
Ruby
mit
200
main
599
# frozen_string_literal: true module RuboCop module Cop module Sorbet module GemVersionAnnotationHelper VERSION_PREFIX = "# @version" def gem_version_annotations processed_source.comments.select do |comment| gem_version_annotation?(comment) end end ...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
lib/rubocop/sorbet/plugin.rb
Ruby
mit
200
main
892
# frozen_string_literal: true require "rubocop" require "lint_roller" require "pathname" module RuboCop module Sorbet # A plugin that integrates RuboCop Sorbet with RuboCop's plugin system. class Plugin < LintRoller::Plugin def about LintRoller::About.new( name: "rubocop-sorbet", ...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
test/test_helper.rb
Ruby
mit
200
main
876
# frozen_string_literal: true require "minitest/autorun" require "rubocop-sorbet" require "debug/prelude" require "rubocop/minitest/support" require "mocha/minitest" module Minitest class Test private def cop_config(config = {}) cop_config = RuboCop::ConfigLoader .default_configuration.for_co...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
test/project_test.rb
Ruby
mit
200
main
1,379
# frozen_string_literal: true require "test_helper" require "pathname" class ProjectTest < Minitest::Test RBI_ONLY_COPS = [ "Sorbet/ValidGemVersionAnnotations", ] def test_no_rogue_rubocop_comments root_directory = Pathname.new(File.expand_path("..", __dir__)) Dir.glob(File.join(root_directory, "m...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
test/rubocop/cop/sorbet/forbid_t_helpers_test.rb
Ruby
mit
200
main
1,940
# frozen_string_literal: true require "test_helper" module RuboCop module Cop module Sorbet class ForbidTHelpersTest < ::Minitest::Test def setup @cop = ForbidTHelpers.new end def test_adds_offense_when_extending_t_helpers assert_offense(<<~RUBY) cl...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
test/rubocop/cop/sorbet/forbid_t_sig_test.rb
Ruby
mit
200
main
1,856
# frozen_string_literal: true require "test_helper" module RuboCop module Cop module Sorbet class ForbidTSigTest < ::Minitest::Test def setup @cop = ForbidTSig.new end def test_adds_offense_when_extending_t_sig assert_offense(<<~RUBY) class Example ...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
test/rubocop/cop/sorbet/select_by_is_a_test.rb
Ruby
mit
200
main
6,148
# frozen_string_literal: true require "test_helper" module RuboCop module Cop module Sorbet class SelectByIsATest < ::Minitest::Test MSG = "Use `grep` instead of `select` when using it only for type narrowing." def setup @old_parser_engine = ENV["PARSER_ENGINE"] ENV["P...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
test/rubocop/cop/sorbet/callback_conditionals_binding_test.rb
Ruby
mit
200
main
15,617
# frozen_string_literal: true require "test_helper" module RuboCop module Cop module Sorbet class CallbackConditionalsBindingTest < ::Minitest::Test MSG = "Sorbet/CallbackConditionalsBinding: Callback conditionals should be bound to the right type. Use T.bind(self, Post)" def setup ...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
test/rubocop/cop/sorbet/forbid_t_type_alias_test.rb
Ruby
mit
200
main
552
# frozen_string_literal: true require "test_helper" module RuboCop module Cop module Sorbet class ForbidTTypeAliasTest < ::Minitest::Test MSG = "Sorbet/ForbidTTypeAlias: Do not use `T.type_alias`." def setup @cop = ForbidTTypeAlias.new end def test_adds_offense_...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
test/rubocop/cop/sorbet/forbid_t_must_test.rb
Ruby
mit
200
main
525
# frozen_string_literal: true require "test_helper" module RuboCop module Cop module Sorbet class ForbidTMustTest < ::Minitest::Test MSG = "Sorbet/ForbidTMust: Do not use `T.must`." def setup @cop = ForbidTMust.new end def test_adds_offense_when_using_t_must ...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
test/rubocop/cop/sorbet/redundant_extend_t_sig_test.rb
Ruby
mit
200
main
3,745
# frozen_string_literal: true require "test_helper" module RuboCop module Cop module Sorbet class RedundantExtendTSigTest < ::Minitest::Test MSG = "Sorbet/RedundantExtendTSig: Do not redundantly `extend T::Sig` when it is already included in all modules." def setup @cop = Redund...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
test/rubocop/cop/sorbet/block_method_definition_test.rb
Ruby
mit
200
main
10,748
# frozen_string_literal: true require "test_helper" module RuboCop module Cop module Sorbet class BlockMethodDefinitionTest < ::Minitest::Test def setup @cop = BlockMethodDefinition.new end def test_registers_an_offense_when_defining_a_method_in_a_block assert_...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
test/rubocop/cop/sorbet/redundant_t_let_for_literal_test.rb
Ruby
mit
200
main
8,281
# frozen_string_literal: true require "test_helper" module RuboCop module Cop module Sorbet class RedundantTLetForLiteralTest < ::Minitest::Test MSG = "Sorbet/RedundantTLetForLiteral: Redundant `T.let` for %{type} literal. " \ "Sorbet can infer this type automatically." def setu...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
test/rubocop/cop/sorbet/type_alias_name_test.rb
Ruby
mit
200
main
1,740
# frozen_string_literal: true require "test_helper" module RuboCop module Cop module Sorbet class TypeAliasNameTest < ::Minitest::Test MSG = "Sorbet/TypeAliasName: Type alias constant name should be in CamelCase" def setup @cop = TypeAliasName.new end def test_d...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
test/rubocop/cop/sorbet/forbid_t_enum_test.rb
Ruby
mit
200
main
1,588
# frozen_string_literal: true require "test_helper" module RuboCop module Cop module Sorbet class ForbidTEnumTest < ::Minitest::Test MSG = "Sorbet/ForbidTEnum: Using `T::Enum` is deprecated in this codebase." def setup @cop = ForbidTEnum.new end def test_registe...
github
Shopify/rubocop-sorbet
https://github.com/Shopify/rubocop-sorbet
test/rubocop/cop/sorbet/binding_constant_without_type_alias_test.rb
Ruby
mit
200
main
6,462
# frozen_string_literal: true require "test_helper" module RuboCop module Cop module Sorbet class BindingConstantWithoutTypeAliasTest < ::Minitest::Test MSG = "Sorbet/BindingConstantWithoutTypeAlias: It looks like you're trying to bind a type to a constant. To do this, you must alias the type usin...