gooddata/gooddata-ruby

View on GitHub

Showing 407 of 407 total issues

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

        def call(params)
          results = []

          client = params.gdc_gd_client
          development_client = params.development_client
Severity: Major
Found in lib/gooddata/lcm/actions/create_segment_masters.rb - About 3 hrs to fix

    File process.rb has 290 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'zip'
    require 'uri'
    
    require_relative '../helpers/global_helpers'
    require_relative '../rest/resource'
    Severity: Minor
    Found in lib/gooddata/models/process.rb - About 2 hrs to fix

      Method maqlify_filters has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          def self.maqlify_filters(filters, user_profile_mapping, options = {})
            fail_early = options[:fail_early] == false ? false : true
            users_cache = options[:users_cache]
            labels_cache = create_label_cache(filters, options)
            small_labels = get_small_labels(labels_cache)
      Severity: Minor
      Found in lib/gooddata/models/user_filters/user_filter_builder.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 create_user_profile_mapping has a Cognitive Complexity of 21 (exceeds 5 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 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 migrate_date_dimension has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

              def migrate_date_dimension(params, segment_info)
                results = []
                client = params.gdc_gd_client
                latest_blueprint = segment_info[:from_blueprint]
                # don't migrate when latest master doesn't contain custom v2 date.
      Severity: Minor
      Found in lib/gooddata/lcm/actions/migrate_gdc_date_dimension.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

      File profile.rb has 284 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require 'pmap'
      
      require_relative '../rest/object'
      
      require_relative 'project'
      Severity: Minor
      Found in lib/gooddata/models/profile.rb - About 2 hrs to fix

        Method find has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

              def find(stuff, opts = { :client => GoodData.connection, :project => GoodData.project })
                _client, project = GoodData.get_client_and_project(opts)
        
                stuff.map do |item|
                  obj = if item.is_a?(String)
        Severity: Minor
        Found in lib/gooddata/models/metadata/report_definition.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 get_s3_config has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

              def get_s3_config(params)
                s3_config = {}
                if params.key?('aws_client')
                  GoodData.logger.warn('Found two configuration aws_client and s3_client for S3 input source, use aws_client configuration') if params.key?('s3_client')
                  raise 'Unable to connect to AWS. Parameter "aws_client" seems to be empty' unless params['aws_client']
        Severity: Minor
        Found in lib/gooddata/bricks/middleware/aws_middleware.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 connect has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

                def connect(username, password = 'aaaa', opts = {})
                  execution_id = ""
                  if username.is_a?(Hash) && username.key?(:execution_id)
                    execution_id = username[:execution_id]
                    username.delete(:execution_id)
        Severity: Minor
        Found in lib/gooddata/rest/client.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

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

              def realize_query(query, _params)
                GoodData.gd_logger.info("Realize SQL query: type=postgresql status=started")
        
                connect
                filename = "#{SecureRandom.urlsafe_base64(6)}_#{Time.now.to_i}.csv"
        Severity: Major
        Found in lib/gooddata/cloud_resources/postgresql/postgresql_client.rb and 1 other location - About 2 hrs to fix
        lib/gooddata/cloud_resources/mssql/mssql_client.rb on lines 55..81

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 96.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

              def realize_query(query, _params)
                GoodData.gd_logger.info("Realize SQL query: type=mssql status=started")
        
                connect
        
        
        Severity: Major
        Found in lib/gooddata/cloud_resources/mssql/mssql_client.rb and 1 other location - About 2 hrs to fix
        lib/gooddata/cloud_resources/postgresql/postgresql_client.rb on lines 55..79

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 96.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

                def call(params)
                  results = ThreadSafe::Array.new
                  collect_synced_status = collect_synced_status(params)
                  failed_projects = ThreadSafe::Array.new
        
        
        Severity: Minor
        Found in lib/gooddata/lcm/actions/synchronize_kd_dashboard_permission.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 validate_input_source has a Cognitive Complexity of 19 (exceeds 5 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

        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_everything has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

              def transfer_everything(client, domain, migration_spec, opts = {})
                filter_on_segment = migration_spec[:segments] || migration_spec['segments'] || []
        
                GoodData.logger.info('Ensuring Users - warning: works across whole domain not just provided segment(s)')
                ensure_users(domain, migration_spec, filter_on_segment)
        Severity: Minor
        Found in lib/gooddata/lcm/lcm.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 process_response has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

              def process_response(options = {}, &block)
                retries = options[:tries] || Helpers::GD_MAX_RETRY
                process = options[:process]
                dont_reauth = options[:dont_reauth]
                options = options.reject { |k, _| [:process, :dont_reauth].include?(k) }
        Severity: Minor
        Found in lib/gooddata/rest/connection.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 call has 63 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                def call(params)
                  logger = params.gdc_logger
        
                  client = params.gdc_gd_client
                  project = client.projects(params.gdc_project) || client.projects(params.gdc_project_id)
        Severity: Major
        Found in lib/gooddata/lcm/actions/execute_schedules.rb - About 2 hrs to fix

          Method add_user has 62 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def add_user(user_data, name = nil, opts = { :client => GoodData.connection })
                  generated_pass = GoodData::Helpers::CryptoHelper.generate_password
                  domain_name = name || user_data[:domain]
                  user_data = user_data.to_hash
                  data = {
          Severity: Major
          Found in lib/gooddata/models/domain.rb - About 2 hrs to fix

            Method transfer_everything has 62 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def transfer_everything(client, domain, migration_spec, opts = {})
                    filter_on_segment = migration_spec[:segments] || migration_spec['segments'] || []
            
                    GoodData.logger.info('Ensuring Users - warning: works across whole domain not just provided segment(s)')
                    ensure_users(domain, migration_spec, filter_on_segment)
            Severity: Major
            Found in lib/gooddata/lcm/lcm.rb - About 2 hrs to fix

              Method load_data has 61 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      def load_data(params, data_source)
                        first_name_column           = params.first_name_column&.downcase || 'first_name'
                        last_name_column            = params.last_name_column&.downcase || 'last_name'
                        login_column                = params.login_column&.downcase || 'login'
                        password_column             = params.password_column&.downcase || 'password'
              Severity: Major
              Found in lib/gooddata/lcm/actions/synchronize_users.rb - About 2 hrs to fix

                Method verify_existing_users has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                    def self.verify_existing_users(filters, options = {})
                      users_must_exist = options[:users_must_exist] == false ? false : true
                      users_cache = options[:users_cache]
                      domain = options[:domain]
                
                
                Severity: Minor
                Found in lib/gooddata/models/user_filters/user_filter_builder.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

                Severity
                Category
                Status
                Source
                Language