Showing 280 of 280 total issues
Assignment Branch Condition size for formatting_data is too high. [17.03/15] Open
def formatting_data
return @formatting_data if defined?(@formatting_data)
data = @data[country]
format = data[:format]
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Assignment Branch Condition size for import_country_names is too high. [17.72/15] Open
def import_country_names
puts 'IMPORTING COUNTRY NAMES'
require 'open-uri'
require 'csv'
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Cyclomatic complexity for international is too high. [8/6] Open
def international(formatted = true, prefix = '+')
prefix = formatted if formatted.is_a?(String)
return nil if sanitized.empty?
return "#{prefix}#{country_prefix_or_not}#{sanitized}" unless possible?
return "#{prefix}#{data_country_code}#{@national_number}" unless formatted
- 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.
Assignment Branch Condition size for add_additional_regex is too high. [16.61/15] Open
def add_additional_regex(country, type, national_regex)
return unless Phonelib::Core::TYPES_DESC.keys.include?(type.to_sym)
return unless national_regex.is_a?(String)
@@phone_data = @@data_by_country_codes = nil
@@additional_regexes[country.to_s.upcase] ||= {}
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Method has too many lines. [11/10] Open
def detect_and_parse(phone, country)
countries_data = country_code_candidates_for(phone).flat_map { |code|
Phonelib.data_by_country_codes[code] || []
}
countries_data.each_with_object({}) do |data, result|
- 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 validate_each is too high. [7/6] Open
def validate_each(record, attribute, value)
return if options[:allow_blank] && value.blank?
@phone = parse(value, specified_country(record))
valid = phone_valid? && valid_types? && valid_country? && valid_extensions?
- 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 validate_each is too high. [7/6] Open
def validate_each(record, attribute, value)
return if options[:allow_blank] && value.blank?
@phone = parse(value, specified_country(record))
valid = phone_valid? && valid_types? && valid_country? && valid_extensions?
- 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 detect_and_parse is too high. [7/6] Open
def detect_and_parse(phone, country)
countries_data = country_code_candidates_for(phone).flat_map { |code|
Phonelib.data_by_country_codes[code] || []
}
countries_data.each_with_object({}) do |data, result|
- 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. [11/10] Open
def international(formatted = true, prefix = '+')
prefix = formatted if formatted.is_a?(String)
return nil if sanitized.empty?
return "#{prefix}#{country_prefix_or_not}#{sanitized}" unless possible?
return "#{prefix}#{data_country_code}#{@national_number}" unless formatted
- 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 ext_data
return @ext_data if defined?(@ext_data) && @ext_data
result = default_ext_data
return result unless possible?
- 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 convert_to_e164(phone, data)
match = phone.match full_regex_for_data(data, Core::VALID_PATTERN, !original_starts_with_plus?)
case
when match
"#{data[Core::COUNTRY_CODE]}#{match.to_a.last}"
- 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 separate_extension is too high. [8/7] Open
def separate_extension(original)
return [original, ''] unless Phonelib.extension_separate_symbols
regex = if Phonelib.extension_separate_symbols.is_a?(Array)
cr("#{Phonelib.extension_separate_symbols.join('|')}")
- 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 save_extended_data_file
extended = {
Phonelib::Core::EXT_PREFIXES => @prefixes,
Phonelib::Core::EXT_GEO_NAMES => @geo_names,
Phonelib::Core::EXT_COUNTRY_NAMES => @countries,
- 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 separate_extension is too high. [7/6] Open
def separate_extension(original)
return [original, ''] unless Phonelib.extension_separate_symbols
regex = if Phonelib.extension_separate_symbols.is_a?(Array)
cr("#{Phonelib.extension_separate_symbols.join('|')}")
- 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. [11/10] Open
def run_import
clone_repo
import_main_data
import_short_data
import_alternate_formats
- 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 fill_possible_to_types_if_nil(result)
result[:types].each do |type, data|
if data[Core::VALID_PATTERN] && !data[Core::POSSIBLE_PATTERN]
result[:types][type][Core::POSSIBLE_PATTERN] = case type
when Core::GENERAL
- 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 area_code_possible? is too high. [7/6] Open
def area_code_possible?
return false if impossible?
# has national prefix
return false unless @data[country][Core::NATIONAL_PREFIX] || country == 'IT'
- 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.
Perceived complexity for international is too high. [8/7] Open
def international(formatted = true, prefix = '+')
prefix = formatted if formatted.is_a?(String)
return nil if sanitized.empty?
return "#{prefix}#{country_prefix_or_not}#{sanitized}" unless possible?
return "#{prefix}#{data_country_code}#{@national_number}" unless formatted
- 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
Assignment Branch Condition size for import_alternate_formats is too high. [15.17/15] Open
def import_alternate_formats
puts 'IMPORTING ALTERNATE FORMATS'
main_from_xml("#{@destination}#{FORMATS_FILE}").elements.each do |el|
el.children.each do |phone_type|
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Assignment Branch Condition size for full_regex_for_data is too high. [15.33/15] Open
def full_regex_for_data(data, type, country_optional = true)
regex = []
regex << '0{2}?'
regex << "(#{data[Core::INTERNATIONAL_PREFIX]})?"
regex << "(#{data[Core::COUNTRY_CODE]})#{country_optional ? '?' : ''}"
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric