Showing 24 of 24 total issues
Class Node
has 68 methods (exceeds 20 allowed). Consider refactoring. Open
class Node < Parser::AST::Node # rubocop:disable Metrics/ClassLength
include RuboCop::AST::Sexp
extend NodePattern::Macros
include RuboCop::AST::Descendence
File node.rb
has 410 lines of code (exceeds 250 allowed). Consider refactoring. Open
module RuboCop
module AST
# `RuboCop::AST::Node` is a subclass of `Parser::AST::Node`. It provides
# access to parent nodes and an object-oriented way to traverse an AST with
# the power of `Enumerable`.
Class ProcessedSource
has 35 methods (exceeds 20 allowed). Consider refactoring. Open
class ProcessedSource # rubocop:disable Metrics/ClassLength
# @api private
STRING_SOURCE_NAME = '(string)'
INVALID_LEVELS = %i[error fatal].freeze
Class SequenceSubcompiler
has 32 methods (exceeds 20 allowed). Consider refactoring. Open
class SequenceSubcompiler < Subcompiler # rubocop:disable Metrics/ClassLength
# Shift of 1 from standard Ruby indices
DELTA = 1
POSITIVE = :positive?.to_proc
private_constant :POSITIVE
File sequence_subcompiler.rb
has 303 lines of code (exceeds 250 allowed). Consider refactoring. Open
module RuboCop
module AST
class NodePattern
class Compiler
# Compiles terms within a sequence to code that evalues to true or false.
Class Token
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class Token
LEFT_PAREN_TYPES = %i[tLPAREN tLPAREN2].freeze
attr_reader :pos, :type, :text
Method parser_class
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parser_class(ruby_version, parser_engine) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
case parser_engine
when :parser_whitequark
case ruby_version
when 1.9
Class Changelog
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class Changelog # rubocop:disable Metrics/ClassLength
ENTRIES_PATH = 'changelog/'
FIRST_HEADER = /#{Regexp.escape("## master (unreleased)\n")}/m.freeze
ENTRIES_PATH_TEMPLATE = "#{ENTRIES_PATH}%<type>s_%<name>s.md"
TYPE_REGEXP = /#{Regexp.escape(ENTRIES_PATH)}([a-z]+)_/.freeze
File processed_source.rb
has 257 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'digest/sha1'
module RuboCop
module AST
# ProcessedSource contains objects which are generated by Parser
Method in_sequence_head
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def in_sequence_head
return unless children.any?(&:in_sequence_head)
new_children = children.map do |child|
next child unless (replace = child.in_sequence_head)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method each_child_node
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def each_child_node(*types)
return to_enum(__method__, *types) unless block_given?
children.each do |child|
next unless child.is_a?(::AST::Node)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method each_path
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def each_path(&block)
return to_enum(__method__) unless block
descendants = []
last = self
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method parent_module_name_for_block
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def parent_module_name_for_block(ancestor)
if ancestor.method?(:class_eval)
# `class_eval` with no receiver applies to whatever module or class
# we are currently in
return unless (receiver = ancestor.receiver)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method compile_min_check
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def compile_min_check
return 'false' unless node.variadic?
unless @remaining_arity.end.infinite?
not_too_much_remaining = "#{compile_remaining} <= #{@remaining_arity.max}"
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method union_bind
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def union_bind(enum) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
# We need to reset @bound before each branch is processed.
# Moreover we need to keep track of newly encountered wildcards.
# Var `newly_bound_intersection` will hold those that are encountered
# in all branches; these are not a problem.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method visit_descendants
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def visit_descendants(types, &block)
children.each do |child|
next unless child.is_a?(::AST::Node)
yield child if types.empty? || types.include?(child.type)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method parser_class
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def parser_class(ruby_version, parser_engine) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
case parser_engine
when :parser_whitequark
case ruby_version
when 1.9
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method def_modifier
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def def_modifier(node = self)
arg = node.children[2]
return unless node.send_type? && node.receiver.nil? && arg.is_a?(::AST::Node)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method delimiter
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def delimiter(*deprecated, with_spacing: deprecated.first)
if with_spacing
hash_rocket? ? SPACED_HASH_ROCKET : SPACED_COLON
else
hash_rocket? ? HASH_ROCKET : COLON
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method parent_module_name
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def parent_module_name
# what class or module is this method/constant/etc definition in?
# returns nil if answer cannot be determined
ancestors = each_ancestor(:class, :module, :sclass, :casgn, :block)
result = ancestors.filter_map do |ancestor|
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"