gooddata/gooddata-ruby

View on GitHub
lib/gooddata/models/user_filters/user_filter_builder.rb

Summary

Maintainability
F
4 days
Test Coverage

File user_filter_builder.rb has 499 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require_relative '../project_log_formatter'

require 'active_support/core_ext/hash/indifferent_access'

require 'gooddata/extensions/true'
Severity: Minor
Found in lib/gooddata/models/user_filters/user_filter_builder.rb - About 1 day to fix

    Method execute_mufs has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.execute_mufs(user_filters, options = {})
          client = options[:client]
          project = options[:project]
          ignore_missing_values = options[:ignore_missing_values]
          users_must_exist = options[:users_must_exist] == false ? false : true
    Severity: Minor
    Found in lib/gooddata/models/user_filters/user_filter_builder.rb - About 7 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 execute_mufs has 94 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def self.execute_mufs(user_filters, options = {})
          client = options[:client]
          project = options[:project]
          ignore_missing_values = options[:ignore_missing_values]
          users_must_exist = options[:users_must_exist] == false ? false : true
    Severity: Major
    Found in lib/gooddata/models/user_filters/user_filter_builder.rb - About 3 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 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

      Method create_expression has a Cognitive Complexity of 17 (exceeds 5 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 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_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 maqlify_filters has 40 lines of code (exceeds 25 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 1 hr to fix

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

                def self.sanitize_filters_to_delete(to_delete, users_brick_input, user_profile_mapping)
                  return [] unless users_brick_input && users_brick_input.any?
                  user_profiles = users_brick_input.map do |user|
                    result = user_profile_mapping[user.with_indifferent_access['login']]
                    next unless result
            Severity: Minor
            Found in lib/gooddata/models/user_filters/user_filter_builder.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 create_expression has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def self.create_expression(filter, labels_cache, lookups_cache, attr_cache, options = {}, login)
            Severity: Minor
            Found in lib/gooddata/models/user_filters/user_filter_builder.rb - About 45 mins to fix

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

                  def self.execute(user_filters, project_filters, klass, options = {})
                    client = options[:client]
                    project = options[:project]
              
                    ignore_missing_values = options[:ignore_missing_values]
              Severity: Minor
              Found in lib/gooddata/models/user_filters/user_filter_builder.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

              There are no issues that match your filters.

              Category
              Status