CartoDB/cartodb20

View on GitHub

Showing 5,951 of 5,951 total issues

Method store_retrieved_data has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def store_retrieved_data(filename, resource_data, available_quota_in_bytes)
        if resource_data.is_a?(StringIO)
          return if resource_data.size.zero?
          data = resource_data
        else
Severity: Minor
Found in services/importer/lib/importer/datasource_downloader.rb - About 35 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 use_batch_process? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def self.use_batch_process?(input_csv_file, geocoding_model, number_of_rows)
      # Due we could check this condition to create the geocoder class and we don't
      # have finished yet the csv file generation, and could be nil, we have to check
      # multiples conditions. It's sorted by priority
      if force_batch? || geocoding_model.batched
Severity: Minor
Found in services/geocoder/lib/hires_geocoder_factory.rb - About 35 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 rollback_user has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def rollback_user
        if @options[:metadata]
          rollback_metadata("user_#{@target_userid}_metadata_undo.sql")
          rollback_redis("user_#{@target_userid}_metadata_undo.redis")
        end
Severity: Minor
Found in services/user-mover/import_user.rb - About 35 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 process_row has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def process_row(input_row, output_csv_file)
      @processed_rows += 1
      latitude, longitude = geocode_text(input_row["searchtext"])
      if !(latitude.nil? || latitude == "") && !(longitude.nil? || longitude == "")
        @successful_processed_rows += 1
Severity: Minor
Found in services/geocoder/lib/hires_geocoder.rb - About 35 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 translate_url has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def translate_url(url)
        translator = supported_translator(url)

        raw_url = if translator
                    if translator.respond_to?(:rename_destination)
Severity: Minor
Found in services/importer/lib/importer/downloader.rb - About 35 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 update_metadata_user has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def update_metadata_user(target_dbhost)
        user_model = ::User.find(username: @target_username)
        orig_dbhost = user_model.database_host
        changed_metadata = false
        begin
Severity: Minor
Found in services/user-mover/import_user.rb - About 35 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 initialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def initialize(options={})
        @user = options.fetch(:user, nil)
        @ip = options.fetch(:ip, nil)
        raise ArgumentError.new('options must be a Hash') unless options.is_a?(Hash)
        raise ArgumentError.new('Must supply at least a user or an IP address') if @user.nil? && @ip.nil?
Severity: Minor
Found in services/platform-limits/lib/abstract_limit.rb - About 35 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 initialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def initialize(options={})
          super(options)

          raise ArgumentError.new('Must supply a user object') if user.nil?
          unless user.respond_to?(:max_import_table_row_count)
Severity: Minor
Found in services/platform-limits/lib/importer/table_row_count.rb - About 35 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 geometrify has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def geometrify
        job.log 'geometrifying'
        raise "empty column #{column_name}" if empty?
        convert_from_wkt                    if wkt?
        convert_from_kml_multi              if kml_multi?
Severity: Minor
Found in services/importer/lib/importer/column.rb - About 35 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 filename_from_headers has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def filename_from_headers
        return nil unless headers

        disposition = headers['Content-Disposition']
        return false unless disposition
Severity: Minor
Found in services/importer/lib/importer/downloader.rb - About 35 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 render has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def render
          username = CartoDB.extract_subdomain(@request).strip.downcase
          viewed_user = ::User.where(username: username).first

          if viewed_user.nil?
Severity: Minor
Found in lib/cartodb/controller_flows/public/content.rb - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
Open

      def run
        job.log "Converting #{@format.upcase} to CSV"

        Open3.popen3('file', '-b', '--mime-type', filepath) do |stdin, stdout, stderr, process|
          file_mime_type = stdout.read.delete("\n")
Severity: Minor
Found in services/importer/lib/importer/excel2csv.rb - About 35 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 import_org has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def import_org
        import_metadata("org_#{@organization_id}_metadata.sql") if @options[:metadata]
        create_org_role(@pack_config['users'][0]['database_name']) # Create org role for the original org
        @pack_config['groups'].each do |group|
          create_role(group['database_role'])
Severity: Minor
Found in services/user-mover/import_user.rb - About 35 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 fetch_and_enqueue has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def fetch_and_enqueue(force_all_syncs=false)
        begin
          if force_all_syncs
            query = db.fetch(%Q(
              SELECT r.name, r.id FROM #{relation} r, users u WHERE
Severity: Minor
Found in services/synchronizer/lib/synchronizer/collection.rb - About 35 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 increase has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def increase(context, amount=1)
          actual_amount = [max_value - get(context), amount].min
          return if actual_amount <= 0

          if redis.exists(key)
Severity: Minor
Found in services/platform-limits/lib/importer/user_concurrent_syncs_amount.rb - About 35 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 create_schema has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def create_schema(schema, role = nil)
        if role
          @conn.run(%{CREATE SCHEMA "#{schema}" AUTHORIZATION "#{role}"})
        else
          @conn.run(%{CREATE SCHEMA "#{schema}"})
Severity: Minor
Found in lib/carto/db/database.rb - About 35 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 authorize! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def self.authorize!(oauth_app, params)
          refresh_token = OauthRefreshToken.find_by_token!(params[:refresh_token])
          raise OauthProvider::Errors::InvalidGrant.new unless refresh_token.oauth_app == oauth_app

          if params[:scope]
Severity: Minor
Found in lib/carto/oauth_provider/grant_strategies.rb - About 35 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 link_ghost_tables has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def link_ghost_tables
      user_tables = fetch_user_tables
      if (user_tables.length > MAX_USERTABLES_FOR_SYNC_CHECK)
        # When the user has a big amount of tables, we don't even attempt to check if we
        # need to run ghost tables, and instead we request an async link.
Severity: Minor
Found in lib/carto/ghost_tables_manager.rb - About 35 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 openssl_converty_key_to_pkcs8 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def openssl_converty_key_to_pkcs8(key, passphrase)
        cmd = SysCmd.command 'openssl pkcs8' do
          option '-topk8'
          option '-inform', 'PEM'
          option '-passin', "pass:#{passphrase}" if passphrase.present?
Severity: Minor
Found in lib/carto/dbdirect/certificate_manager.rb - About 35 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 update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def update(retries: 0)
        stats_aggregator.timing('carto-named-maps-api.update') do
          params = request_params
          params[:body] = @named_map_template.to_json

Severity: Minor
Found in lib/carto/named_maps/api.rb - About 35 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