gooddata/gooddata-ruby

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

Summary

Maintainability
F
3 days
Test Coverage

Method add_user has a Cognitive Complexity of 29 (exceeds 5 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: Minor
Found in lib/gooddata/models/domain.rb - About 4 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 update_user has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

      def update_user(user_data, options = { client: GoodData.connection })
        user_data = user_data.to_hash if user_data.is_a?(GoodData::Profile)
        client = client(options)
        user_data = user_data.to_hash
        data = {
Severity: Minor
Found in lib/gooddata/models/domain.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

File domain.rb has 318 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'cgi'

require_relative 'profile'
require_relative '../extensions/enumerable'
require_relative '../rest/object'
Severity: Minor
Found in lib/gooddata/models/domain.rb - About 3 hrs to fix

    Class Domain has 29 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class Domain < Rest::Resource
        attr_reader :name
    
        USER_LANGUAGES = {
          'en-US' => 'English',
    Severity: Minor
    Found in lib/gooddata/models/domain.rb - About 3 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 create_users has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

              def create_users(list, default_domain = nil, opts = { :client => GoodData.connection, :project => GoodData.project })
                default_domain_name = default_domain.respond_to?(:name) ? default_domain.name : default_domain
                domain = client.domain(default_domain_name)
        
                # Prepare cache for domain users
        Severity: Minor
        Found in lib/gooddata/models/domain.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 update_user has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def update_user(user_data, options = { client: GoodData.connection })
                user_data = user_data.to_hash if user_data.is_a?(GoodData::Profile)
                client = client(options)
                user_data = user_data.to_hash
                data = {
        Severity: Minor
        Found in lib/gooddata/models/domain.rb - About 1 hr to fix

          Method create_users has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def create_users(list, default_domain = nil, opts = { :client => GoodData.connection, :project => GoodData.project })
                  default_domain_name = default_domain.respond_to?(:name) ? default_domain.name : default_domain
                  domain = client.domain(default_domain_name)
          
                  # Prepare cache for domain users
          Severity: Minor
          Found in lib/gooddata/models/domain.rb - About 1 hr to fix

            Method users has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                  def users(domain, id = :all, opts = {})
                    client = client(opts)
                    domain = client.domain(domain)
                    if id == :all
                      GoodData.logger.warn("Retrieving all users from domain #{domain.name}")
            Severity: Minor
            Found in lib/gooddata/models/domain.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 get_user has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                def get_user(name, user_list = users)
                  return member(name, user_list) if name.instance_of?(GoodData::Membership)
                  return member(name, user_list) 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/domain.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

            There are no issues that match your filters.

            Category
            Status