Showing 287 of 287 total issues
Module has too many lines. [270/100] Open
module Core
# @private variable will include hash with data for validation
@@phone_data = nil
# eagerly initialize the gem, loads data into memory. not required, initialization is done lazily otherwise, but
- Read upRead up
- Exclude checks
This cop checks if the length a module exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Class has too many lines. [226/100] Open
class Importer
include Phonelib::DataImporterHelper
# countries that can have double country prefix in number
DOUBLE_COUNTRY_CODES_COUNTRIES = %w(IN DE BR IT NO PL CU VN)
- 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.
Module has too many lines. [134/100] Open
module PhoneAnalyzer
# extending with helper methods for analyze
include Phonelib::PhoneAnalyzerHelper
# array of types not included for validation check in cycle
- Read upRead up
- Exclude checks
This cop checks if the length a module exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Module has too many lines. [124/100] Open
module PhoneAnalyzerHelper
private
def decorate_analyze_result(result)
if result.size == 1
- Read upRead up
- Exclude checks
This cop checks if the length a module exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Module has too many lines. [112/100] Open
module PhoneFormatter
# Returns formatted national number
# @param formatted [Boolean] whether to return numbers only or formatted
# @return [String] formatted national number
def national(formatted = true)
- Read upRead up
- Exclude checks
This cop checks if the length a module exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Class has too many lines. [109/100] Open
class Phone
# @!attribute [r] original
# @return [String] original phone number passed for parsing
attr_reader :original
# @!attribute [r] extension
- 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.
Module has too many lines. [102/100] Open
module DataImporterHelper
# xml comments attributes names that should not be parsed
XML_COMMENT_ATTRIBUTES = %w(text comment)
# xml format attributes names
XML_FORMAT_NAMES = %w(intlFormat format)
- Read upRead up
- Exclude checks
This cop checks if the length a module exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Assignment Branch Condition size for load_data is too high. [36.47/15] Open
def load_data
data_file = "#{File.dirname(__FILE__)}/../../#{FILE_MAIN_DATA}"
default_data = Marshal.load(File.binread(data_file))
if override_phone_data
override_data_file = Marshal.load(File.binread(override_phone_data))
- 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. [22/10] Open
def load_data
data_file = "#{File.dirname(__FILE__)}/../../#{FILE_MAIN_DATA}"
default_data = Marshal.load(File.binread(data_file))
if override_phone_data
override_data_file = Marshal.load(File.binread(override_phone_data))
- 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. [21/10] Open
def hash_from_xml(data, type)
hash = {}
case type
when :attributes
data.attributes.each do |k, v|
- 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.
File core.rb
has 273 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Phonelib
# main module that includes all basic data and methods
module Core
# @private variable will include hash with data for validation
@@phone_data = nil
Assignment Branch Condition size for merge_short_with_main_type is too high. [22.38/15] Open
def merge_short_with_main_type(country_id, type, data)
@data[country_id][:types][type] ||= {}
@data[country_id][:types][type][Core::SHORT] ||= {}
data.each do |k, v|
if @data[country_id][:types][type][Core::SHORT][k]
- 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 international is too high. [22.93/15] 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 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
Class Phone
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class Phone
# @!attribute [r] original
# @return [String] original phone number passed for parsing
attr_reader :original
# @!attribute [r] extension
Assignment Branch Condition size for hash_from_xml is too high. [20.05/15] Open
def hash_from_xml(data, type)
hash = {}
case type
when :attributes
data.attributes.each do |k, v|
- 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 country_code is too high. [20.27/15] Open
def country_code
return @country_code if @country_code
code = Phonelib.phone_data[country] && Phonelib.phone_data[country][Core::COUNTRY_CODE]
return @country_code = code unless code == '1' && Phonelib.phone_data[country][Core::LEADING_DIGITS]
- 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. [15/10] 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 if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Assignment Branch Condition size for detect_and_parse is too high. [18.47/15] 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 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 convert_to_e164 is too high. [17.49/15] 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 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