Merge pull request #11495 from Homebrew/dependabot/bundler/Library/Homebrew/rubocop-sorbet-0.6.2
build(deps): bump rubocop-sorbet from 0.6.1 to 0.6.2 in /Library/Homebrew
This commit is contained in:
commit
9f4874d11f
@ -130,7 +130,7 @@ GEM
|
|||||||
rubocop-rspec (2.3.0)
|
rubocop-rspec (2.3.0)
|
||||||
rubocop (~> 1.0)
|
rubocop (~> 1.0)
|
||||||
rubocop-ast (>= 1.1.0)
|
rubocop-ast (>= 1.1.0)
|
||||||
rubocop-sorbet (0.6.1)
|
rubocop-sorbet (0.6.2)
|
||||||
rubocop
|
rubocop
|
||||||
ruby-macho (2.5.1)
|
ruby-macho (2.5.1)
|
||||||
ruby-progressbar (1.11.0)
|
ruby-progressbar (1.11.0)
|
||||||
|
|||||||
@ -1,17 +1,12 @@
|
|||||||
# DO NOT EDIT MANUALLY
|
# DO NOT EDIT MANUALLY
|
||||||
# This is an autogenerated file for types exported from the `rubocop-sorbet` gem.
|
# This is an autogenerated file for types exported from the `rubocop-sorbet` gem.
|
||||||
# Please instead update this file by running `tapioca sync`.
|
# Please instead update this file by running `bin/tapioca sync`.
|
||||||
|
|
||||||
# typed: true
|
# typed: true
|
||||||
|
|
||||||
module RuboCop
|
module RuboCop; end
|
||||||
end
|
module RuboCop::Cop; end
|
||||||
|
module RuboCop::Cop::Sorbet; end
|
||||||
module RuboCop::Cop
|
|
||||||
end
|
|
||||||
|
|
||||||
module RuboCop::Cop::Sorbet
|
|
||||||
end
|
|
||||||
|
|
||||||
class RuboCop::Cop::Sorbet::AllowIncompatibleOverride < ::RuboCop::Cop::Cop
|
class RuboCop::Cop::Sorbet::AllowIncompatibleOverride < ::RuboCop::Cop::Cop
|
||||||
def allow_incompatible?(param0); end
|
def allow_incompatible?(param0); end
|
||||||
@ -37,20 +32,29 @@ class RuboCop::Cop::Sorbet::BindingConstantWithoutTypeAlias < ::RuboCop::Cop::Co
|
|||||||
def using_type_alias?(param0 = T.unsafe(nil)); end
|
def using_type_alias?(param0 = T.unsafe(nil)); end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class RuboCop::Cop::Sorbet::CallbackConditionalsBinding < ::RuboCop::Cop::Cop
|
||||||
|
def autocorrect(node); end
|
||||||
|
def on_send(node); end
|
||||||
|
end
|
||||||
|
|
||||||
|
RuboCop::Cop::Sorbet::CallbackConditionalsBinding::CALLBACKS = T.let(T.unsafe(nil), Array)
|
||||||
|
|
||||||
class RuboCop::Cop::Sorbet::CheckedTrueInSignature < ::RuboCop::Cop::Sorbet::SignatureCop
|
class RuboCop::Cop::Sorbet::CheckedTrueInSignature < ::RuboCop::Cop::Sorbet::SignatureCop
|
||||||
include(::RuboCop::Cop::RangeHelp)
|
include ::RuboCop::Cop::RangeHelp
|
||||||
|
|
||||||
def offending_node(param0); end
|
def offending_node(param0); end
|
||||||
def on_signature(node); end
|
def on_signature(node); end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
RuboCop::Cop::Sorbet::CheckedTrueInSignature::MESSAGE = T.let(T.unsafe(nil), String)
|
||||||
|
|
||||||
class RuboCop::Cop::Sorbet::ConstantsFromStrings < ::RuboCop::Cop::Cop
|
class RuboCop::Cop::Sorbet::ConstantsFromStrings < ::RuboCop::Cop::Cop
|
||||||
def constant_from_string?(param0 = T.unsafe(nil)); end
|
def constant_from_string?(param0 = T.unsafe(nil)); end
|
||||||
def on_send(node); end
|
def on_send(node); end
|
||||||
end
|
end
|
||||||
|
|
||||||
class RuboCop::Cop::Sorbet::EnforceSigilOrder < ::RuboCop::Cop::Sorbet::ValidSigil
|
class RuboCop::Cop::Sorbet::EnforceSigilOrder < ::RuboCop::Cop::Sorbet::ValidSigil
|
||||||
include(::RuboCop::Cop::RangeHelp)
|
include ::RuboCop::Cop::RangeHelp
|
||||||
|
|
||||||
def autocorrect(_node); end
|
def autocorrect(_node); end
|
||||||
def investigate(processed_source); end
|
def investigate(processed_source); end
|
||||||
@ -62,13 +66,9 @@ class RuboCop::Cop::Sorbet::EnforceSigilOrder < ::RuboCop::Cop::Sorbet::ValidSig
|
|||||||
end
|
end
|
||||||
|
|
||||||
RuboCop::Cop::Sorbet::EnforceSigilOrder::CODING_REGEX = T.let(T.unsafe(nil), Regexp)
|
RuboCop::Cop::Sorbet::EnforceSigilOrder::CODING_REGEX = T.let(T.unsafe(nil), Regexp)
|
||||||
|
|
||||||
RuboCop::Cop::Sorbet::EnforceSigilOrder::FROZEN_REGEX = T.let(T.unsafe(nil), Regexp)
|
RuboCop::Cop::Sorbet::EnforceSigilOrder::FROZEN_REGEX = T.let(T.unsafe(nil), Regexp)
|
||||||
|
|
||||||
RuboCop::Cop::Sorbet::EnforceSigilOrder::INDENT_REGEX = T.let(T.unsafe(nil), Regexp)
|
RuboCop::Cop::Sorbet::EnforceSigilOrder::INDENT_REGEX = T.let(T.unsafe(nil), Regexp)
|
||||||
|
|
||||||
RuboCop::Cop::Sorbet::EnforceSigilOrder::MAGIC_REGEX = T.let(T.unsafe(nil), Regexp)
|
RuboCop::Cop::Sorbet::EnforceSigilOrder::MAGIC_REGEX = T.let(T.unsafe(nil), Regexp)
|
||||||
|
|
||||||
RuboCop::Cop::Sorbet::EnforceSigilOrder::PREFERRED_ORDER = T.let(T.unsafe(nil), Hash)
|
RuboCop::Cop::Sorbet::EnforceSigilOrder::PREFERRED_ORDER = T.let(T.unsafe(nil), Hash)
|
||||||
|
|
||||||
class RuboCop::Cop::Sorbet::EnforceSignatures < ::RuboCop::Cop::Sorbet::SignatureCop
|
class RuboCop::Cop::Sorbet::EnforceSignatures < ::RuboCop::Cop::Sorbet::SignatureCop
|
||||||
@ -109,7 +109,7 @@ class RuboCop::Cop::Sorbet::FalseSigil < ::RuboCop::Cop::Sorbet::HasSigil
|
|||||||
end
|
end
|
||||||
|
|
||||||
class RuboCop::Cop::Sorbet::ForbidExtendTSigHelpersInShims < ::RuboCop::Cop::Cop
|
class RuboCop::Cop::Sorbet::ForbidExtendTSigHelpersInShims < ::RuboCop::Cop::Cop
|
||||||
include(::RuboCop::Cop::RangeHelp)
|
include ::RuboCop::Cop::RangeHelp
|
||||||
|
|
||||||
def autocorrect(node); end
|
def autocorrect(node); end
|
||||||
def extend_t_helpers?(param0 = T.unsafe(nil)); end
|
def extend_t_helpers?(param0 = T.unsafe(nil)); end
|
||||||
@ -118,7 +118,6 @@ class RuboCop::Cop::Sorbet::ForbidExtendTSigHelpersInShims < ::RuboCop::Cop::Cop
|
|||||||
end
|
end
|
||||||
|
|
||||||
RuboCop::Cop::Sorbet::ForbidExtendTSigHelpersInShims::MSG = T.let(T.unsafe(nil), String)
|
RuboCop::Cop::Sorbet::ForbidExtendTSigHelpersInShims::MSG = T.let(T.unsafe(nil), String)
|
||||||
|
|
||||||
RuboCop::Cop::Sorbet::ForbidExtendTSigHelpersInShims::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
RuboCop::Cop::Sorbet::ForbidExtendTSigHelpersInShims::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
||||||
|
|
||||||
class RuboCop::Cop::Sorbet::ForbidIncludeConstLiteral < ::RuboCop::Cop::Cop
|
class RuboCop::Cop::Sorbet::ForbidIncludeConstLiteral < ::RuboCop::Cop::Cop
|
||||||
@ -132,6 +131,14 @@ end
|
|||||||
|
|
||||||
RuboCop::Cop::Sorbet::ForbidIncludeConstLiteral::MSG = T.let(T.unsafe(nil), String)
|
RuboCop::Cop::Sorbet::ForbidIncludeConstLiteral::MSG = T.let(T.unsafe(nil), String)
|
||||||
|
|
||||||
|
class RuboCop::Cop::Sorbet::ForbidRBIOutsideOfSorbetDir < ::RuboCop::Cop::Cop
|
||||||
|
include ::RuboCop::Cop::RangeHelp
|
||||||
|
|
||||||
|
def investigate(processed_source); end
|
||||||
|
end
|
||||||
|
|
||||||
|
RuboCop::Cop::Sorbet::ForbidRBIOutsideOfSorbetDir::PATH_REGEXP = T.let(T.unsafe(nil), Regexp)
|
||||||
|
|
||||||
class RuboCop::Cop::Sorbet::ForbidSuperclassConstLiteral < ::RuboCop::Cop::Cop
|
class RuboCop::Cop::Sorbet::ForbidSuperclassConstLiteral < ::RuboCop::Cop::Cop
|
||||||
def not_lit_const_superclass?(param0 = T.unsafe(nil)); end
|
def not_lit_const_superclass?(param0 = T.unsafe(nil)); end
|
||||||
def on_class(node); end
|
def on_class(node); end
|
||||||
@ -139,6 +146,11 @@ end
|
|||||||
|
|
||||||
RuboCop::Cop::Sorbet::ForbidSuperclassConstLiteral::MSG = T.let(T.unsafe(nil), String)
|
RuboCop::Cop::Sorbet::ForbidSuperclassConstLiteral::MSG = T.let(T.unsafe(nil), String)
|
||||||
|
|
||||||
|
class RuboCop::Cop::Sorbet::ForbidTUnsafe < ::RuboCop::Cop::Cop
|
||||||
|
def on_send(node); end
|
||||||
|
def t_unsafe?(param0 = T.unsafe(nil)); end
|
||||||
|
end
|
||||||
|
|
||||||
class RuboCop::Cop::Sorbet::ForbidUntypedStructProps < ::RuboCop::Cop::Cop
|
class RuboCop::Cop::Sorbet::ForbidUntypedStructProps < ::RuboCop::Cop::Cop
|
||||||
def on_class(node); end
|
def on_class(node); end
|
||||||
def subclass_of_t_struct?(param0 = T.unsafe(nil)); end
|
def subclass_of_t_struct?(param0 = T.unsafe(nil)); end
|
||||||
@ -204,6 +216,7 @@ class RuboCop::Cop::Sorbet::SignatureBuildOrder < ::RuboCop::Cop::Sorbet::Signat
|
|||||||
def node_reparsed_with_modern_features(node); end
|
def node_reparsed_with_modern_features(node); end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class RuboCop::Cop::Sorbet::SignatureBuildOrder::ModernBuilder < ::RuboCop::AST::Builder; end
|
||||||
RuboCop::Cop::Sorbet::SignatureBuildOrder::ORDER = T.let(T.unsafe(nil), Hash)
|
RuboCop::Cop::Sorbet::SignatureBuildOrder::ORDER = T.let(T.unsafe(nil), Hash)
|
||||||
|
|
||||||
class RuboCop::Cop::Sorbet::SignatureCop < ::RuboCop::Cop::Cop
|
class RuboCop::Cop::Sorbet::SignatureCop < ::RuboCop::Cop::Cop
|
||||||
@ -256,20 +269,13 @@ class RuboCop::Cop::Sorbet::ValidSigil < ::RuboCop::Cop::Cop
|
|||||||
end
|
end
|
||||||
|
|
||||||
RuboCop::Cop::Sorbet::ValidSigil::SIGIL_REGEX = T.let(T.unsafe(nil), Regexp)
|
RuboCop::Cop::Sorbet::ValidSigil::SIGIL_REGEX = T.let(T.unsafe(nil), Regexp)
|
||||||
|
|
||||||
RuboCop::Cop::Sorbet::ValidSigil::STRICTNESS_LEVELS = T.let(T.unsafe(nil), Array)
|
RuboCop::Cop::Sorbet::ValidSigil::STRICTNESS_LEVELS = T.let(T.unsafe(nil), Array)
|
||||||
|
|
||||||
RuboCop::NodePattern = RuboCop::AST::NodePattern
|
RuboCop::NodePattern = RuboCop::AST::NodePattern
|
||||||
|
|
||||||
RuboCop::ProcessedSource = RuboCop::AST::ProcessedSource
|
RuboCop::ProcessedSource = RuboCop::AST::ProcessedSource
|
||||||
|
module RuboCop::Sorbet; end
|
||||||
module RuboCop::Sorbet
|
|
||||||
end
|
|
||||||
|
|
||||||
RuboCop::Sorbet::CONFIG = T.let(T.unsafe(nil), Hash)
|
RuboCop::Sorbet::CONFIG = T.let(T.unsafe(nil), Hash)
|
||||||
|
RuboCop::Sorbet::CONFIG_DEFAULT = T.let(T.unsafe(nil), Pathname)
|
||||||
class RuboCop::Sorbet::Error < ::StandardError
|
class RuboCop::Sorbet::Error < ::StandardError; end
|
||||||
end
|
|
||||||
|
|
||||||
module RuboCop::Sorbet::Inject
|
module RuboCop::Sorbet::Inject
|
||||||
class << self
|
class << self
|
||||||
@ -277,6 +283,6 @@ module RuboCop::Sorbet::Inject
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
RuboCop::Sorbet::PROJECT_ROOT = T.let(T.unsafe(nil), Pathname)
|
||||||
RuboCop::Sorbet::VERSION = T.let(T.unsafe(nil), String)
|
RuboCop::Sorbet::VERSION = T.let(T.unsafe(nil), String)
|
||||||
|
|
||||||
RuboCop::Token = RuboCop::AST::Token
|
RuboCop::Token = RuboCop::AST::Token
|
||||||
@ -83,7 +83,7 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-1.16.0/lib"
|
|||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.11.3/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.11.3/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rails-2.10.1/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rails-2.10.1/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-2.3.0/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-2.3.0/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-sorbet-0.6.1/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-sorbet-0.6.2/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-macho-2.5.1/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-macho-2.5.1/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/simplecov-html-0.12.3/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/simplecov-html-0.12.3/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/simplecov_json_formatter-0.1.2/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/simplecov_json_formatter-0.1.2/lib"
|
||||||
|
|||||||
@ -14,6 +14,11 @@ Sorbet/BindingConstantWithoutTypeAlias:
|
|||||||
Enabled: true
|
Enabled: true
|
||||||
VersionAdded: 0.2.0
|
VersionAdded: 0.2.0
|
||||||
|
|
||||||
|
Sorbet/CallbackConditionalsBinding:
|
||||||
|
Description: 'Ensures callback conditionals are bound to the right type.'
|
||||||
|
Enabled: true
|
||||||
|
VersionAdded: 0.7.0
|
||||||
|
|
||||||
Sorbet/CheckedTrueInSignature:
|
Sorbet/CheckedTrueInSignature:
|
||||||
Description: 'Disallows the usage of `checked(true)` in signatures.'
|
Description: 'Disallows the usage of `checked(true)` in signatures.'
|
||||||
Enabled: true
|
Enabled: true
|
||||||
@ -42,7 +47,7 @@ Sorbet/FalseSigil:
|
|||||||
Description: 'All files must be at least at strictness `false`.'
|
Description: 'All files must be at least at strictness `false`.'
|
||||||
Enabled: true
|
Enabled: true
|
||||||
VersionAdded: 0.3.3
|
VersionAdded: 0.3.3
|
||||||
SuggestedStrictness: true
|
SuggestedStrictness: "false"
|
||||||
Include:
|
Include:
|
||||||
- "**/*.rb"
|
- "**/*.rb"
|
||||||
- "**/*.rbi"
|
- "**/*.rbi"
|
||||||
@ -60,6 +65,13 @@ Sorbet/ForbidExtendTSigHelpersInShims:
|
|||||||
Include:
|
Include:
|
||||||
- "**/*.rbi"
|
- "**/*.rbi"
|
||||||
|
|
||||||
|
Sorbet/ForbidRBIOutsideOfSorbetDir:
|
||||||
|
Description: 'Forbids RBI files outside of the sorbet/ directory.'
|
||||||
|
Enabled: true
|
||||||
|
VersionAdded: 0.6.1
|
||||||
|
Include:
|
||||||
|
- "**/*.rbi"
|
||||||
|
|
||||||
Sorbet/ForbidIncludeConstLiteral:
|
Sorbet/ForbidIncludeConstLiteral:
|
||||||
Description: 'Forbids include of non-literal constants.'
|
Description: 'Forbids include of non-literal constants.'
|
||||||
Enabled: false
|
Enabled: false
|
||||||
@ -74,6 +86,12 @@ Sorbet/ForbidSuperclassConstLiteral:
|
|||||||
Exclude:
|
Exclude:
|
||||||
- db/migrate/*.rb
|
- db/migrate/*.rb
|
||||||
|
|
||||||
|
Sorbet/ForbidTUnsafe:
|
||||||
|
Description: 'Forbid usage of T.unsafe.'
|
||||||
|
Enabled: false
|
||||||
|
VersionAdded: 0.7.0
|
||||||
|
VersionChanged: 0.7.0
|
||||||
|
|
||||||
Sorbet/ForbidUntypedStructProps:
|
Sorbet/ForbidUntypedStructProps:
|
||||||
Description: >-
|
Description: >-
|
||||||
Disallows use of `T.untyped` or `T.nilable(T.untyped)` as a
|
Disallows use of `T.untyped` or `T.nilable(T.untyped)` as a
|
||||||
@ -84,11 +102,14 @@ Sorbet/ForbidUntypedStructProps:
|
|||||||
Sorbet/HasSigil:
|
Sorbet/HasSigil:
|
||||||
Description: 'Makes the Sorbet typed sigil mandatory in all files.'
|
Description: 'Makes the Sorbet typed sigil mandatory in all files.'
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
SuggestedStrictness: "false"
|
||||||
|
MinimumStrictness: "false"
|
||||||
VersionAdded: 0.3.3
|
VersionAdded: 0.3.3
|
||||||
|
|
||||||
Sorbet/IgnoreSigil:
|
Sorbet/IgnoreSigil:
|
||||||
Description: 'All files must be at least at strictness `ignore`.'
|
Description: 'All files must be at least at strictness `ignore`.'
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
SuggestedStrictness: "ignore"
|
||||||
VersionAdded: 0.3.3
|
VersionAdded: 0.3.3
|
||||||
|
|
||||||
Sorbet/KeywordArgumentOrdering:
|
Sorbet/KeywordArgumentOrdering:
|
||||||
@ -131,19 +152,25 @@ Sorbet/SingleLineRbiClassModuleDefinitions:
|
|||||||
Sorbet/StrictSigil:
|
Sorbet/StrictSigil:
|
||||||
Description: 'All files must be at least at strictness `strict`.'
|
Description: 'All files must be at least at strictness `strict`.'
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
SuggestedStrictness: "strict"
|
||||||
VersionAdded: 0.3.3
|
VersionAdded: 0.3.3
|
||||||
|
|
||||||
Sorbet/StrongSigil:
|
Sorbet/StrongSigil:
|
||||||
Description: 'All files must be at least at strictness `strong`.'
|
Description: 'All files must be at least at strictness `strong`.'
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
SuggestedStrictness: "strong"
|
||||||
VersionAdded: 0.3.3
|
VersionAdded: 0.3.3
|
||||||
|
|
||||||
Sorbet/TrueSigil:
|
Sorbet/TrueSigil:
|
||||||
Description: 'All files must be at least at strictness `true`.'
|
Description: 'All files must be at least at strictness `true`.'
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
SuggestedStrictness: "true"
|
||||||
VersionAdded: 0.3.3
|
VersionAdded: 0.3.3
|
||||||
|
|
||||||
Sorbet/ValidSigil:
|
Sorbet/ValidSigil:
|
||||||
Description: 'All files must have a valid sigil.'
|
Description: 'All files must have a valid sigil.'
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
RequireSigilOnAllFiles: false
|
||||||
|
SuggestedStrictness: "false"
|
||||||
|
MinimumStrictness: "false"
|
||||||
VersionAdded: 0.3.3
|
VersionAdded: 0.3.3
|
||||||
@ -0,0 +1,138 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module RuboCop
|
||||||
|
module Cop
|
||||||
|
module Sorbet
|
||||||
|
# This cop ensures that callback conditionals are bound to the right type
|
||||||
|
# so that they are type checked properly.
|
||||||
|
#
|
||||||
|
# @example
|
||||||
|
#
|
||||||
|
# # bad
|
||||||
|
# class Post < ApplicationRecord
|
||||||
|
# before_create :do_it, if: -> { should_do_it? }
|
||||||
|
#
|
||||||
|
# def should_do_it?
|
||||||
|
# true
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
#
|
||||||
|
# # good
|
||||||
|
# class Post < ApplicationRecord
|
||||||
|
# before_create :do_it, if: -> { T.bind(self, Post).should_do_it? }
|
||||||
|
#
|
||||||
|
# def should_do_it?
|
||||||
|
# true
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
class CallbackConditionalsBinding < RuboCop::Cop::Cop
|
||||||
|
CALLBACKS = %i(
|
||||||
|
validate
|
||||||
|
validates
|
||||||
|
validates_with
|
||||||
|
before_validation
|
||||||
|
around_validation
|
||||||
|
|
||||||
|
before_create
|
||||||
|
before_save
|
||||||
|
before_destroy
|
||||||
|
before_update
|
||||||
|
|
||||||
|
after_create
|
||||||
|
after_save
|
||||||
|
after_destroy
|
||||||
|
after_update
|
||||||
|
after_touch
|
||||||
|
after_initialize
|
||||||
|
after_find
|
||||||
|
|
||||||
|
around_create
|
||||||
|
around_save
|
||||||
|
around_destroy
|
||||||
|
around_update
|
||||||
|
|
||||||
|
before_commit
|
||||||
|
|
||||||
|
after_commit
|
||||||
|
after_create_commit
|
||||||
|
after_destroy_commit
|
||||||
|
after_rollback
|
||||||
|
after_save_commit
|
||||||
|
after_update_commit
|
||||||
|
|
||||||
|
before_action
|
||||||
|
prepend_before_action
|
||||||
|
append_before_action
|
||||||
|
|
||||||
|
around_action
|
||||||
|
prepend_around_action
|
||||||
|
append_around_action
|
||||||
|
|
||||||
|
after_action
|
||||||
|
prepend_after_action
|
||||||
|
append_after_action
|
||||||
|
).freeze
|
||||||
|
|
||||||
|
def autocorrect(node)
|
||||||
|
lambda do |corrector|
|
||||||
|
options = node.each_child_node.find(&:hash_type?)
|
||||||
|
|
||||||
|
conditional = nil
|
||||||
|
options.each_pair do |keyword, block|
|
||||||
|
if keyword.value == :if || keyword.value == :unless
|
||||||
|
conditional = block
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
_, _, block = conditional.child_nodes
|
||||||
|
expected_class = node.parent_module_name
|
||||||
|
|
||||||
|
bind = if block.begin_type?
|
||||||
|
indentation = " " * block.child_nodes.first.loc.column
|
||||||
|
"T.bind(self, #{expected_class})\n#{indentation}"
|
||||||
|
elsif block.child_nodes.empty? && !block.ivar_type?
|
||||||
|
"T.bind(self, #{expected_class})."
|
||||||
|
else
|
||||||
|
"T.bind(self, #{expected_class}); "
|
||||||
|
end
|
||||||
|
|
||||||
|
corrector.insert_before(block, bind)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def on_send(node)
|
||||||
|
return unless CALLBACKS.include?(node.method_name)
|
||||||
|
|
||||||
|
options = node.each_child_node.find(&:hash_type?)
|
||||||
|
return if options.nil?
|
||||||
|
|
||||||
|
conditional = nil
|
||||||
|
options.each_pair do |keyword, block|
|
||||||
|
next unless keyword.sym_type?
|
||||||
|
|
||||||
|
if keyword.value == :if || keyword.value == :unless
|
||||||
|
conditional = block
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return if conditional.nil? || conditional.child_nodes.empty?
|
||||||
|
|
||||||
|
type, _, block = conditional.child_nodes
|
||||||
|
return unless type.lambda_or_proc?
|
||||||
|
|
||||||
|
expected_class = node.parent_module_name
|
||||||
|
return if expected_class.nil?
|
||||||
|
|
||||||
|
unless block.source.include?("T.bind(self, #{expected_class})")
|
||||||
|
add_offense(
|
||||||
|
node,
|
||||||
|
message: "Callback conditionals should be bound to the right type. Use T.bind(self, #{expected_class})"
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@ -0,0 +1,26 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require 'rubocop'
|
||||||
|
|
||||||
|
module RuboCop
|
||||||
|
module Cop
|
||||||
|
module Sorbet
|
||||||
|
# This cop disallows using `T.unsafe` anywhere.
|
||||||
|
#
|
||||||
|
# @example
|
||||||
|
#
|
||||||
|
# # bad
|
||||||
|
# T.unsafe(foo)
|
||||||
|
#
|
||||||
|
# # good
|
||||||
|
# foo
|
||||||
|
class ForbidTUnsafe < RuboCop::Cop::Cop
|
||||||
|
def_node_matcher(:t_unsafe?, '(send (const nil? :T) :unsafe _)')
|
||||||
|
|
||||||
|
def on_send(node)
|
||||||
|
add_offense(node, message: "Do not use `T.unsafe`.") if t_unsafe?(node)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module RuboCop
|
||||||
|
module Cop
|
||||||
|
module Sorbet
|
||||||
|
# This cop makes sure that RBI files are always located under sorbet/rbi/.
|
||||||
|
#
|
||||||
|
# @example
|
||||||
|
# # bad
|
||||||
|
# lib/some_file.rbi
|
||||||
|
# other_file.rbi
|
||||||
|
#
|
||||||
|
# # good
|
||||||
|
# sorbet/rbi/some_file.rbi
|
||||||
|
# sorbet/rbi/any/path/for/file.rbi
|
||||||
|
class ForbidRBIOutsideOfSorbetDir < RuboCop::Cop::Cop
|
||||||
|
include RangeHelp
|
||||||
|
|
||||||
|
PATH_REGEXP = %r{sorbet/rbi}
|
||||||
|
|
||||||
|
def investigate(processed_source)
|
||||||
|
add_offense(
|
||||||
|
nil,
|
||||||
|
location: source_range(processed_source.buffer, 1, 0),
|
||||||
|
message: "RBI files are only accepted in the sorbet/rbi/ directory."
|
||||||
|
) unless processed_source.file_path =~ PATH_REGEXP
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@ -147,12 +147,14 @@ module RuboCop
|
|||||||
|
|
||||||
# Default is `'false'`
|
# Default is `'false'`
|
||||||
def suggested_strictness
|
def suggested_strictness
|
||||||
STRICTNESS_LEVELS.include?(cop_config['SuggestedStrictness']) ? cop_config['SuggestedStrictness'] : 'false'
|
config = cop_config['SuggestedStrictness'].to_s
|
||||||
|
STRICTNESS_LEVELS.include?(config) ? config : 'false'
|
||||||
end
|
end
|
||||||
|
|
||||||
# Default is `nil`
|
# Default is `nil`
|
||||||
def minimum_strictness
|
def minimum_strictness
|
||||||
cop_config['MinimumStrictness'] if STRICTNESS_LEVELS.include?(cop_config['MinimumStrictness'])
|
config = cop_config['MinimumStrictness'].to_s
|
||||||
|
config if STRICTNESS_LEVELS.include?(config)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -1,12 +1,16 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require_relative 'sorbet/binding_constants_without_type_alias'
|
require_relative 'sorbet/binding_constants_without_type_alias'
|
||||||
require_relative 'sorbet/constants_from_strings'
|
require_relative 'sorbet/constants_from_strings'
|
||||||
require_relative 'sorbet/forbid_extend_t_sig_helpers_in_shims'
|
|
||||||
require_relative 'sorbet/forbid_superclass_const_literal'
|
require_relative 'sorbet/forbid_superclass_const_literal'
|
||||||
require_relative 'sorbet/forbid_include_const_literal'
|
require_relative 'sorbet/forbid_include_const_literal'
|
||||||
require_relative 'sorbet/forbid_untyped_struct_props'
|
require_relative 'sorbet/forbid_untyped_struct_props'
|
||||||
require_relative 'sorbet/single_line_rbi_class_module_definitions'
|
|
||||||
require_relative 'sorbet/one_ancestor_per_line'
|
require_relative 'sorbet/one_ancestor_per_line'
|
||||||
|
require_relative 'sorbet/callback_conditionals_binding'
|
||||||
|
require_relative 'sorbet/forbid_t_unsafe'
|
||||||
|
|
||||||
|
require_relative 'sorbet/rbi/forbid_extend_t_sig_helpers_in_shims'
|
||||||
|
require_relative 'sorbet/rbi/forbid_rbi_outside_of_sorbet_dir'
|
||||||
|
require_relative 'sorbet/rbi/single_line_rbi_class_module_definitions'
|
||||||
|
|
||||||
require_relative 'sorbet/signatures/allow_incompatible_override'
|
require_relative 'sorbet/signatures/allow_incompatible_override'
|
||||||
require_relative 'sorbet/signatures/checked_true_in_signature'
|
require_relative 'sorbet/signatures/checked_true_in_signature'
|
||||||
@ -1,6 +1,6 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
module RuboCop
|
module RuboCop
|
||||||
module Sorbet
|
module Sorbet
|
||||||
VERSION = "0.6.1"
|
VERSION = "0.6.2"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
Loading…
x
Reference in New Issue
Block a user