Showing 158 of 158 total issues
Class has too many lines. [200/100] Open
class Psych
NO_ANALYSIS_KEY_FOUND_ERROR = "No languages or engines key found. Must have analysis key.".freeze
class SetNode < DelegateClass(::Psych::Nodes::Mapping)
def children
- Read upRead up
- Exclude checks
This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Class has too many lines. [170/100] Open
class Mapping < Node
INCOMPATIBLE_KEYS_WARNING = "Use either a languages key or an engines key, but not both. They are mutually exclusive.".freeze
def self.mapping
@mapping ||= superclass.respond_to?(:mapping) ? superclass.mapping.dup : {}
- Read upRead up
- Exclude checks
This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Class has too many lines. [105/100] Open
class Sequence < Node
attr_reader :children
alias_method :__getobj__, :children
def self.[](node_type)
- Read upRead up
- Exclude checks
This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Class Mapping
has 33 methods (exceeds 20 allowed). Consider refactoring. Open
class Mapping < Node
INCOMPATIBLE_KEYS_WARNING = "Use either a languages key or an engines key, but not both. They are mutually exclusive.".freeze
def self.mapping
@mapping ||= superclass.respond_to?(:mapping) ? superclass.mapping.dup : {}
Class Node
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class Node
def self.has_default?
false
end
Method has too many lines. [19/10] Open
def accept_mapping(node, value)
case value.tag
when MAP, OMAP, PAIRS then node.visit_mapping self, value
when SET then node.visit_sequence self, SetNode.new(value)
when SEQ then node.visit_sequence self, value
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Class Sequence
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class Sequence < Node
attr_reader :children
alias_method :__getobj__, :children
def self.[](node_type)
Cyclomatic complexity for accept_scalar is too high. [11/6] Open
def accept_scalar(node, value)
case tag = scalar_tag(value)
when BINARY then node.visit_scalar self, :binary, value, value.tag.nil?
when BOOL then node.visit_scalar self, :bool, value, value.tag.nil?
when FLOAT then node.visit_scalar self, :float, value, value.tag.nil?
- Read upRead up
- Exclude checks
This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.
An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.
Cyclomatic complexity for cast is too high. [10/6] Open
def cast(type, value)
case type
when :str then value.value
when :binary then value.value.unpack("m").first
when :bool then value.value !~ FALSE
- Read upRead up
- Exclude checks
This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.
An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.
Method has too many lines. [13/10] Open
def accept_scalar(node, value)
case tag = scalar_tag(value)
when BINARY then node.visit_scalar self, :binary, value, value.tag.nil?
when BOOL then node.visit_scalar self, :bool, value, value.tag.nil?
when FLOAT then node.visit_scalar self, :float, value, value.tag.nil?
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Cyclomatic complexity for serialize_scalar is too high. [9/6] Open
def serialize_scalar(node)
case value = node.value
when true, false then serialize_bool(value)
when Float then serialize_float(value)
when Integer then serialize_integer(value)
- Read upRead up
- Exclude checks
This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.
An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.
Cyclomatic complexity for accept is too high. [8/6] Open
def accept(node, value)
case value
when ::Psych::Nodes::Scalar then accept_scalar node, value
when ::Psych::Nodes::Mapping then accept_mapping node, value
when ::Psych::Nodes::Sequence then accept_sequence node, value
- Read upRead up
- Exclude checks
This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.
An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.
Cyclomatic complexity for accept_mapping is too high. [8/6] Open
def accept_mapping(node, value)
case value.tag
when MAP, OMAP, PAIRS then node.visit_mapping self, value
when SET then node.visit_sequence self, SetNode.new(value)
when SEQ then node.visit_sequence self, value
- Read upRead up
- Exclude checks
This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.
An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.
Method has too many lines. [12/10] Open
def cast(type, value)
case type
when :str then value.value
when :binary then value.value.unpack("m").first
when :bool then value.value !~ FALSE
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method has too many lines. [12/10] Open
def visit_child(visitor, value)
child =
if self.class.type
self.class.type.new(self)
else
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method has too many lines. [12/10] Open
def serialize_scalar(node)
case value = node.value
when true, false then serialize_bool(value)
when Float then serialize_float(value)
when Integer then serialize_integer(value)
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method has too many lines. [12/10] Open
def parse(root = nil)
root ||= CC::Yaml::Nodes::Root.new
parsed = @value if @value.is_a? ::Psych::Nodes::Node
parsed ||= ::Psych.parse(@value)
accept(root, parsed)
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Perceived complexity for accept_mapping is too high. [8/7] Open
def accept_mapping(node, value)
case value.tag
when MAP, OMAP, PAIRS then node.visit_mapping self, value
when SET then node.visit_sequence self, SetNode.new(value)
when SEQ then node.visit_sequence self, value
- Read upRead up
- Exclude checks
This cop tries to produce a complexity score that's a measure of the
complexity the reader experiences when looking at a method. For that
reason it considers when
nodes as something that doesn't add as much
complexity as an if
or a &&
. Except if it's one of those special
case
/when
constructs where there's no expression after case
. Then
the cop treats it as an if
/elsif
/elsif
... and lets all the when
nodes count. In contrast to the CyclomaticComplexity cop, this cop
considers else
nodes as adding complexity.
Example:
def my_method # 1
if cond # 1
case var # 2 (0.8 + 4 * 0.2, rounded)
when 1 then func_one
when 2 then func_two
when 3 then func_three
when 4..10 then func_other
end
else # 1
do_something until a && b # 2
end # ===
end # 7 complexity points
Method has too many lines. [11/10] Open
def serialize_secure(value)
case options[:secure]
when :decrypted
raise ArgumentError, "secure option is set decrypted, but a secure value is not decrypted" unless value.decrypted?
serialize_decrypted(value)
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method has too many lines. [11/10] Open
def self.map(*list)
options = Hash === list.last ? list.pop : {}
list.each do |key|
required << key.to_s if options[:required]
define_map_accessor(key)
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.