Showing 407 of 407 total issues
Method call
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
def call(params)
results = []
client = params.gdc_gd_client
development_client = params.development_client
File process.rb
has 290 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'zip'
require 'uri'
require_relative '../helpers/global_helpers'
require_relative '../rest/resource'
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 migrate_date_dimension
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def migrate_date_dimension(params, segment_info)
results = []
client = params.gdc_gd_client
latest_blueprint = segment_info[:from_blueprint]
# don't migrate when latest master doesn't contain custom v2 date.
- 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
File profile.rb
has 284 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'pmap'
require_relative '../rest/object'
require_relative 'project'
Method find
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def find(stuff, opts = { :client => GoodData.connection, :project => GoodData.project })
_client, project = GoodData.get_client_and_project(opts)
stuff.map do |item|
obj = if item.is_a?(String)
- 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 get_s3_config
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def get_s3_config(params)
s3_config = {}
if params.key?('aws_client')
GoodData.logger.warn('Found two configuration aws_client and s3_client for S3 input source, use aws_client configuration') if params.key?('s3_client')
raise 'Unable to connect to AWS. Parameter "aws_client" seems to be empty' unless params['aws_client']
- 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 connect
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def connect(username, password = 'aaaa', opts = {})
execution_id = ""
if username.is_a?(Hash) && username.key?(:execution_id)
execution_id = username[:execution_id]
username.delete(:execution_id)
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
def realize_query(query, _params)
GoodData.gd_logger.info("Realize SQL query: type=postgresql status=started")
connect
filename = "#{SecureRandom.urlsafe_base64(6)}_#{Time.now.to_i}.csv"
- Read upRead up
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 96.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
def realize_query(query, _params)
GoodData.gd_logger.info("Realize SQL query: type=mssql status=started")
connect
- Read upRead up
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 96.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method call
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def call(params)
results = ThreadSafe::Array.new
collect_synced_status = collect_synced_status(params)
failed_projects = ThreadSafe::Array.new
- 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 validate_input_source
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def validate_input_source(input_source, continue_on_error)
type = input_source[:type] if input_source&.dig(:type)
metric_format = input_source[:metric_format]
if type.blank?
raise "Incorrect configuration: 'type' of 'input_source' is required" unless continue_on_error
- 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 transfer_everything
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def transfer_everything(client, domain, migration_spec, opts = {})
filter_on_segment = migration_spec[:segments] || migration_spec['segments'] || []
GoodData.logger.info('Ensuring Users - warning: works across whole domain not just provided segment(s)')
ensure_users(domain, migration_spec, filter_on_segment)
- 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 process_response
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def process_response(options = {}, &block)
retries = options[:tries] || Helpers::GD_MAX_RETRY
process = options[:process]
dont_reauth = options[:dont_reauth]
options = options.reject { |k, _| [:process, :dont_reauth].include?(k) }
- 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 call
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
def call(params)
logger = params.gdc_logger
client = params.gdc_gd_client
project = client.projects(params.gdc_project) || client.projects(params.gdc_project_id)
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 = {
Method transfer_everything
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
def transfer_everything(client, domain, migration_spec, opts = {})
filter_on_segment = migration_spec[:segments] || migration_spec['segments'] || []
GoodData.logger.info('Ensuring Users - warning: works across whole domain not just provided segment(s)')
ensure_users(domain, migration_spec, filter_on_segment)
Method load_data
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
def load_data(params, data_source)
first_name_column = params.first_name_column&.downcase || 'first_name'
last_name_column = params.last_name_column&.downcase || 'last_name'
login_column = params.login_column&.downcase || 'login'
password_column = params.password_column&.downcase || 'password'
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"