matkoniecz/CartoCSSHelper

View on GitHub

Showing 77 of 77 total issues

Method get_expected_tag_status has 648 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def self.get_expected_tag_status
      return [
        TagRenderingStatus.new('access', '*', :composite, { 'amenity' => 'parking' }),
        TagRenderingStatus.new('access', 'destination', :composite, { 'highway' => 'service' }),
        TagRenderingStatus.new('access', 'no', :composite, { 'highway' => 'service' }),
Severity: Major
Found in lib/cartocss_helper/style_specific/default_osm_style.rb - About 3 days to fix

    File default_osm_style.rb has 729 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require_relative('style_specific')
    
    module CartoCSSHelper
      module StyleDataForDefaultOSM
        def self.get_style_data
    Severity: Major
    Found in lib/cartocss_helper/style_specific/default_osm_style.rb - About 1 day to fix

      Method get_list_of_testing_locations has 234 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def self.get_list_of_testing_locations
          return [
            [50.1, 19.9], # Krakow
            [53.2, -1.8], # rural uk
            [36.1, 140.7], # Japan
      Severity: Major
      Found in lib/data/testing_locations.rb - About 1 day to fix

        Class OverpassQueryGenerator has 25 methods (exceeds 20 allowed). Consider refactoring.
        Open

          class OverpassQueryGenerator
            class NoLocationFound < StandardError
            end
            # TODO: - split into cache handling and Overpass handling
            def self.get_query_to_find_data_pair(bb, tags_a, tags_b, type_a, type_b, distance_in_meters: 20)
        Severity: Minor
        Found in lib/cartocss_helper/overpass_query_generator.rb - About 2 hrs to fix

          Method visualise_place_by_file has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

            def self.visualise_place_by_file(filename, latitude, longitude, zlevels, new_branch, old_branch = 'master', header = nil, bb = 0.04, image_size = 350)
              raise "#{filename} does not exists" unless File.exist?(filename)
              raise "#{latitude} is not a number" unless latitude.is_a? Numeric
              raise "#{longitude} is not a number" unless longitude.is_a? Numeric
              raise "#{zlevels} is not a range" unless zlevels.class == Range
          Severity: Minor
          Found in lib/cartocss_helper.rb - About 2 hrs 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_job has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

              def self.add_job(filename, latitude, longitude, zlevels, header, new_branch, old_branch, download_bbox_size, image_size, prefix)
                print prefix
                new_job = MapGenerationJob.new(filename, latitude, longitude, zlevels, header, new_branch, old_branch, download_bbox_size, image_size)
                new_job.print
          
          
          Severity: Minor
          Found in lib/cartocss_helper/visualise_changes_image_generation.rb - About 2 hrs 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 visualise_place_by_url has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

            def self.visualise_place_by_url(url, zlevels, new_branch, old_branch = 'master', header = nil, download_bbox_size = 0.04, image_size = 350)
              header = url if header == nil
          
              raise "#{url} is not a string, it is #{url.class}" unless url.class == String
              raise "#{zlevels} is not a range, it is #{zlevels.class}" unless zlevels.class == Range
          Severity: Minor
          Found in lib/cartocss_helper.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 check_missing_names has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              def check_missing_names(tags, zlevel, interactive = false, on_water = false)
                not_required = CartoCSSHelper::Configuration.get_style_specific_data.name_label_is_not_required
                return if not_required.include?(tags)
                ['node', 'closed_way', 'way'].each do |type|
                  next if not_required.include?(tags.merge({ type: type }))
          Severity: Minor
          Found in lib/cartocss_helper/validator.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 name_label_is_not_required has 42 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def self.name_label_is_not_required
                return [
                  { 'addr:housename' => CartoCSSHelper::Heuristic.get_generic_tag_value },
                  { 'addr:housenumber' => CartoCSSHelper::Heuristic.get_generic_tag_value },
                  { 'addr:interpolation' => CartoCSSHelper::Heuristic.get_generic_tag_value },
          Severity: Minor
          Found in lib/cartocss_helper/style_specific/default_osm_style.rb - About 1 hr to fix

            Method check_unwanted_names has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                def check_unwanted_names(tags, zlevel, interactive = false, on_water = false)
                  ['node', 'closed_way', 'way'].each do |type|
                    not_required = CartoCSSHelper::Configuration.get_style_specific_data.name_label_is_not_required
                    next unless not_required.include?(tags) || not_required.include?(tags.merge({ type: type }))
                    unless is_object_displaying_anything_as_this_object_type tags, zlevel, on_water, type
            Severity: Minor
            Found in lib/cartocss_helper/validator.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 is_key_rendered_and_value_ignored has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                def is_key_rendered_and_value_ignored(key, value)
                  return false if notis_rendered key, get_generic_tag_value
                  [false, true].each do |on_water|
                    [Configuration.get_max_z].each do |zlevel|
                      ['area', 'closed_way', 'way', 'node'].each do |type|
            Severity: Minor
            Found in lib/cartocss_helper/tag_lister.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 how_rendered_as_composite has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                def how_rendered_as_composite(key, value, suggested_composite, zlevels = [Configuration.get_max_z]) # TODO: - note that some tags may be rendered up to X zoom level, but checking all zlevels would take too much time
                  [false, true].each do |on_water|
                    zlevels.each do |zlevel|
                      result = how_rendered_on_zlevel_as_composite({ key => value }, 'closed_way', zlevel, on_water, suggested_composite)
                      return result if result != nil
            Severity: Minor
            Found in lib/cartocss_helper/tag_lister.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_job has 10 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def self.add_job(filename, latitude, longitude, zlevels, header, new_branch, old_branch, download_bbox_size, image_size, prefix)
            Severity: Major
            Found in lib/cartocss_helper/visualise_changes_image_generation.rb - About 1 hr to fix

              Method run_overpass_query has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def self.run_overpass_query(query, description, invalidate_cache: false)
                    url = OverpassDownloader.format_query_into_url(query)
                    timeout = OverpassDownloader.get_allowed_timeout_in_seconds
                    downloader = GenericCachedDownloader.new(timeout: timeout, stop_on_timeout: false)
                    return downloader.get_specified_resource(url, cache_filename(query), description: description, invalidate_cache: invalidate_cache)
              Severity: Minor
              Found in lib/cartocss_helper/overpass_downloader.rb - About 1 hr to fix

                Method visualise_for_location_from_file has 9 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def self.visualise_for_location_from_file(filename, latitude, longitude, zlevels, header, new_branch, old_branch, download_bbox_size = 0.4, image_size = 400)
                Severity: Major
                Found in lib/cartocss_helper/visualise_changes_image_generation.rb - About 1 hr to fix

                  Method visualise_place_by_remote_file has 9 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                    def self.visualise_place_by_remote_file(url, latitude, longitude, zlevels, new_branch, old_branch = 'master', header = nil, bb = 0.04, image_size = 350)
                  Severity: Major
                  Found in lib/cartocss_helper.rb - About 1 hr to fix

                    Method initialize has 9 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                          def initialize(filename, latitude, longitude, zlevels, header, new_branch, old_branch, download_bbox_size, image_size)
                    Severity: Major
                    Found in lib/cartocss_helper/visualise_changes_image_generation.rb - About 1 hr to fix

                      Method visualise_place_by_file has 9 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                        def self.visualise_place_by_file(filename, latitude, longitude, zlevels, new_branch, old_branch = 'master', header = nil, bb = 0.04, image_size = 350)
                      Severity: Major
                      Found in lib/cartocss_helper.rb - About 1 hr to fix

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

                            def compare_expected_with_tag_data(list_of_expected, tag_info)
                              list_of_expected.each do |expected|
                                next unless expected.key == tag_info.key
                                next unless expected.value == tag_info.value
                                if expected.equal? tag_info
                        Severity: Minor
                        Found in lib/cartocss_helper/validator.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 visualise_for_given_source has 8 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            def self.visualise_for_given_source(latitude, longitude, zlevels, header, new_branch, old_branch, image_size, source)
                        Severity: Major
                        Found in lib/cartocss_helper/visualise_changes_image_generation.rb - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language