Showing 79 of 214 total issues
Consider simplifying this complex logical expression. Open
parse_err(strict, errors, "multiple values for :TYPE parameter of #{prop}", ctx) if params[:TYPE].is_a?(Array) && params[:TYPE].length > 1 && prop != :EMAIL && prop != :ADR && prop != :TEL && prop != :LABEL && prop != :IMPP
Method date_time
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def date_time
hour = /[0-9]{2}/.r
minute = /[0-9]{2}/.r
second = /[0-9]{2}/.r
time_notrunc = seq(hour, minute, second, C::ZONE._?) do |(h, m, s, z)|
- 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 time_t
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def time_t
hour = /[0-9]{2}/.r
minute = /[0-9]{2}/.r
second = /[0-9]{2}/.r
time1 = seq(hour, minute, second, C::ZONE._?) do |(h, m, s, z)|
- 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 time_notrunc
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def time_notrunc
time_notrunc1 = seq(hour, minute, second, C::ZONE._?) do |(h, m, s, z)|
h = { hour: h, min: m, sec: s }
h[:zone] = z[0] unless z.empty?
h
- 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 typematch
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def typematch(strict, key, params, component, value, ctx)
Method to_s
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def to_s
ret = "P"
ret = value[:sign] + ret if value[:sign]
ret = ret + "#{value[:weeks]}W" if value[:weeks]
ret = ret + "#{value[:days]}D" if value[:days]
- 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 typematch
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def typematch(strict, key, params, _component, value, ctx)
Consider simplifying this complex logical expression. Open
ret += ";#{Text.listencode value[:ext]}" if !value[:ext].empty? || !value[:street].empty? || !value[:locality].empty? || !value[:region].empty? || !value[:code].empty? || !value[:country].empty?
Method typematch
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def typematch(strict, key, params, _component, value)
Method property_parent
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def property_parent(strict, key, component, _value, ctx1)
Method to_s
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def to_s
ret = Text.listencode value[:pobox]
ret += ";#{Text.listencode value[:ext]}" if !value[:ext].empty? || !value[:street].empty? || !value[:locality].empty? || !value[:region].empty? || !value[:code].empty? || !value[:country].empty?
ret += ";#{Text.listencode value[:street]}" if !value[:street].empty? || !value[:locality].empty? || !value[:region].empty? || !value[:code].empty? || !value[:country].empty?
ret += ";#{Text.listencode value[:locality]}" if !value[:locality].empty? || !value[:region].empty? || !value[:code].empty? || !value[:country].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 to_hash
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def to_hash
ret = {}
ret[:year] = value[:year] if value[:year]
ret[:month] = value[:month] if value[:month]
ret[:day] = value[:day] if value[:day]
- 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 to_hash
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def to_hash
ret = {}
if multiple
ret[prop_name] = []
multiple.each do |c|
- 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 child_class
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def child_class(key, val)
base_class = if val.is_a?(Hash) && val.has_key?(:component)
component_base_class
elsif !(val.is_a?(Hash) && !val.has_key?(:value))
property_base_class
- 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 date_or_date_time
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def date_or_date_time
utc_offset = seq(C::SIGN, /[0-9]{2}/.r << /:/.r._?, /[0-9]{2}/.r) do |(s, h, m)|
{ sign: s, hour: h, min: m }
end
zone = utc_offset.map { |u| u } |
- 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 date_time
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def date_time
utc_offset = seq(C::SIGN, /[0-9]{2}/.r << /:/.r._?, /[0-9]{2}/.r) do |(s, h, m)|
{ sign: s, hour: h, min: m }
end
zone = utc_offset.map { |u| u } |
- 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 time_t
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def time_t
utc_offset = seq(C::SIGN, /[0-9]{2}/.r << /:/.r._?, /[0-9]{2}/.r) do |(s, h, m)|
{ sign: s, hour: h, min: m }
end
zone = utc_offset.map { |u| u } |
- 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 request_statusvalue
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def request_statusvalue
@req_status = Set.new %w{2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 2.10 2.11 3.0 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 4.0 5.0 5.1 5.2 5.3}
extdata = seq(";".r, C::TEXT) { |(_, t)| t }
request_statusvalue = seq(/[0-9](\.[0-9]){1,2}/.r << ";".r, C::TEXT, extdata._?) do |(n, t1, t2)|
return { error: "Invalid request status #{n}" } unless @req_status.include?(n) # RFC 5546
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
def initialize(val)
self.value = val.clone
self.type = "date"
# fill in unspecified month && year && date; only for purposes of comparison
val[:year] = sprintf("%04d", ::Date.today.year) unless val.has_key?(:year)
- 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"