gooddata/gooddata-ruby

View on GitHub
lib/gooddata/models/project.rb

Summary

Maintainability
F
2 wks
Test Coverage

File project.rb has 1684 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'csv'
require 'zip'
require 'fileutils'
require 'multi_json'
require 'pmap'
Severity: Major
Found in lib/gooddata/models/project.rb - About 4 days to fix

    Class Project has 158 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class Project < Rest::Resource
        USER_ACCOUNT_PATH = '/gdc/account/profile/'
        USERSPROJECTS_PATH = USER_ACCOUNT_PATH + '%s/projects'
        PROJECTS_PATH = '/gdc/projects'
        PROJECT_PATH = '/gdc/projects/%s'
    Severity: Major
    Found in lib/gooddata/models/project.rb - About 3 days to fix

      Method transfer_schedules has a Cognitive Complexity of 79 (exceeds 5 allowed). Consider refactoring.
      Open

            def transfer_schedules(from_project, to_project, has_cycle_trigger = false)
              to_project_processes = to_project.processes.sort_by(&:name)
              from_project_processes = from_project.processes.sort_by(&:name)
              from_project_processes.reject!(&:add_v2_component?)
      
      
      Severity: Minor
      Found in lib/gooddata/models/project.rb - About 1 day 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_users has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
      Open

          def import_users(new_users, options = {})
            role_list = roles
            users_list = users
      
            GoodData.logger.warn("Importing users to project (#{pid})")
      Severity: Minor
      Found in lib/gooddata/models/project.rb - About 6 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_schedules has 151 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def transfer_schedules(from_project, to_project, has_cycle_trigger = false)
              to_project_processes = to_project.processes.sort_by(&:name)
              from_project_processes = from_project.processes.sort_by(&:name)
              from_project_processes.reject!(&:add_v2_component?)
      
      
      Severity: Major
      Found in lib/gooddata/models/project.rb - About 6 hrs to fix

        Method replace_from_mapping has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
        Open

            def replace_from_mapping(mapping, opts = {})
              default = {
                :purge => false,
                :dry_run => false
              }
        Severity: Minor
        Found in lib/gooddata/models/project.rb - About 5 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 import_users has 103 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def import_users(new_users, options = {})
              role_list = roles
              users_list = users
        
              GoodData.logger.warn("Importing users to project (#{pid})")
        Severity: Major
        Found in lib/gooddata/models/project.rb - About 4 hrs to fix

          Method replace_from_mapping has 92 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def replace_from_mapping(mapping, opts = {})
                default = {
                  :purge => false,
                  :dry_run => false
                }
          Severity: Major
          Found in lib/gooddata/models/project.rb - About 3 hrs to fix

            Method transfer_processes has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
            Open

                  def transfer_processes(from_project, to_project, options = {})
                    options = GoodData::Helpers.symbolize_keys(options)
                    aliases = {}
                    to_project_processes = to_project.processes
                    additional_hidden_params = options[:additional_hidden_params] || {}
            Severity: Minor
            Found in lib/gooddata/models/project.rb - About 3 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 export_clone has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                def export_clone(options = {})
                  with_data = options[:data].nil? ? true : options[:data]
                  with_users = options[:users].nil? ? false : options[:users]
            
                  export = {
            Severity: Minor
            Found in lib/gooddata/models/project.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_processes has 54 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def transfer_processes(from_project, to_project, options = {})
                    options = GoodData::Helpers.symbolize_keys(options)
                    aliases = {}
                    to_project_processes = to_project.processes
                    additional_hidden_params = options[:additional_hidden_params] || {}
            Severity: Major
            Found in lib/gooddata/models/project.rb - About 2 hrs to fix

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

                  def whitelist_users(new_users, users_list, whitelist, mode = :exclude)
                    return [new_users, users_list] unless whitelist
              
                    new_whitelist_proc = proc do |user|
                      whitelist.any? do |wl|
              Severity: Minor
              Found in lib/gooddata/models/project.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 users has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                  def users(opts = {})
                    client = client(opts)
                    all_users = []
                    offset = opts[:offset] || 0
                    limit = opts[:limit] || 1_000
              Severity: Minor
              Found in lib/gooddata/models/project.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 create_object has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                    def create_object(data = {})
                      c = GoodData.get_client(data)
                      new_data = GoodData::Helpers.deep_dup(EMPTY_OBJECT).tap do |d|
                        d['project']['meta']['title'] = data[:title]
                        d['project']['meta']['summary'] = data[:summary] if data[:summary]
              Severity: Minor
              Found in lib/gooddata/models/project.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 resolve_roles has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  def resolve_roles(login, desired_roles, options = {})
                    user = if login.is_a?(String) && login.include?('@')
                             USER_ACCOUNT_PATH + login
                           elsif login.is_a?(String)
                             login
              Severity: Minor
              Found in lib/gooddata/models/project.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_groups has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def check_groups(specified_groups, user_groups_cache = nil, options = {})
                    current_user_groups = user_groups if user_groups_cache.nil? || user_groups_cache.empty?
                    groups = current_user_groups.map(&:name)
                    missing_groups = []
                    change_groups = {}
              Severity: Minor
              Found in lib/gooddata/models/project.rb - About 1 hr to fix

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

                    def get_email_template(options)
                      bucket = options[:email_template_bucket]
                      path = options[:email_template_path]
                      access_key = options[:email_template_access_key]
                      secret_key = options[:email_template_secret_key]
                Severity: Minor
                Found in lib/gooddata/models/project.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 [] has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                      def [](id, opts = { client: GoodData.connection })
                        return id if id.instance_of?(GoodData::Project) || id.respond_to?(:project?) && id.project?
                
                        if id == :all
                          Project.all({ client: GoodData.connection }.merge(opts))
                Severity: Minor
                Found in lib/gooddata/models/project.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_output_stage has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def transfer_output_stage(from_project, to_project, options)
                        from_prj_output_stage = from_project.add.output_stage
                        output_stage_prefix = options[:ads_output_stage_prefix] || from_prj_output_stage.output_stage_prefix
                        output_stage_uri = options[:ads_output_stage_uri] || from_prj_output_stage.schema
                        if from_project.processes.any? { |p| p.type == :dataload }
                Severity: Minor
                Found in lib/gooddata/models/project.rb - About 1 hr to fix

                  Method transfer_output_stage has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def transfer_output_stage(from_project, to_project, options)
                          from_prj_output_stage = from_project.add.output_stage
                          output_stage_prefix = options[:ads_output_stage_prefix] || from_prj_output_stage.output_stage_prefix
                          output_stage_uri = options[:ads_output_stage_uri] || from_prj_output_stage.schema
                          if from_project.processes.any? { |p| p.type == :dataload }
                  Severity: Minor
                  Found in lib/gooddata/models/project.rb - About 55 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_users_roles has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def set_users_roles(list, options = {})
                        return [] if list.empty?
                        role_list = options[:roles] || roles
                        project_users = options[:project_users] || users
                  
                  
                  Severity: Minor
                  Found in lib/gooddata/models/project.rb - About 55 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 check_groups has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def check_groups(specified_groups, user_groups_cache = nil, options = {})
                        current_user_groups = user_groups if user_groups_cache.nil? || user_groups_cache.empty?
                        groups = current_user_groups.map(&:name)
                        missing_groups = []
                        change_groups = {}
                  Severity: Minor
                  Found in lib/gooddata/models/project.rb - About 45 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 add_user_groups_to_dashboard has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def add_user_groups_to_dashboard(group_dashboards, dashboard, common_group_names, target_user_groups)
                          group_dashboards.each do |group_dashboard|
                            group_name = group_dashboard[:name]
                            next if common_group_names && common_group_names[group_name]
                  
                  
                  Severity: Minor
                  Found in lib/gooddata/models/project.rb - About 45 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 verify_data_source_alias has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def verify_data_source_alias(ds_alias, client)
                          domain = client.connection.server.url
                          fail "The data source alias is empty, check your data source configuration." unless ds_alias
                  
                          uri = "/gdc/dataload/dataSources/internal/availableAlias?alias=#{ds_alias[:alias]}"
                  Severity: Minor
                  Found in lib/gooddata/models/project.rb - About 45 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 remove_member_from_group has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def remove_member_from_group(users_lookup, removal_user_group_members, user_groups_cache)
                        unless removal_user_group_members.empty?
                          users_lookup ||= login_users
                          current_user_groups = user_groups_cache || user_groups
                          removal_user_group_members.uniq.each do |login|
                  Severity: Minor
                  Found in lib/gooddata/models/project.rb - About 45 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 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def create(opts = { client: GoodData.connection }, &block)
                          GoodData.logger.info "Creating project #{opts[:title]}"
                  
                          auth_token = opts[:auth_token] || opts[:token]
                          if auth_token.nil? || auth_token.empty?
                  Severity: Minor
                  Found in lib/gooddata/models/project.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 objects_export has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def objects_export(objs, options = {})
                        fail 'Nothing to migrate. You have to pass list of objects, ids or uris that you would like to migrate' if objs.nil?
                        objs = Array(objs).map { |o| o.respond_to?(:uri) ? o.uri : o }
                        if objs.empty?
                          GoodData.logger.warn 'Nothing to migrate.'
                  Severity: Minor
                  Found in lib/gooddata/models/project.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 fuzzy_get_user has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def fuzzy_get_user(name, user_list = users)
                        return name if name.instance_of?(GoodData::Membership)
                        return member(name) if name.instance_of?(GoodData::Profile)
                        name = name.is_a?(Hash) ? name[:login] || name[:uri] : name
                        return nil unless name
                  Severity: Minor
                  Found in lib/gooddata/models/project.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 get_user has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def get_user(slug, user_list = users)
                        search_crit = if slug.respond_to?(:login)
                                        slug.login || slug.uri
                                      elsif slug.is_a?(Hash)
                                        slug[:login] || slug[:uri]
                  Severity: Minor
                  Found in lib/gooddata/models/project.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 transfer_dashboard_permission has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def transfer_dashboard_permission(from_project, to_project, source_dashboards, target_dashboards)
                          source_user_groups = from_project.user_groups
                          target_user_groups = to_project.user_groups
                  
                          source_dashboards.each do |source_dashboard|
                  Severity: Minor
                  Found in lib/gooddata/models/project.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 delete_all_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def delete_all_data(options = {})
                        return false unless options[:force]
                        begin
                          datasets.reject(&:date_dimension?).pmap(&:delete_data)
                        rescue MaqlExecutionError => e
                  Severity: Minor
                  Found in lib/gooddata/models/project.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

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

                          new_item = item.replace(mapping)
                          if new_item.json != item.json
                            if dry_run
                              GoodData.logger.info "Would save #{new_item.uri}. Running in dry run mode"
                            else
                  Severity: Minor
                  Found in lib/gooddata/models/project.rb and 1 other location - About 40 mins to fix
                  lib/gooddata/models/project.rb on lines 1597..1606

                  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 38.

                  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

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

                            new_item = item.replace(mapping)
                            if new_item.json != item.json
                              if dry_run
                                GoodData.logger.info "Would save #{new_item.uri}. Running in dry run mode"
                              else
                  Severity: Minor
                  Found in lib/gooddata/models/project.rb and 1 other location - About 40 mins to fix
                  lib/gooddata/models/project.rb on lines 1615..1624

                  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 38.

                  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

                  There are no issues that match your filters.

                  Category
                  Status