daddyz/phonelib

View on GitHub
lib/phonelib/core.rb

Summary

Maintainability
B
4 hrs
Test Coverage

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
Severity: Minor
Found in lib/phonelib/core.rb by rubocop

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))
Severity: Minor
Found in lib/phonelib/core.rb by rubocop

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))
Severity: Minor
Found in lib/phonelib/core.rb by rubocop

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
Severity: Minor
Found in lib/phonelib/core.rb - About 2 hrs to fix

    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] ||= {}
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    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 load_data has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    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))
    Severity: Minor
    Found in lib/phonelib/core.rb - About 1 hr to fix

    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 add_additional_regex has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    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] ||= {}
    Severity: Minor
    Found in lib/phonelib/core.rb - About 25 mins to fix

    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

    Line is too long. [116/80]
    Open

        # eagerly initialize the gem, loads data into memory. not required, initialization is done lazily otherwise, but
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    Line is too long. [133/80]
    Open

        # @return [Boolean] Flag defines whether to ignore plus for country reset during validations in case country prefix doesn't match
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    Replace class var @@phone_data with a class instance var.
    Open

          @@phone_data ||= load_data.freeze
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    This cop checks for uses of class variables. Offenses are signaled only on assignment to class variables to reduce the number of offenses that would be reported.

    Replace class var @@parse_special with a class instance var.
    Open

          @@parse_special = special
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    This cop checks for uses of class variables. Offenses are signaled only on assignment to class variables to reduce the number of offenses that would be reported.

    Replace class var @@ignore_plus with a class instance var.
    Open

        @@ignore_plus = false
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    This cop checks for uses of class variables. Offenses are signaled only on assignment to class variables to reduce the number of offenses that would be reported.

    Replace class var @@vanity_conversion with a class instance var.
    Open

        @@vanity_conversion = false
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    This cop checks for uses of class variables. Offenses are signaled only on assignment to class variables to reduce the number of offenses that would be reported.

    Unused block argument - k. If it's necessary, use _ or _k as an argument name to indicate that it won't be used.
    Open

          @@all_int_prefixes ||= phone_data.map {|k,v| v[:international_prefix] }.select { |v| v != '' }.compact.uniq.join('|').freeze
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    This cop checks for unused block arguments.

    Example:

    # bad
    
    do_something do |used, unused|
      puts used
    end
    
    do_something do |bar|
      puts :foo
    end
    
    define_method(:foo) do |bar|
      puts :baz
    end

    Example:

    #good
    
    do_something do |used, _unused|
      puts used
    end
    
    do_something do
      puts :foo
    end
    
    define_method(:foo) do |_bar|
      puts :baz
    end

    Replace class var @@extension_separate_symbols with a class instance var.
    Open

          @@extension_separate_symbols = separator
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    This cop checks for uses of class variables. Offenses are signaled only on assignment to class variables to reduce the number of offenses that would be reported.

    Freeze mutable objects assigned to constants.
    Open

        FILE_EXT_DATA = 'data/extended_data.dat'
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    This cop checks whether some constant value isn't a mutable literal (e.g. array or hash).

    Example:

    # bad
    CONST = [1, 2, 3]
    
    # good
    CONST = [1, 2, 3].freeze

    Line is too long. [85/80]
    Open

        # @return [Boolean] Flag defines whether to do strict double prefix parsing check
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    Line is too long. [84/80]
    Open

                  default_data[country][Core::TYPES][type][key] << "|#{regex.join('|')}"
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    Replace class var @@phone_data with a class instance var.
    Open

          @@phone_data = @@data_by_country_codes = nil
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    This cop checks for uses of class variables. Offenses are signaled only on assignment to class variables to reduce the number of offenses that would be reported.

    Replace class var @@data_by_country_codes with a class instance var.
    Open

          @@phone_data = @@data_by_country_codes = nil
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    This cop checks for uses of class variables. Offenses are signaled only on assignment to class variables to reduce the number of offenses that would be reported.

    Line is too long. [91/80]
    Open

        # may be desirable in production enviroments to avoid initialization time on first use.
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    Line is too long. [102/80]
    Open

        # @return [String,Symbol,Array<String,Symbol>] Default country ISO2 code or codes used for parsing
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    Replace class var @@strict_double_prefix_check with a class instance var.
    Open

          @@strict_double_prefix_check = strict
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    This cop checks for uses of class variables. Offenses are signaled only on assignment to class variables to reduce the number of offenses that would be reported.

    Do not freeze immutable objects, as freezing them has no effect.
    Open

        VANITY_4_LETTERS_KEYS_REGEX = /[SVYZ]/.freeze
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    This cop check for uses of Object#freeze on immutable objects.

    Example:

    # bad
    CONST = 1.freeze
    
    # good
    CONST = 1

    Avoid using Marshal.load.
    Open

            override_data_file = Marshal.load(File.binread(override_phone_data))
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    This cop checks for the use of Marshal class methods which have potential security issues leading to remote code execution when loading from an untrusted source.

    Example:

    # bad
    Marshal.load("{}")
    Marshal.restore("{}")
    
    # good
    Marshal.dump("{}")
    
    # okish - deep copy hack
    Marshal.load(Marshal.dump({}))

    Replace class var @@sanitize_regex with a class instance var.
    Open

        @@sanitize_regex = '[^0-9]+'
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    This cop checks for uses of class variables. Offenses are signaled only on assignment to class variables to reduce the number of offenses that would be reported.

    Missing magic comment # frozen_string_literal: true.
    Open

    module Phonelib
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    This cop is designed to help upgrade to Ruby 3.0. It will add the comment # frozen_string_literal: true to the top of files to enable frozen string literals. Frozen string literals may be default in Ruby 3.0. The comment will be added below a shebang and encoding comment. The frozen string literal comment is only valid in Ruby 2.3+.

    Example: EnforcedStyle: when_needed (default)

    # The `when_needed` style will add the frozen string literal comment
    # to files only when the `TargetRubyVersion` is set to 2.3+.
    # bad
    module Foo
      # ...
    end
    
    # good
    # frozen_string_literal: true
    
    module Foo
      # ...
    end

    Example: EnforcedStyle: always

    # The `always` style will always add the frozen string literal comment
    # to a file, regardless of the Ruby version or if `freeze` or `<<` are
    # called on a string literal.
    # bad
    module Bar
      # ...
    end
    
    # good
    # frozen_string_literal: true
    
    module Bar
      # ...
    end

    Example: EnforcedStyle: never

    # The `never` will enforce that the frozen string literal comment does
    # not exist in a file.
    # bad
    # frozen_string_literal: true
    
    module Baz
      # ...
    end
    
    # good
    module Baz
      # ...
    end

    Replace class var @@phone_regexp_cache with a class instance var.
    Open

        @@phone_regexp_cache = {}
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    This cop checks for uses of class variables. Offenses are signaled only on assignment to class variables to reduce the number of offenses that would be reported.

    Replace class var @@default_country with a class instance var.
    Open

        @@default_country = nil
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    This cop checks for uses of class variables. Offenses are signaled only on assignment to class variables to reduce the number of offenses that would be reported.

    Replace class var @@extension_separator with a class instance var.
    Open

          @@extension_separator = separator
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    This cop checks for uses of class variables. Offenses are signaled only on assignment to class variables to reduce the number of offenses that would be reported.

    Replace class var @@ignore_plus with a class instance var.
    Open

          @@ignore_plus = ignore_plus
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    This cop checks for uses of class variables. Offenses are signaled only on assignment to class variables to reduce the number of offenses that would be reported.

    Line is too long. [130/80]
    Open

          @@all_int_prefixes ||= phone_data.map {|k,v| v[:international_prefix] }.select { |v| v != '' }.compact.uniq.join('|').freeze
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    Replace class var @@skip_eager_loading with a class instance var.
    Open

          @@skip_eager_loading = true
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    This cop checks for uses of class variables. Offenses are signaled only on assignment to class variables to reduce the number of offenses that would be reported.

    Replace class var @@data_by_country_codes with a class instance var.
    Open

          @@data_by_country_codes ||= phone_data.each_value.group_by { |d| d[COUNTRY_CODE] }.freeze
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    This cop checks for uses of class variables. Offenses are signaled only on assignment to class variables to reduce the number of offenses that would be reported.

    Replace class var @@extension_separator with a class instance var.
    Open

        @@extension_separator = ';'
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    This cop checks for uses of class variables. Offenses are signaled only on assignment to class variables to reduce the number of offenses that would be reported.

    Freeze mutable objects assigned to constants.
    Open

        FILE_MAIN_DATA = 'data/phone_data.dat'
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    This cop checks whether some constant value isn't a mutable literal (e.g. array or hash).

    Example:

    # bad
    CONST = [1, 2, 3]
    
    # good
    CONST = [1, 2, 3].freeze

    Line is too long. [106/80]
    Open

        # @return [String,Symbol,Array<String,Symbol>,nil] Default country ISO2 code or codes used for parsing
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    Replace class var @@phone_ext_data with a class instance var.
    Open

          @@phone_ext_data ||= load_ext_data.freeze
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    This cop checks for uses of class variables. Offenses are signaled only on assignment to class variables to reduce the number of offenses that would be reported.

    Replace class var @@default_country with a class instance var.
    Open

          @@default_country = country
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    This cop checks for uses of class variables. Offenses are signaled only on assignment to class variables to reduce the number of offenses that would be reported.

    Replace class var @@strict_check with a class instance var.
    Open

          @@strict_check = strict
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    This cop checks for uses of class variables. Offenses are signaled only on assignment to class variables to reduce the number of offenses that would be reported.

    Replace class var @@additional_regexes with a class instance var.
    Open

          @@additional_regexes = {}
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    This cop checks for uses of class variables. Offenses are signaled only on assignment to class variables to reduce the number of offenses that would be reported.

    Replace class var @@all_int_prefixes with a class instance var.
    Open

          @@all_int_prefixes ||= phone_data.map {|k,v| v[:international_prefix] }.select { |v| v != '' }.compact.uniq.join('|').freeze
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    This cop checks for uses of class variables. Offenses are signaled only on assignment to class variables to reduce the number of offenses that would be reported.

    Replace class var @@sanitize_regex with a class instance var.
    Open

          @@sanitize_regex = regex.is_a?(String) ? regex : regex.to_s
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    This cop checks for uses of class variables. Offenses are signaled only on assignment to class variables to reduce the number of offenses that would be reported.

    Replace class var @@skip_eager_loading with a class instance var.
    Open

        @@skip_eager_loading = false
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    This cop checks for uses of class variables. Offenses are signaled only on assignment to class variables to reduce the number of offenses that would be reported.

    Replace class var @@strict_double_prefix_check with a class instance var.
    Open

        @@strict_double_prefix_check = false
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    This cop checks for uses of class variables. Offenses are signaled only on assignment to class variables to reduce the number of offenses that would be reported.

    Replace class var @@override_phone_data with a class instance var.
    Open

        @@override_phone_data = nil
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    This cop checks for uses of class variables. Offenses are signaled only on assignment to class variables to reduce the number of offenses that would be reported.

    Replace class var @@vanity_conversion with a class instance var.
    Open

          @@vanity_conversion = value
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    This cop checks for uses of class variables. Offenses are signaled only on assignment to class variables to reduce the number of offenses that would be reported.

    Line is too long. [95/80]
    Open

          @@data_by_country_codes ||= phone_data.each_value.group_by { |d| d[COUNTRY_CODE] }.freeze
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    Line is too long. [93/80]
    Open

                  default_data[country][Core::TYPES][Core::GENERAL][key] << "|#{regex.join('|')}"
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    %w-literals should be delimited by [ and ].
    Open

        AREA_CODE_MOBILE_COUNTRIES = %w(AR MX BR).freeze
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    This cop enforces the consistent usage of %-literal delimiters.

    Specify the 'default' key to set all preferred delimiters at once. You can continue to specify individual preferred delimiters to override the default.

    Example:

    # Style/PercentLiteralDelimiters:
    #   PreferredDelimiters:
    #     default: '[]'
    #     '%i':    '()'
    
    # good
    %w[alpha beta] + %i(gamma delta)
    
    # bad
    %W(alpha #{beta})
    
    # bad
    %I(alpha beta)

    Use %i or %I for an array of symbols.
    Open

        SHORT_CODES = [
          :short_code, :emergency, :carrier_specific, :sms_services,
          :expanded_emergency, :no_international_dialling, :carrier_services,
          :directory_services, :standard_rate, :carrier_selection_codes,
          :area_code_optional
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    This cop can check for array literals made up of symbols that are not using the %i() syntax.

    Alternatively, it checks for symbol arrays using the %i() syntax on projects which do not want to use that syntax.

    Configuration option: MinSize If set, arrays with fewer elements than this value will not trigger the cop. For example, a MinSize of3` will not enforce a style on an array of 2 or fewer elements.

    Example: EnforcedStyle: percent (default)

    # good
    %i[foo bar baz]
    
    # bad
    [:foo, :bar, :baz]

    Example: EnforcedStyle: brackets

    # good
    [:foo, :bar, :baz]
    
    # bad
    %i[foo bar baz]

    Space between { and | missing.
    Open

          @@all_int_prefixes ||= phone_data.map {|k,v| v[:international_prefix] }.select { |v| v != '' }.compact.uniq.join('|').freeze
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    Checks that block braces have or don't have surrounding space inside them on configuration. For blocks taking parameters, it checks that the left brace has or doesn't have trailing space depending on configuration.

    Example: EnforcedStyle: space (default)

    # The `space` style enforces that block braces have
    # surrounding space.
    
    # bad
    some_array.each {puts e}
    
    # good
    some_array.each { puts e }

    Example: EnforcedStyle: no_space

    # The `no_space` style enforces that block braces don't
    # have surrounding space.
    
    # bad
    some_array.each { puts e }
    
    # good
    some_array.each {puts e}

    Example: EnforcedStyleForEmptyBraces: no_space (default)

    # The `no_space` EnforcedStyleForEmptyBraces style enforces that
    # block braces don't have a space in between when empty.
    
    # bad
    some_array.each {   }
    some_array.each {  }
    some_array.each { }
    
    # good
    some_array.each {}

    Example: EnforcedStyleForEmptyBraces: space

    # The `space` EnforcedStyleForEmptyBraces style enforces that
    # block braces have at least a spece in between when empty.
    
    # bad
    some_array.each {}
    
    # good
    some_array.each { }
    some_array.each {  }
    some_array.each {   }

    Example: SpaceBeforeBlockParameters: true (default)

    # The SpaceBeforeBlockParameters style set to `true` enforces that
    # there is a space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each {|n| n * 2 }
    
    # good
    [1, 2, 3].each { |n| n * 2 }

    Example: SpaceBeforeBlockParameters: true

    # The SpaceBeforeBlockParameters style set to `false` enforces that
    # there is no space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each { |n| n * 2 }
    
    # good
    [1, 2, 3].each {|n| n * 2 }

    Replace class var @@phone_ext_data with a class instance var.
    Open

        @@phone_ext_data = nil
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    This cop checks for uses of class variables. Offenses are signaled only on assignment to class variables to reduce the number of offenses that would be reported.

    Replace class var @@extension_separate_symbols with a class instance var.
    Open

        @@extension_separate_symbols = '#;'
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    This cop checks for uses of class variables. Offenses are signaled only on assignment to class variables to reduce the number of offenses that would be reported.

    Replace class var @@strict_check with a class instance var.
    Open

        @@strict_check = false
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    This cop checks for uses of class variables. Offenses are signaled only on assignment to class variables to reduce the number of offenses that would be reported.

    Space missing after comma.
    Open

          @@all_int_prefixes ||= phone_data.map {|k,v| v[:international_prefix] }.select { |v| v != '' }.compact.uniq.join('|').freeze
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    Checks for comma (,) not followed by some kind of space.

    Example:

    # bad
    [1,2]
    { foo:bar,}
    
    # good
    [1, 2]
    { foo:bar, }

    Line is too long. [109/80]
    Open

        # @param country [String,Symbol,Array<String,Symbol>] Default country ISO2 code or codes used for parsing
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    Line is too long. [85/80]
    Open

        # @return [Boolean] Flag defines whether to do strict double prefix parsing check
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    Replace class var @@phone_data with a class instance var.
    Open

        @@phone_data = nil
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    This cop checks for uses of class variables. Offenses are signaled only on assignment to class variables to reduce the number of offenses that would be reported.

    Line is too long. [115/80]
    Open

        # @return [Boolean] Flag defines whether to reset country in case number has + and country prefix doesn't match
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    Line is too long. [101/80]
    Open

        # @private sanitizing regex, matching symbols will get removed from parsed number, must be string
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    Replace class var @@override_phone_data with a class instance var.
    Open

          @@override_phone_data = file_path
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    This cop checks for uses of class variables. Offenses are signaled only on assignment to class variables to reduce the number of offenses that would be reported.

    Replace class var @@parse_special with a class instance var.
    Open

        @@parse_special = false
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    This cop checks for uses of class variables. Offenses are signaled only on assignment to class variables to reduce the number of offenses that would be reported.

    Replace class var @@additional_regexes with a class instance var.
    Open

        @@additional_regexes = {}
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    This cop checks for uses of class variables. Offenses are signaled only on assignment to class variables to reduce the number of offenses that would be reported.

    Avoid using Marshal.load.
    Open

          default_data = Marshal.load(File.binread(data_file))
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    This cop checks for the use of Marshal class methods which have potential security issues leading to remote code execution when loading from an untrusted source.

    Example:

    # bad
    Marshal.load("{}")
    Marshal.restore("{}")
    
    # good
    Marshal.dump("{}")
    
    # okish - deep copy hack
    Marshal.load(Marshal.dump({}))

    Avoid using Marshal.load.
    Open

          Marshal.load(File.binread(data_file))
    Severity: Minor
    Found in lib/phonelib/core.rb by rubocop

    This cop checks for the use of Marshal class methods which have potential security issues leading to remote code execution when loading from an untrusted source.

    Example:

    # bad
    Marshal.load("{}")
    Marshal.restore("{}")
    
    # good
    Marshal.dump("{}")
    
    # okish - deep copy hack
    Marshal.load(Marshal.dump({}))

    There are no issues that match your filters.

    Category
    Status