Showing 30 of 30 total issues
Method validate
has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring. Open
def self.validate(str)
msg = "The argument to this method must be of type String."
raise ::TypeError, msg unless str.is_a? String
msg = "The string to be checked was empty."
raise Taipo::SyntaxError, msg if str.empty?
- 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 validate_constraints
has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring. Open
def self.validate_constraints(str, start: 0)
status_array = [ :rpr, :hsh, :cln, :sls, :qut, :cma, :spc, :oth ]
counter_array = [ [ :const ], { const: ":' or '#" } ]
state = SyntaxState.new(status_array, counter_array)
- 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 validate
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.validate(str)
msg = "The argument to this method must be of type String."
raise ::TypeError, msg unless str.is_a? String
msg = "The string to be checked was empty."
raise Taipo::SyntaxError, msg if str.empty?
Method validate_regex
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def self.validate_regex(str, start: 0)
status_array = [ :bsl, :sls, :opt, :oth ]
counter_array = [ [ :backslash ], { backslash: '/' } ]
state = SyntaxState.new(status_array, counter_array)
- 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 validate_string
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def self.validate_string(str, start: 0)
status_array = [ :bsl, :qut, :oth ]
counter_array = [ [ :backslash ], { backslash: '/' } ]
state = SyntaxState.new(status_array, counter_array)
- 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 validate_constraints
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.validate_constraints(str, start: 0)
status_array = [ :rpr, :hsh, :cln, :sls, :qut, :cma, :spc, :oth ]
counter_array = [ [ :const ], { const: ":' or '#" } ]
state = SyntaxState.new(status_array, counter_array)
Method object_to_type_def
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def self.object_to_type_def(obj)
return obj.class.name unless obj.is_a? Enumerable
if obj.is_a? Array
element_types = Hash.new
- 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 escape?
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def self.escape?(c, states)
if states[:esc]
states[:esc] = false
return skip, states
end
- 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 initialize
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def initialize(name:, children: nil, constraints: nil)
msg = 'Argument name was not a String.'
raise ::TypeError, msg unless name.is_a? String
msg = 'Argument name was an empty string.'
raise ::ArgumentError if name.empty?
- 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 parse_value
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def parse_value(v)
return nil if v == nil
case @name
when Constraint::METHOD
- 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 parse_definition
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.parse_definition(str)
Taipo::Parser::Validater.validate str
stack = Taipo::Parser::Stack.new
i = 0
Method constrain?
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def constrain?(arg)
case @name
when Constraint::METHOD
arg.respond_to? @value
when 'format'
- 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 match_children?
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def match_children?(arg)
self_childless = @children.nil?
arg_childless = !arg.is_a?(Enumerable) || arg.count == 0
return true if self_childless
return false if !self_childless && arg_childless
- 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 validate_regex
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.validate_regex(str, start: 0)
status_array = [ :bsl, :sls, :opt, :oth ]
counter_array = [ [ :backslash ], { backslash: '/' } ]
state = SyntaxState.new(status_array, counter_array)
Method validate_string
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.validate_string(str, start: 0)
status_array = [ :bsl, :qut, :oth ]
counter_array = [ [ :backslash ], { backslash: '/' } ]
state = SyntaxState.new(status_array, counter_array)
Method constrain?
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def constrain?(arg)
case @name
when Constraint::METHOD
arg.respond_to? @value
when 'format'
Method object_to_type_def
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.object_to_type_def(obj)
return obj.class.name unless obj.is_a? Enumerable
if obj.is_a? Array
element_types = Hash.new
Method parse_constraint
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.parse_constraint(str)
str.strip!
in_name = nil
name = ''
content = ''
- 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 check
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def check(context, collect_invalids = false, **checks)
msg = "The first argument to this method must be of type Binding."
raise ::TypeError, msg unless context.is_a? Binding
checks.reduce(Array.new) do |memo,(k,v)|
- 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 match_class?
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def match_class?(arg)
actual_name = (optional?) ? @name[0..-2] : @name
if actual_name == 'Boolean'
arg.is_a?(TrueClass) || arg.is_a?(FalseClass)
else
- 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"