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'
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
- Read upRead up
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
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)
- Read upRead up
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 = []
- Read upRead up
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]
- Read upRead up
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?
- Read upRead up
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?
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 = []
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)
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
- Read upRead up
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)
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]
- Read upRead up
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"