gooddata/gooddata-ruby

View on GitHub

Showing 359 of 407 total issues

Method create has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def create(metric, options = { :client => GoodData.connection, :project => GoodData.project })
        client, project = GoodData.get_client_and_project(options)

        if metric.is_a?(String)
          expression = metric || options[:expression]
Severity: Minor
Found in lib/gooddata/models/metadata/metric.rb - About 2 hrs to fix

    Method validate_input_source has 50 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def validate_input_source(input_source, continue_on_error)
              type = input_source[:type] if input_source&.dig(:type)
              metric_format = input_source[:metric_format]
              if type.blank?
                raise "Incorrect configuration: 'type' of 'input_source' is required" unless continue_on_error
    Severity: Minor
    Found in lib/gooddata/lcm/actions/update_metric_formats.rb - About 2 hrs to fix

      Method create_expression has 49 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def self.create_expression(filter, labels_cache, lookups_cache, attr_cache, options = {}, login)
            values = filter[:values]
            # Do not create MUF for label when all its values is NULL (https://jira.intgdc.com/browse/TMA-1361)
            non_null_values = values.select { |value| !value.nil? && value.downcase != 'null' }
            return ['TRUE', []] if non_null_values.empty?
      Severity: Minor
      Found in lib/gooddata/models/user_filters/user_filter_builder.rb - About 1 hr to fix

        Method create_user_profile_mapping has 49 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def self.create_user_profile_mapping(filters, project_users, options = {})
              domain = options[:domain]
              found_list = {}
              missing_list = []
        
        
        Severity: Minor
        Found in lib/gooddata/models/user_filters/user_filter_builder.rb - About 1 hr to fix

          Method call has 48 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  def call(params)
                    client = params.gdc_gd_client
          
                    domain_name = params.organization || params.domain
                    fail "Either organisation or domain has to be specified in params" unless domain_name
          Severity: Minor
          Found in lib/gooddata/lcm/actions/synchronize_clients.rb - About 1 hr to fix

            Method create has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

                  def create(process_id, trigger, executable, options = {})
                    c, project = GoodData.get_client_and_project(options)
            
                    fail 'Process ID has to be provided' if process_id.blank?
            
            
            Severity: Minor
            Found in lib/gooddata/models/schedule.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 delete_ads_by_title has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

            def delete_ads_by_title(title, client, days = 14, force = false)
              warehouses = client.warehouses
              return if warehouses.empty?
            
              deleted = 0
            Severity: Minor
            Found in bin/test_projects_cleanup.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 call has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

                    def call(params)
                      client_projects = params.client_projects
            
                      results = []
                      params.clients.each do |c|
            Severity: Minor
            Found in lib/gooddata/lcm/actions/rename_existing_client_projects.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 decode_params has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

                  def decode_params(params, options = {})
                    key = ENCODED_PARAMS_KEY.to_s
                    hidden_key = ENCODED_HIDDEN_PARAMS_KEY.to_s
                    data_params = params[key] || '{}'
                    hidden_data_params = if params.key?(hidden_key) && params[hidden_key].nil?
            Severity: Minor
            Found in lib/gooddata/helpers/global_helpers_params.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 transfer_label_types has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

                  def transfer_label_types(source_project, targets)
                    semaphore = Mutex.new
            
                    # Convert to array
                    targets = [targets] unless targets.is_a?(Array)
            Severity: Minor
            Found in lib/gooddata/lcm/lcm.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 exist_cycle_trigger has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

                    def exist_cycle_trigger(project)
                      schedules = project.schedules
                      triggers = {}
                      schedules.each do |schedule|
                        triggers[schedule.obj_id] = schedule.trigger_id if schedule.trigger_id
            Severity: Minor
            Found in lib/gooddata/lcm/actions/synchronize_schedules.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 guess has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

                  def guess(limit)
                    count = 0
                    while (row = @reader.shift)
                      break unless row && !row.empty? && count < limit
                      fail '%i fields in row %i, %i expected' % [row.size, count + 1, @headers.size] if row.size != @headers.size
            Severity: Minor
            Found in lib/gooddata/data/guesser.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 download has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

                  def download(what, where, options = {})
                    # handle the path (directory) given in what
                    ilast_slash = what.rindex('/')
                    if ilast_slash.nil?
                      what_dir = ''
            Severity: Minor
            Found in lib/gooddata/rest/connection.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 connect has 47 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def connect(username, password, options = {})
                    server = options[:server] || Helpers::AuthHelper.read_server
                    options = DEFAULT_LOGIN_PAYLOAD.merge(options)
                    headers = options[:headers] || {}
            
            
            Severity: Minor
            Found in lib/gooddata/rest/connection.rb - About 1 hr to fix

              Method call has 46 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      def call(params)
                        results = []
                        disable_pp_dashboard_permission = GoodData::Helpers.to_boolean(params.disable_pp_dashboard_permission)
                        collect_synced_status = collect_synced_status(params)
                        failed_projects = ThreadSafe::Array.new
              Severity: Minor
              Found in lib/gooddata/lcm/actions/synchronize_pp_dashboard_permission.rb - About 1 hr to fix

                Method diff has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def diff(old_list, new_list, options = {})
                        old_list = old_list.map(&:to_hash)
                        new_list = new_list.map(&:to_hash)
                
                        fields = options[:fields]
                Severity: Minor
                Found in lib/gooddata/helpers/global_helpers_params.rb - About 1 hr to fix

                  Method download has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        def download(what, where, options = {})
                          # handle the path (directory) given in what
                          ilast_slash = what.rindex('/')
                          if ilast_slash.nil?
                            what_dir = ''
                  Severity: Minor
                  Found in lib/gooddata/rest/connection.rb - About 1 hr to fix

                    Method call has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                    Open

                            def call(params)
                              results = []
                    
                              client = params.gdc_gd_client
                              development_client = params.development_client
                    Severity: Minor
                    Found in lib/gooddata/lcm/actions/create_segment_masters.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 print_action_result has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                    Open

                          def print_action_result(action, messages)
                            title = "Result of #{action.short_name}"
                    
                            keys = if action.const_defined?('RESULT_HEADER')
                                     action.const_get('RESULT_HEADER')
                    Severity: Minor
                    Found in lib/gooddata/lcm/lcm2.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 apply_maqls has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                    Open

                            def apply_maqls(ca_chunks, project, replaced_maqls, opts)
                              errors = []
                              replaced_maqls.each do |replaced_maql_chunks|
                                begin
                                  fallback_hard_sync = replaced_maql_chunks['updateScript']['fallbackHardSync'].nil? ? false : replaced_maql_chunks['updateScript']['fallbackHardSync']
                    Severity: Minor
                    Found in lib/gooddata/models/project_creator.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

                    Severity
                    Category
                    Status
                    Source
                    Language