Merge pull request #9345 from Homebrew/dependabot/bundler/Library/Homebrew/rubocop-performance-1.9.1
build(deps): bump rubocop-performance from 1.9.0 to 1.9.1 in /Library/Homebrew
This commit is contained in:
commit
66f47e7502
@ -72,7 +72,7 @@ GEM
|
||||
method_source (~> 1.0)
|
||||
rainbow (3.0.0)
|
||||
rdiscount (2.2.0.2)
|
||||
regexp_parser (1.8.2)
|
||||
regexp_parser (2.0.0)
|
||||
rexml (3.2.4)
|
||||
ronn (0.7.3)
|
||||
hpricot (>= 0.8.2)
|
||||
@ -110,9 +110,9 @@ GEM
|
||||
rubocop-ast (>= 1.1.1)
|
||||
ruby-progressbar (~> 1.7)
|
||||
unicode-display_width (>= 1.4.0, < 2.0)
|
||||
rubocop-ast (1.1.1)
|
||||
rubocop-ast (1.2.0)
|
||||
parser (>= 2.7.1.5)
|
||||
rubocop-performance (1.9.0)
|
||||
rubocop-performance (1.9.1)
|
||||
rubocop (>= 0.90.0, < 2.0)
|
||||
rubocop-ast (>= 0.4.0)
|
||||
rubocop-rspec (2.0.0)
|
||||
|
@ -5,9 +5,6 @@
|
||||
# typed: true
|
||||
|
||||
module Regexp::Expression
|
||||
class << self
|
||||
def parsed(exp); end
|
||||
end
|
||||
end
|
||||
|
||||
class Regexp::Expression::Alternation < ::Regexp::Expression::SequenceOperation
|
||||
@ -86,7 +83,7 @@ end
|
||||
class Regexp::Expression::Backreference::Base < ::Regexp::Expression::Base
|
||||
def match_length; end
|
||||
def referenced_expression; end
|
||||
def referenced_expression=(_); end
|
||||
def referenced_expression=(_arg0); end
|
||||
end
|
||||
|
||||
class Regexp::Expression::Backreference::Name < ::Regexp::Expression::Backreference::Base
|
||||
@ -126,21 +123,24 @@ end
|
||||
|
||||
class Regexp::Expression::Backreference::NumberRelative < ::Regexp::Expression::Backreference::Number
|
||||
def effective_number; end
|
||||
def effective_number=(_); end
|
||||
def effective_number=(_arg0); end
|
||||
def reference; end
|
||||
end
|
||||
|
||||
class Regexp::Expression::Base
|
||||
include(::RuboCop::Ext::RegexpParser::Expression::Base)
|
||||
|
||||
def initialize(token, options = T.unsafe(nil)); end
|
||||
|
||||
def =~(string, offset = T.unsafe(nil)); end
|
||||
def a?; end
|
||||
def ascii_classes?; end
|
||||
def attributes; end
|
||||
def base_length; end
|
||||
def case_insensitive?; end
|
||||
def coded_offset; end
|
||||
def conditional_level; end
|
||||
def conditional_level=(_); end
|
||||
def conditional_level=(_arg0); end
|
||||
def d?; end
|
||||
def default_classes?; end
|
||||
def extended?; end
|
||||
@ -152,44 +152,44 @@ class Regexp::Expression::Base
|
||||
def is?(test_token, test_type = T.unsafe(nil)); end
|
||||
def lazy?; end
|
||||
def level; end
|
||||
def level=(_); end
|
||||
def level=(_arg0); end
|
||||
def m?; end
|
||||
def match(string, offset = T.unsafe(nil)); end
|
||||
def match?(string); end
|
||||
def matches?(string); end
|
||||
def multiline?; end
|
||||
def nesting_level; end
|
||||
def nesting_level=(_); end
|
||||
def nesting_level=(_arg0); end
|
||||
def offset; end
|
||||
def one_of?(scope, top = T.unsafe(nil)); end
|
||||
def options; end
|
||||
def options=(_); end
|
||||
def options=(_arg0); end
|
||||
def possessive?; end
|
||||
def quantified?; end
|
||||
def quantifier; end
|
||||
def quantifier=(_); end
|
||||
def quantifier=(_arg0); end
|
||||
def quantifier_affix(expression_format); end
|
||||
def quantify(token, text, min = T.unsafe(nil), max = T.unsafe(nil), mode = T.unsafe(nil)); end
|
||||
def quantity; end
|
||||
def reluctant?; end
|
||||
def repetitions; end
|
||||
def set_level; end
|
||||
def set_level=(_); end
|
||||
def set_level=(_arg0); end
|
||||
def starts_at; end
|
||||
def strfre(format = T.unsafe(nil), indent_offset = T.unsafe(nil), index = T.unsafe(nil)); end
|
||||
def strfregexp(format = T.unsafe(nil), indent_offset = T.unsafe(nil), index = T.unsafe(nil)); end
|
||||
def terminal?; end
|
||||
def text; end
|
||||
def text=(_); end
|
||||
def text=(_arg0); end
|
||||
def to_h; end
|
||||
def to_re(format = T.unsafe(nil)); end
|
||||
def to_s(format = T.unsafe(nil)); end
|
||||
def token; end
|
||||
def token=(_); end
|
||||
def token=(_arg0); end
|
||||
def ts; end
|
||||
def ts=(_); end
|
||||
def ts=(_arg0); end
|
||||
def type; end
|
||||
def type=(_); end
|
||||
def type=(_arg0); end
|
||||
def type?(test_type); end
|
||||
def u?; end
|
||||
def unicode_classes?; end
|
||||
@ -202,17 +202,19 @@ class Regexp::Expression::Base
|
||||
end
|
||||
|
||||
class Regexp::Expression::CharacterSet < ::Regexp::Expression::Subexpression
|
||||
include(::RuboCop::Ext::RegexpParser::Expression::CharacterSet)
|
||||
|
||||
def initialize(token, options = T.unsafe(nil)); end
|
||||
|
||||
def close; end
|
||||
def closed; end
|
||||
def closed=(_); end
|
||||
def closed=(_arg0); end
|
||||
def closed?; end
|
||||
def match_length; end
|
||||
def negate; end
|
||||
def negated?; end
|
||||
def negative; end
|
||||
def negative=(_); end
|
||||
def negative=(_arg0); end
|
||||
def negative?; end
|
||||
def to_s(format = T.unsafe(nil)); end
|
||||
end
|
||||
@ -289,7 +291,7 @@ class Regexp::Expression::Conditional::Condition < ::Regexp::Expression::Base
|
||||
def match_length; end
|
||||
def reference; end
|
||||
def referenced_expression; end
|
||||
def referenced_expression=(_); end
|
||||
def referenced_expression=(_arg0); end
|
||||
end
|
||||
|
||||
class Regexp::Expression::Conditional::Expression < ::Regexp::Expression::Subexpression
|
||||
@ -302,7 +304,7 @@ class Regexp::Expression::Conditional::Expression < ::Regexp::Expression::Subexp
|
||||
def match_length; end
|
||||
def reference; end
|
||||
def referenced_expression; end
|
||||
def referenced_expression=(_); end
|
||||
def referenced_expression=(_arg0); end
|
||||
def to_s(format = T.unsafe(nil)); end
|
||||
end
|
||||
|
||||
@ -411,9 +413,9 @@ class Regexp::Expression::Group::Capture < ::Regexp::Expression::Group::Base
|
||||
def capturing?; end
|
||||
def identifier; end
|
||||
def number; end
|
||||
def number=(_); end
|
||||
def number=(_arg0); end
|
||||
def number_at_level; end
|
||||
def number_at_level=(_); end
|
||||
def number_at_level=(_arg0); end
|
||||
end
|
||||
|
||||
class Regexp::Expression::Group::Comment < ::Regexp::Expression::Group::Base
|
||||
@ -434,10 +436,13 @@ end
|
||||
|
||||
class Regexp::Expression::Group::Options < ::Regexp::Expression::Group::Base
|
||||
def option_changes; end
|
||||
def option_changes=(_); end
|
||||
def option_changes=(_arg0); end
|
||||
end
|
||||
|
||||
class Regexp::Expression::Group::Passive < ::Regexp::Expression::Group::Base
|
||||
def implicit=(_arg0); end
|
||||
def implicit?; end
|
||||
def to_s(format = T.unsafe(nil)); end
|
||||
end
|
||||
|
||||
module Regexp::Expression::Keep
|
||||
@ -462,6 +467,8 @@ end
|
||||
class Regexp::Expression::Quantifier
|
||||
def initialize(token, text, min, max, mode); end
|
||||
|
||||
def ==(other); end
|
||||
def eq(other); end
|
||||
def greedy?; end
|
||||
def lazy?; end
|
||||
def max; end
|
||||
@ -483,8 +490,6 @@ end
|
||||
Regexp::Expression::Quantifier::MODES = T.let(T.unsafe(nil), Array)
|
||||
|
||||
class Regexp::Expression::Root < ::Regexp::Expression::Subexpression
|
||||
def initialize(*args); end
|
||||
|
||||
class << self
|
||||
def build(options = T.unsafe(nil)); end
|
||||
def build_token; end
|
||||
@ -492,8 +497,6 @@ class Regexp::Expression::Root < ::Regexp::Expression::Subexpression
|
||||
end
|
||||
|
||||
class Regexp::Expression::Sequence < ::Regexp::Expression::Subexpression
|
||||
def initialize(*args); end
|
||||
|
||||
def quantify(token, text, min = T.unsafe(nil), max = T.unsafe(nil), mode = T.unsafe(nil)); end
|
||||
def starts_at; end
|
||||
def ts; end
|
||||
@ -528,7 +531,7 @@ class Regexp::Expression::Subexpression < ::Regexp::Expression::Base
|
||||
def each_expression(include_self = T.unsafe(nil), &block); end
|
||||
def empty?(*args, &block); end
|
||||
def expressions; end
|
||||
def expressions=(_); end
|
||||
def expressions=(_arg0); end
|
||||
def fetch(*args, &block); end
|
||||
def flat_map(include_self = T.unsafe(nil), &block); end
|
||||
def index(*args, &block); end
|
||||
@ -802,17 +805,17 @@ class Regexp::Lexer
|
||||
def break_codepoint_list(token); end
|
||||
def break_literal(token); end
|
||||
def conditional_nesting; end
|
||||
def conditional_nesting=(_); end
|
||||
def conditional_nesting=(_arg0); end
|
||||
def descend(type, token); end
|
||||
def merge_condition(current); end
|
||||
def nesting; end
|
||||
def nesting=(_); end
|
||||
def nesting=(_arg0); end
|
||||
def set_nesting; end
|
||||
def set_nesting=(_); end
|
||||
def set_nesting=(_arg0); end
|
||||
def shift; end
|
||||
def shift=(_); end
|
||||
def shift=(_arg0); end
|
||||
def tokens; end
|
||||
def tokens=(_); end
|
||||
def tokens=(_arg0); end
|
||||
|
||||
class << self
|
||||
def lex(input, syntax = T.unsafe(nil), options: T.unsafe(nil), &block); end
|
||||
@ -842,17 +845,17 @@ class Regexp::MatchLength
|
||||
private
|
||||
|
||||
def base_max; end
|
||||
def base_max=(_); end
|
||||
def base_max=(_arg0); end
|
||||
def base_min; end
|
||||
def base_min=(_); end
|
||||
def base_min=(_arg0); end
|
||||
def exp_class; end
|
||||
def exp_class=(_); end
|
||||
def exp_class=(_arg0); end
|
||||
def max_rep; end
|
||||
def max_rep=(_); end
|
||||
def max_rep=(_arg0); end
|
||||
def min_rep; end
|
||||
def min_rep=(_); end
|
||||
def min_rep=(_arg0); end
|
||||
def reify; end
|
||||
def reify=(_); end
|
||||
def reify=(_arg0); end
|
||||
def test_regexp; end
|
||||
|
||||
class << self
|
||||
@ -876,19 +879,20 @@ class Regexp::Parser
|
||||
def backref(token); end
|
||||
def captured_group_count_at_level; end
|
||||
def captured_group_counts; end
|
||||
def captured_group_counts=(_); end
|
||||
def captured_group_counts=(_arg0); end
|
||||
def close_completed_character_set_range; end
|
||||
def close_group; end
|
||||
def close_set; end
|
||||
def conditional(token); end
|
||||
def conditional_nesting; end
|
||||
def conditional_nesting=(_); end
|
||||
def conditional_nesting=(_arg0); end
|
||||
def count_captured_group; end
|
||||
def decrease_nesting; end
|
||||
def escape(token); end
|
||||
def extract_options(input, options); end
|
||||
def free_space(token); end
|
||||
def group(token); end
|
||||
def increase_level(exp); end
|
||||
def intersection(token); end
|
||||
def interval(target_node, token); end
|
||||
def keep(token); end
|
||||
@ -897,25 +901,25 @@ class Regexp::Parser
|
||||
def nest(exp); end
|
||||
def nest_conditional(exp); end
|
||||
def nesting; end
|
||||
def nesting=(_); end
|
||||
def nesting=(_arg0); end
|
||||
def node; end
|
||||
def node=(_); end
|
||||
def node=(_arg0); end
|
||||
def open_group(token); end
|
||||
def open_set(token); end
|
||||
def options_group(token); end
|
||||
def options_stack; end
|
||||
def options_stack=(_); end
|
||||
def options_stack=(_arg0); end
|
||||
def parse_token(token); end
|
||||
def posixclass(token); end
|
||||
def property(token); end
|
||||
def quantifier(token); end
|
||||
def range(token); end
|
||||
def root; end
|
||||
def root=(_); end
|
||||
def root=(_arg0); end
|
||||
def sequence_operation(klass, token); end
|
||||
def set(token); end
|
||||
def switching_options; end
|
||||
def switching_options=(_); end
|
||||
def switching_options=(_arg0); end
|
||||
def total_captured_group_count; end
|
||||
def type(token); end
|
||||
def update_transplanted_subtree(exp, new_parent); end
|
||||
@ -943,36 +947,37 @@ end
|
||||
Regexp::Parser::VERSION = T.let(T.unsafe(nil), String)
|
||||
|
||||
class Regexp::Scanner
|
||||
def emit(type, token, text, ts, te); end
|
||||
def emit(type, token, text); end
|
||||
def scan(input_object, options: T.unsafe(nil), &block); end
|
||||
|
||||
private
|
||||
|
||||
def append_literal(data, ts, te); end
|
||||
def block; end
|
||||
def block=(_); end
|
||||
def block=(_arg0); end
|
||||
def char_pos; end
|
||||
def char_pos=(_arg0); end
|
||||
def conditional_stack; end
|
||||
def conditional_stack=(_); end
|
||||
def copy(data, range); end
|
||||
def conditional_stack=(_arg0); end
|
||||
def copy(data, ts, te); end
|
||||
def emit_literal; end
|
||||
def emit_meta_control_sequence(data, ts, te, token); end
|
||||
def emit_options(text, ts, te); end
|
||||
def emit_options(text); end
|
||||
def free_spacing; end
|
||||
def free_spacing=(_); end
|
||||
def free_spacing=(_arg0); end
|
||||
def free_spacing?(input_object, options); end
|
||||
def group_depth; end
|
||||
def group_depth=(_); end
|
||||
def group_depth=(_arg0); end
|
||||
def in_group?; end
|
||||
def in_set?; end
|
||||
def literal; end
|
||||
def literal=(_); end
|
||||
def literal=(_arg0); end
|
||||
def set_depth; end
|
||||
def set_depth=(_); end
|
||||
def set_depth=(_arg0); end
|
||||
def spacing_stack; end
|
||||
def spacing_stack=(_); end
|
||||
def text(data, ts, te, soff = T.unsafe(nil)); end
|
||||
def spacing_stack=(_arg0); end
|
||||
def tokens; end
|
||||
def tokens=(_); end
|
||||
def tokens=(_arg0); end
|
||||
def validation_error(type, what, reason); end
|
||||
|
||||
class << self
|
||||
@ -1503,10 +1508,10 @@ class Regexp::Token < ::Struct
|
||||
def level; end
|
||||
def level=(_); end
|
||||
def next; end
|
||||
def next=(_); end
|
||||
def next=(_arg0); end
|
||||
def offset; end
|
||||
def previous; end
|
||||
def previous=(_); end
|
||||
def previous=(_arg0); end
|
||||
def set_level; end
|
||||
def set_level=(_); end
|
||||
def te; end
|
||||
@ -1521,9 +1526,9 @@ class Regexp::Token < ::Struct
|
||||
def type=(_); end
|
||||
|
||||
class << self
|
||||
def [](*_); end
|
||||
def [](*_arg0); end
|
||||
def inspect; end
|
||||
def members; end
|
||||
def new(*_); end
|
||||
def new(*_arg0); end
|
||||
end
|
||||
end
|
@ -24,9 +24,16 @@ class RuboCop::AST::AndNode < ::RuboCop::AST::Node
|
||||
def inverse_operator; end
|
||||
end
|
||||
|
||||
class RuboCop::AST::ArgNode < ::RuboCop::AST::Node
|
||||
def default?; end
|
||||
def default_value; end
|
||||
def name; end
|
||||
end
|
||||
|
||||
class RuboCop::AST::ArgsNode < ::RuboCop::AST::Node
|
||||
include(::RuboCop::AST::CollectionNode)
|
||||
|
||||
def argument_list; end
|
||||
def empty_and_without_delimiters?; end
|
||||
end
|
||||
|
||||
@ -51,6 +58,7 @@ end
|
||||
class RuboCop::AST::BlockNode < ::RuboCop::AST::Node
|
||||
include(::RuboCop::AST::MethodIdentifierPredicates)
|
||||
|
||||
def argument_list; end
|
||||
def arguments; end
|
||||
def arguments?; end
|
||||
def body; end
|
||||
@ -65,6 +73,10 @@ class RuboCop::AST::BlockNode < ::RuboCop::AST::Node
|
||||
def send_node; end
|
||||
def single_line?; end
|
||||
def void_context?; end
|
||||
|
||||
private
|
||||
|
||||
def numbered_arguments; end
|
||||
end
|
||||
|
||||
class RuboCop::AST::BreakNode < ::RuboCop::AST::Node
|
||||
@ -308,6 +320,9 @@ module RuboCop::AST::Ext::Range
|
||||
def line_span(exclude_end: T.unsafe(nil)); end
|
||||
end
|
||||
|
||||
module RuboCop::AST::Ext::RangeMinMax
|
||||
end
|
||||
|
||||
class RuboCop::AST::FloatNode < ::RuboCop::AST::Node
|
||||
include(::RuboCop::AST::BasicLiteralNode)
|
||||
include(::RuboCop::AST::NumericNode)
|
||||
@ -1179,10 +1194,6 @@ RuboCop::AST::NodePattern::Node::FunctionCall = RuboCop::AST::NodePattern::Node:
|
||||
|
||||
RuboCop::AST::NodePattern::Node::MAP = T.let(T.unsafe(nil), Hash)
|
||||
|
||||
module RuboCop::AST::NodePattern::Node::MapMinMax
|
||||
def map_min_max(enum); end
|
||||
end
|
||||
|
||||
class RuboCop::AST::NodePattern::Node::Predicate < ::RuboCop::AST::NodePattern::Node
|
||||
def arg_list; end
|
||||
def method_name; end
|
||||
@ -1211,15 +1222,12 @@ end
|
||||
|
||||
class RuboCop::AST::NodePattern::Node::Subsequence < ::RuboCop::AST::NodePattern::Node
|
||||
include(::RuboCop::AST::NodePattern::Node::ForbidInSeqHead)
|
||||
include(::RuboCop::AST::NodePattern::Node::MapMinMax)
|
||||
|
||||
def arity; end
|
||||
def in_sequence_head; end
|
||||
end
|
||||
|
||||
class RuboCop::AST::NodePattern::Node::Union < ::RuboCop::AST::NodePattern::Node
|
||||
include(::RuboCop::AST::NodePattern::Node::MapMinMax)
|
||||
|
||||
def arity; end
|
||||
def in_sequence_head; end
|
||||
end
|
||||
@ -1378,16 +1386,12 @@ RuboCop::AST::NodePattern::Sets::SET_CLASS_MODULE = T.let(T.unsafe(nil), Set)
|
||||
|
||||
RuboCop::AST::NodePattern::Sets::SET_CLASS_MODULE_STRUCT = T.let(T.unsafe(nil), Set)
|
||||
|
||||
RuboCop::AST::NodePattern::Sets::SET_COLLECT_COMPACT_FLATTEN_ETC = T.let(T.unsafe(nil), Set)
|
||||
|
||||
RuboCop::AST::NodePattern::Sets::SET_CONSTANTIZE_CONSTANTS_CONST_GET = T.let(T.unsafe(nil), Set)
|
||||
|
||||
RuboCop::AST::NodePattern::Sets::SET_CONTEXT_SHARED_CONTEXT = T.let(T.unsafe(nil), Set)
|
||||
|
||||
RuboCop::AST::NodePattern::Sets::SET_COUNT_LENGTH_SIZE = T.let(T.unsafe(nil), Set)
|
||||
|
||||
RuboCop::AST::NodePattern::Sets::SET_DEBUGGER_BYEBUG_REMOTE_BYEBUG = T.let(T.unsafe(nil), Set)
|
||||
|
||||
RuboCop::AST::NodePattern::Sets::SET_DEFINE_METHOD_DEFINE_SINGLETON_METHOD = T.let(T.unsafe(nil), Set)
|
||||
|
||||
RuboCop::AST::NodePattern::Sets::SET_DESCRIBE_FEATURE = T.let(T.unsafe(nil), Set)
|
||||
@ -1412,8 +1416,6 @@ RuboCop::AST::NodePattern::Sets::SET_EXPECT_ALLOW = T.let(T.unsafe(nil), Set)
|
||||
|
||||
RuboCop::AST::NodePattern::Sets::SET_FACTORYGIRL_FACTORYBOT = T.let(T.unsafe(nil), Set)
|
||||
|
||||
RuboCop::AST::NodePattern::Sets::SET_FIRST_LAST_POP_ETC = T.let(T.unsafe(nil), Set)
|
||||
|
||||
RuboCop::AST::NodePattern::Sets::SET_FIRST_LAST__ETC = T.let(T.unsafe(nil), Set)
|
||||
|
||||
RuboCop::AST::NodePattern::Sets::SET_FIXNUM_BIGNUM = T.let(T.unsafe(nil), Set)
|
||||
@ -1472,8 +1474,6 @@ RuboCop::AST::NodePattern::Sets::SET_PROC_LAMBDA = T.let(T.unsafe(nil), Set)
|
||||
|
||||
RuboCop::AST::NodePattern::Sets::SET_PROP_CONST = T.let(T.unsafe(nil), Set)
|
||||
|
||||
RuboCop::AST::NodePattern::Sets::SET_PRY_REMOTE_PRY_PRY_REMOTE_CONSOLE = T.let(T.unsafe(nil), Set)
|
||||
|
||||
RuboCop::AST::NodePattern::Sets::SET_PUBLIC_CONSTANT_PRIVATE_CONSTANT = T.let(T.unsafe(nil), Set)
|
||||
|
||||
RuboCop::AST::NodePattern::Sets::SET_PUBLIC_PROTECTED_PRIVATE_MODULE_FUNCTION = T.let(T.unsafe(nil), Set)
|
||||
@ -1498,8 +1498,6 @@ RuboCop::AST::NodePattern::Sets::SET_REJECT_REJECT = T.let(T.unsafe(nil), Set)
|
||||
|
||||
RuboCop::AST::NodePattern::Sets::SET_REQUIRE_REQUIRE_RELATIVE = T.let(T.unsafe(nil), Set)
|
||||
|
||||
RuboCop::AST::NodePattern::Sets::SET_SAVE_AND_OPEN_PAGE_SAVE_AND_OPEN_SCREENSHOT = T.let(T.unsafe(nil), Set)
|
||||
|
||||
RuboCop::AST::NodePattern::Sets::SET_SELECT_FILTER_FIND_ALL_REJECT = T.let(T.unsafe(nil), Set)
|
||||
|
||||
RuboCop::AST::NodePattern::Sets::SET_SELECT_SELECT = T.let(T.unsafe(nil), Set)
|
||||
@ -1564,6 +1562,8 @@ RuboCop::AST::NodePattern::Sets::SET___7 = T.let(T.unsafe(nil), Set)
|
||||
|
||||
RuboCop::AST::NodePattern::Sets::SET___8 = T.let(T.unsafe(nil), Set)
|
||||
|
||||
RuboCop::AST::NodePattern::Sets::SET___METHOD_____CALLEE__ = T.let(T.unsafe(nil), Set)
|
||||
|
||||
RuboCop::AST::NodePattern::Sets::SET____ = T.let(T.unsafe(nil), Set)
|
||||
|
||||
RuboCop::AST::NodePattern::Sets::SET____ETC = T.let(T.unsafe(nil), Set)
|
||||
@ -1572,10 +1572,6 @@ RuboCop::AST::NodePattern::Sets::SET____ETC_2 = T.let(T.unsafe(nil), Set)
|
||||
|
||||
RuboCop::AST::NodePattern::Sets::SET____ETC_3 = T.let(T.unsafe(nil), Set)
|
||||
|
||||
RuboCop::AST::NodePattern::Sets::SET____ETC_4 = T.let(T.unsafe(nil), Set)
|
||||
|
||||
RuboCop::AST::NodePattern::Sets::SET____ETC_5 = T.let(T.unsafe(nil), Set)
|
||||
|
||||
RuboCop::AST::NodePattern::VAR = T.let(T.unsafe(nil), String)
|
||||
|
||||
module RuboCop::AST::NumericNode
|
||||
@ -1631,6 +1627,10 @@ module RuboCop::AST::PredicateOperatorNode
|
||||
def semantic_operator?; end
|
||||
end
|
||||
|
||||
class RuboCop::AST::Procarg0Node < ::RuboCop::AST::ArgNode
|
||||
def name; end
|
||||
end
|
||||
|
||||
class RuboCop::AST::ProcessedSource
|
||||
include(::RuboCop::Ext::ProcessedSource)
|
||||
|
@ -162,19 +162,21 @@ RuboCop::Cop::Performance::Casecmp::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Arra
|
||||
class RuboCop::Cop::Performance::ChainArrayAllocation < ::RuboCop::Cop::Base
|
||||
include(::RuboCop::Cop::RangeHelp)
|
||||
|
||||
def flat_map_candidate?(param0 = T.unsafe(nil)); end
|
||||
def chain_array_allocation?(param0 = T.unsafe(nil)); end
|
||||
def on_send(node); end
|
||||
end
|
||||
|
||||
RuboCop::Cop::Performance::ChainArrayAllocation::ALWAYS_RETURNS_NEW_ARRAY = T.let(T.unsafe(nil), String)
|
||||
RuboCop::Cop::Performance::ChainArrayAllocation::ALWAYS_RETURNS_NEW_ARRAY = T.let(T.unsafe(nil), Set)
|
||||
|
||||
RuboCop::Cop::Performance::ChainArrayAllocation::HAS_MUTATION_ALTERNATIVE = T.let(T.unsafe(nil), String)
|
||||
RuboCop::Cop::Performance::ChainArrayAllocation::HAS_MUTATION_ALTERNATIVE = T.let(T.unsafe(nil), Set)
|
||||
|
||||
RuboCop::Cop::Performance::ChainArrayAllocation::MSG = T.let(T.unsafe(nil), String)
|
||||
|
||||
RuboCop::Cop::Performance::ChainArrayAllocation::RETURNS_NEW_ARRAY_WHEN_NO_BLOCK = T.let(T.unsafe(nil), String)
|
||||
RuboCop::Cop::Performance::ChainArrayAllocation::RETURNS_NEW_ARRAY = T.let(T.unsafe(nil), Set)
|
||||
|
||||
RuboCop::Cop::Performance::ChainArrayAllocation::RETURN_NEW_ARRAY_WHEN_ARGS = T.let(T.unsafe(nil), String)
|
||||
RuboCop::Cop::Performance::ChainArrayAllocation::RETURNS_NEW_ARRAY_WHEN_NO_BLOCK = T.let(T.unsafe(nil), Set)
|
||||
|
||||
RuboCop::Cop::Performance::ChainArrayAllocation::RETURN_NEW_ARRAY_WHEN_ARGS = T.let(T.unsafe(nil), Set)
|
||||
|
||||
class RuboCop::Cop::Performance::CollectionLiteralInLoop < ::RuboCop::Cop::Base
|
||||
def enumerable_loop?(param0 = T.unsafe(nil)); end
|
@ -25753,14 +25753,6 @@ module Readline
|
||||
def self.completion_quote_character(); end
|
||||
end
|
||||
|
||||
class Regexp::Expression::Base
|
||||
include ::RuboCop::Ext::RegexpParser::Expression::Base
|
||||
end
|
||||
|
||||
class Regexp::Expression::CharacterSet
|
||||
include ::RuboCop::Ext::RegexpParser::Expression::CharacterSet
|
||||
end
|
||||
|
||||
class Requirement
|
||||
extend ::T::Private::Methods::MethodHooks
|
||||
extend ::T::Private::Methods::SingletonMethodHooks
|
||||
@ -26145,7 +26137,6 @@ module RuboCop::AST::NodePattern::Sets
|
||||
SET_INCLUDE_WITH_WITHOUT = ::T.let(nil, ::T.untyped)
|
||||
SET_SYSTEM_SHELL_OUTPUT_PIPE_OUTPUT = ::T.let(nil, ::T.untyped)
|
||||
SET_WITH_WITHOUT = ::T.let(nil, ::T.untyped)
|
||||
SET___METHOD_____CALLEE__ = ::T.let(nil, ::T.untyped)
|
||||
end
|
||||
|
||||
class RuboCop::Cask::AST::CaskHeader
|
||||
|
@ -59,7 +59,7 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/plist-3.5.0/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/pry-0.13.1/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/extensions/universal-darwin-19/2.6.0/rdiscount-2.2.0.2"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rdiscount-2.2.0.2/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/regexp_parser-1.8.2/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/regexp_parser-2.0.0/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rexml-3.2.4/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ronn-0.7.3/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-support-3.10.0/lib"
|
||||
@ -73,11 +73,11 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/sorbet-static-0.5.611
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/sorbet-0.5.6111/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-sorbet-1.7.0/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-wait-0.0.9/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-ast-1.1.1/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-ast-1.2.0/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-progressbar-1.10.1/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/unicode-display_width-1.7.0/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-1.3.1/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.9.0/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.9.1/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-2.0.0/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-sorbet-0.5.1/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-macho-2.5.0/lib"
|
||||
|
@ -9,7 +9,11 @@ Performance/AncestorsInclude:
|
||||
|
||||
Performance/ArraySemiInfiniteRangeSlice:
|
||||
Description: 'Identifies places where slicing arrays with semi-infinite ranges can be replaced by `Array#take` and `Array#drop`.'
|
||||
Enabled: pending
|
||||
# This cop was created due to a mistake in microbenchmark.
|
||||
# Refer https://github.com/rubocop-hq/rubocop-performance/pull/175#issuecomment-731892717
|
||||
Enabled: false
|
||||
# Unsafe for string slices because strings do not have `#take` and `#drop` methods.
|
||||
Safe: false
|
||||
VersionAdded: '1.9'
|
||||
|
||||
Performance/BigDecimalWithNumericArgument:
|
@ -5,6 +5,9 @@ module RuboCop
|
||||
module Performance
|
||||
# This cop identifies places where slicing arrays with semi-infinite ranges
|
||||
# can be replaced by `Array#take` and `Array#drop`.
|
||||
# This cop was created due to a mistake in microbenchmark and hence is disabled by default.
|
||||
# Refer https://github.com/rubocop-hq/rubocop-performance/pull/175#issuecomment-731892717
|
||||
# This cop is also unsafe for string slices because strings do not have `#take` and `#drop` methods.
|
||||
#
|
||||
# @example
|
||||
# # bad
|
@ -29,38 +29,40 @@ module RuboCop
|
||||
# [1,2].first # => 1
|
||||
# [1,2].first(1) # => [1]
|
||||
#
|
||||
RETURN_NEW_ARRAY_WHEN_ARGS = ':first :last :pop :sample :shift '
|
||||
RETURN_NEW_ARRAY_WHEN_ARGS = %i[first last pop sample shift].to_set.freeze
|
||||
|
||||
# These methods return a new array only when called without a block.
|
||||
RETURNS_NEW_ARRAY_WHEN_NO_BLOCK = ':zip :product '
|
||||
RETURNS_NEW_ARRAY_WHEN_NO_BLOCK = %i[zip product].to_set.freeze
|
||||
|
||||
# These methods ALWAYS return a new array
|
||||
# after they're called it's safe to mutate the the resulting array
|
||||
ALWAYS_RETURNS_NEW_ARRAY = ':* :+ :- :collect :compact :drop '\
|
||||
':drop_while :flatten :map :reject ' \
|
||||
':reverse :rotate :select :shuffle :sort ' \
|
||||
':take :take_while :transpose :uniq ' \
|
||||
':values_at :| '
|
||||
ALWAYS_RETURNS_NEW_ARRAY = %i[* + - collect compact drop
|
||||
drop_while flatten map reject
|
||||
reverse rotate select shuffle sort
|
||||
take take_while transpose uniq
|
||||
values_at |].to_set.freeze
|
||||
|
||||
# These methods have a mutation alternative. For example :collect
|
||||
# can be called as :collect!
|
||||
HAS_MUTATION_ALTERNATIVE = ':collect :compact :flatten :map :reject '\
|
||||
':reverse :rotate :select :shuffle :sort '\
|
||||
':uniq '
|
||||
MSG = 'Use unchained `%<method>s!` and `%<second_method>s!` '\
|
||||
HAS_MUTATION_ALTERNATIVE = %i[collect compact flatten map reject
|
||||
reverse rotate select shuffle sort uniq].to_set.freeze
|
||||
|
||||
RETURNS_NEW_ARRAY = (ALWAYS_RETURNS_NEW_ARRAY + RETURNS_NEW_ARRAY_WHEN_NO_BLOCK).freeze
|
||||
|
||||
MSG = 'Use unchained `%<method>s` and `%<second_method>s!` '\
|
||||
'(followed by `return array` if required) instead of chaining '\
|
||||
'`%<method>s...%<second_method>s`.'
|
||||
|
||||
def_node_matcher :flat_map_candidate?, <<~PATTERN
|
||||
{
|
||||
(send (send _ ${#{RETURN_NEW_ARRAY_WHEN_ARGS}} {int lvar ivar cvar gvar}) ${#{HAS_MUTATION_ALTERNATIVE}} $...)
|
||||
(send (block (send _ ${#{ALWAYS_RETURNS_NEW_ARRAY} }) ...) ${#{HAS_MUTATION_ALTERNATIVE}} $...)
|
||||
(send (send _ ${#{ALWAYS_RETURNS_NEW_ARRAY + RETURNS_NEW_ARRAY_WHEN_NO_BLOCK}} ...) ${#{HAS_MUTATION_ALTERNATIVE}} $...)
|
||||
}
|
||||
def_node_matcher :chain_array_allocation?, <<~PATTERN
|
||||
(send {
|
||||
(send _ $%RETURN_NEW_ARRAY_WHEN_ARGS {int lvar ivar cvar gvar})
|
||||
(block (send _ $%ALWAYS_RETURNS_NEW_ARRAY) ...)
|
||||
(send _ $%RETURNS_NEW_ARRAY ...)
|
||||
} $%HAS_MUTATION_ALTERNATIVE ...)
|
||||
PATTERN
|
||||
|
||||
def on_send(node)
|
||||
flat_map_candidate?(node) do |fm, sm, _|
|
||||
chain_array_allocation?(node) do |fm, sm|
|
||||
range = range_between(node.loc.dot.begin_pos, node.source_range.end_pos)
|
||||
|
||||
add_offense(range, message: format(MSG, method: fm, second_method: sm))
|
@ -4,7 +4,7 @@ module RuboCop
|
||||
module Performance
|
||||
# This module holds the RuboCop Performance version information.
|
||||
module Version
|
||||
STRING = '1.9.0'
|
||||
STRING = '1.9.1'
|
||||
|
||||
def self.document_version
|
||||
STRING.match('\d+\.\d+').to_s
|
Loading…
x
Reference in New Issue
Block a user