CartoDB/cartodb20

View on GitHub

Showing 2,455 of 5,951 total issues

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

      def update
        changed_notification = params[:notification]
        if changed_notification
          read_at = changed_notification[:read_at]
          @received_notification.read_at = DateTime.parse(read_at) if read_at
Severity: Minor
Found in app/controllers/carto/api/received_notifications_controller.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

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

      def layer_options
        layer_opts = @layer.options.nil? ? Hash.new : @layer.options
        if layer_opts['table_name'] && !viewer_is_owner?
          layer_opts['table_name'] = qualify_table_name
        end
Severity: Minor
Found in app/controllers/carto/api/layer_presenter.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

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

      def wizard_properties_properties_to_style_properties_properties(wizard_properties_properties, type)
        spp = {}
        wpp = wizard_properties_properties
        return spp unless wpp

Severity: Minor
Found in app/controllers/carto/api/layer_presenter.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

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

      def load_organization
        @organization = Carto::Organization.where(id: params[:organization_id]).first
        render_404 && return unless @organization
        unless @organization.admin?(current_user)
          render_jsonp({ errors: { organization: 'not admin' } }, 401) && return
Severity: Minor
Found in app/controllers/carto/api/invitations_controller.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

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

      def to_poro(accessible_dependent_derived_maps: false, context: nil)
        return {} if @user_table.nil?

        poro = {
          id: @user_table.id,
Severity: Minor
Found in app/controllers/carto/api/user_table_presenter.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

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

      def to_private_poro
        poro = {
          id: @visualization.id,
          name: @visualization.name,
          display_name: @visualization.display_name,
Severity: Minor
Found in app/controllers/carto/api/visualization_presenter.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

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

      def page_per_page_params(default_per_page: 20)
        page = (params[:page].presence || 1).to_i
        unless page > 0
          raise Carto::ParamInvalidError.new('page')
        end
Severity: Minor
Found in app/controllers/carto/api/paged_searcher.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

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

    def ensure_georef_status_colummn_valid
      connection.run(%Q{
          ALTER TABLE #{@qualified_table_name}
          ADD COLUMN cartodb_georef_status BOOLEAN DEFAULT NULL
        })
Severity: Minor
Found in services/table-geocoder/lib/abstract_table_geocoder.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

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

          def get(uri, options = {})
            query = options[:query]
            success_codes = options.fetch(:success_codes, [200])
            process_response = options.fetch(:process_response, true)
            if_match = options[:if_match]
Severity: Minor
Found in services/datasources/lib/datasources/url/box.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

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

        def block_size(update=true)
          if update
            if @current_stream_status && (@block_size < MAX_BLOCK_SIZE)
              @block_size = [@block_size * BLOCK_FACTOR, MAX_BLOCK_SIZE].min
            end
Severity: Minor
Found in services/datasources/lib/datasources/url/arcgis.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

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

        def build_maxresults_field(user)
          if twitter_credit_limits > 0
            [remaining_quota, TwitterSearch::SearchAPI::MAX_PAGE_RESULTS].min
          else
            # user about to hit quota?
Severity: Minor
Found in services/datasources/lib/datasources/search/twitter.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

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

  def set_subject
    if @total_tables == 1
      if @errors.nil?
        subject = "Your dataset import just finished"
      else
Severity: Minor
Found in app/mailers/import_mailer.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

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

        def get_subresource_metadata(id, subresource_id)
          @url = sanitize_id(id, subresource_id)

          response = http_client.get(METADATA_URL % [@url], http_options)
          validate_response(METADATA_URL % [@url], response)
Severity: Minor
Found in services/datasources/lib/datasources/url/arcgis.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

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

      def dryrun
        begin
          provider_id = params[:provider_id]
          parameters = build_connector_parameters(provider_id, params)
          if Carto::Connector.dry_run?(provider_id)
Severity: Minor
Found in app/controllers/carto/api/connectors_controller.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

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

      def get(endpoint, params, first_request_time=nil, retry_counter=0)
        first_request_time ||= Time.now
        elapsed = Time.now - first_request_time
        if elapsed > @retry_timeout
          raise Carto::GeocoderErrors::GmeGeocoderTimeoutError.new('retry timeout expired')
Severity: Minor
Found in services/table-geocoder/lib/gme/client.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

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

        def get_layers_list(url)
          request_url = LAYERS_URL % [url]
          response = http_client.get(request_url, http_options)
          validate_response(request_url, response)

Severity: Minor
Found in services/datasources/lib/datasources/url/arcgis.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

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

      def run
        return self unless File.exists?(filepath)

        detect_delimiter

Severity: Minor
Found in services/importer/lib/importer/csv_normalizer.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

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

      def privacy_aware_map_url(additional_params = {}, action = 'public_visualizations_show_map')
        organization = @visualization.user.organization
        return unless organization

        return kuviz_url(@visualization) if @visualization.kuviz?
Severity: Minor
Found in app/controllers/carto/api/visualization_presenter.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

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

        def validate_auth_code(auth_code, use_callback_flow = true)
          unless use_callback_flow
            @client.redirect_uri = REDIRECT_URI
          end
          @client.code = auth_code
Severity: Minor
Found in services/datasources/lib/datasources/url/gdrive.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

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

    def store
      begin
        count = count + 1 rescue 0
        sql   = %Q{
           WITH
Severity: Minor
Found in services/table-geocoder/lib/geocoder_cache.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

Severity
Category
Status
Source
Language