geokit/geokit

View on GitHub
lib/geokit/geocoders/google.rb

Summary

Maintainability
A
3 hrs
Test Coverage

Method set_address_components has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def self.set_address_components(loc, addr)
        addr['address_components'].each do |comp|
          types = comp['types']
          case
          when types.include?('subpremise')
Severity: Minor
Found in lib/geokit/geocoders/google.rb - About 1 hr to fix

    Method submit_url has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

          def self.submit_url(query_string, options = {})
            language_str = options[:language] ? "&language=#{options[:language]}" : ''
            query_string = "/maps/api/geocode/json?sensor=false&#{query_string}#{language_str}"
            if client_id && cryptographic_key
              channel_string = channel ? "&channel=#{channel}" : ''
    Severity: Minor
    Found in lib/geokit/geocoders/google.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 set_address_components has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def self.set_address_components(loc, addr)
            addr['address_components'].each do |comp|
              types = comp['types']
              case
              when types.include?('subpremise')
    Severity: Minor
    Found in lib/geokit/geocoders/google.rb - About 45 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

    Method do_geocode has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def self.do_geocode(address, options = {})
            bias_str = options[:bias] ? construct_bias_string_from_options(options[:bias]) : ''
            components_str = options[:components] ? construct_components_string_from_options(options[:components]) : ''
            address_str = address.is_a?(GeoLoc) ? address.to_geocodeable_s : address
            url = submit_url("address=#{Geokit::Inflector.url_escape(address_str)}#{bias_str}#{components_str}", options)
    Severity: Minor
    Found in lib/geokit/geocoders/google.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

    There are no issues that match your filters.

    Category
    Status