brew vendor-gems: commit updates.
This commit is contained in:
parent
968e293bed
commit
0539b0d9c2
@ -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