gooddata/gooddata-ruby

View on GitHub

Showing 359 of 407 total issues

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

      def enrich_error_message(exception)
        begin
          return exception unless exception.response

          response = JSON.parse(exception.response.body, symbolize_names: true)
Severity: Minor
Found in lib/gooddata/rest/connection.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 apply has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def apply
        # TODO: Review following connect replacement/reimplementation
        # connect
        with_project do |project_id|
          begin
Severity: Minor
Found in lib/gooddata/commands/datasets.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

Avoid too many return statements within this method.
Open

      return ads_connection_info if is(ADS)
Severity: Major
Found in lib/gooddata/models/data_source.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

          return s3_connection_info if is(S3)
    Severity: Major
    Found in lib/gooddata/models/data_source.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                    return nil
      Severity: Major
      Found in lib/gooddata/lcm/actions/update_metric_formats.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                    return nil
        Severity: Major
        Found in lib/gooddata/lcm/actions/update_metric_formats.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                        return nil
          Severity: Major
          Found in lib/gooddata/lcm/actions/update_metric_formats.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        return modified_input_source
            Severity: Major
            Found in lib/gooddata/lcm/actions/update_metric_formats.rb - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return modified_input_source
              Severity: Major
              Found in lib/gooddata/lcm/actions/update_metric_formats.rb - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                              return nil
                Severity: Major
                Found in lib/gooddata/lcm/actions/update_metric_formats.rb - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                              return modified_input_source
                  Severity: Major
                  Found in lib/gooddata/lcm/actions/update_metric_formats.rb - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                return nil
                    Severity: Major
                    Found in lib/gooddata/lcm/actions/update_metric_formats.rb - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                  return modified_input_source
                      Severity: Major
                      Found in lib/gooddata/lcm/actions/update_metric_formats.rb - About 30 mins to fix

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

                              def datasets(id = :all, options = {})
                                id = id.respond_to?(:id) ? id.id : id
                                dss = ProjectBlueprint.datasets(self, options).map do |d|
                                  case d[:type]
                                  when :date_dimension
                        Severity: Minor
                        Found in lib/gooddata/models/blueprint/project_blueprint.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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                              def initialize(init_data)
                                some_data = if init_data.respond_to?(:project_blueprint?) && init_data.project_blueprint?
                                              init_data.to_hash
                                            elsif init_data.respond_to?(:to_blueprint)
                                              init_data.to_blueprint.to_hash
                        Severity: Minor
                        Found in lib/gooddata/models/blueprint/project_blueprint.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 sso_url has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def sso_url(login, provider, url, opts = DEFAULT_SSO_OPTIONS)
                              opts = DEFAULT_SSO_OPTIONS.merge(opts)
                        
                              ts = DateTime.now.strftime('%s').to_i + opts[:valid]
                              obj = {
                        Severity: Minor
                        Found in lib/gooddata/connection.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 [] has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                              def [](id = :all, opts = { client: GoodData.connection })
                                c = GoodData.get_client(opts)
                                pid = (opts[:project].respond_to?(:pid) && opts[:project].pid) || opts[:project]
                                process_id = (opts[:process].respond_to?(:process_id) && opts[:process].process_id) || opts[:process]
                                uri = NOTIFICATION_RULES_PATH % [pid, process_id]
                        Severity: Minor
                        Found in lib/gooddata/models/notification_rule.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 slice has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def slice(rows, cols)
                              rows = rows.is_a?(Enumerable) ? rows : [rows, size.first]
                              cols = cols.is_a?(Enumerable) ? cols : [cols, size.last]
                              new_data = @data[rows.first..rows.last].map { |col| col[cols.first..cols.last] }
                              if client
                        Severity: Minor
                        Found in lib/gooddata/models/report_data_result.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 create_metric has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def create_metric(options = {})
                              an_attribute = options[:attribute]
                              a_type = options[:type] || :count
                              unless ATTRIBUTE_BASE_AGGREGATIONS.include?(a_type)
                                fail 'Suggested aggreagtion function (#{a_type}) does not exist for ' \
                        Severity: Minor
                        Found in lib/gooddata/models/metadata/attribute.rb - About 25 mins to fix

                        Cognitive Complexity

                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                        A method's cognitive complexity is based on a few simple rules:

                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                        • Code is considered more complex for each "break in the linear flow of the code"
                        • Code is considered more complex when "flow breaking structures are nested"

                        Further reading

                        Severity
                        Category
                        Status
                        Source
                        Language