Showing 840 of 840 total issues
Method process_files_if_needed
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def process_files_if_needed(files, code_module, template, project, targets, group_path, dir_path, root_path, processed_groups = [])
# It's possible that current project doesn't test targets configured, so it doesn't need to generate tests.
# The same is for files property - a template can have only test or project files
if targets.count == 0 || files == nil || files.count == 0 || dir_path == nil || group_path == nil
return
Method install_template
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def install_template(template_declaration)
template_name = template_declaration.name
puts("Installing #{template_name}...")
template_name = template_declaration.name
Method gen
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def gen(module_name, template_name)
does_rambafile_exist = Dir[RAMBAFILE_NAME].count > 0
unless does_rambafile_exist
puts('Rambafile not found! Run `generamba setup` in the working directory instead!'.red)
Method initialize
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(name, rambafile, options)
# Base initialization
@name = name
@description = options[:description] ? options[:description] : "#{name} module"
@author = rambafile[AUTHOR_NAME_KEY] ? rambafile[AUTHOR_NAME_KEY] : UserPreferences.obtain_username
Block has too many lines. [35/25] Open
no_commands do
def ask_index(message, array)
value_index = ask_with_validation(message,->(value){ (value.to_i >= 0 and value.to_i < array.count) },"Invalid selection. Please enter number from 0 to #{array.count-1}")
return array[value_index.to_i]
end
- Read upRead up
- Exclude checks
This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.
Method process_files_if_needed
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def process_files_if_needed(files, code_module, template, project, targets, group_path, dir_path, root_path, processed_groups = [])
Method install_template
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def install_template(template_declaration)
template_name = template_declaration.name
puts("Installing #{template_name}...")
repo_url = template_declaration.git
Method add_file_to_project_and_targets
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.add_file_to_project_and_targets(project, targets_name, group_path, dir_path, file_group_path, file_name, root_path, file_is_resource = false)
Method add_file_to_project_and_targets
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.add_file_to_project_and_targets(project, targets_name, group_path, dir_path, file_group_path, file_name, root_path, file_is_resource = false)
if root_path
file_path = root_path
else
- 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 remove_file_from_build_phases
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.remove_file_from_build_phases(file_path, build_phases)
return if build_phases.nil?
build_phases.each do |build_phase|
build_phase.files.each do |build_file|
- 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
Block has too many lines. [31/25] Open
files.each do |file|
unless file[TEMPLATE_FILE_PATH_KEY]
directory_name = file[TEMPLATE_NAME_KEY].gsub(/^\/|\/$/, '')
file_group = dir_path.join(directory_name)
- Read upRead up
- Exclude checks
This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.
Method retrieve_group_or_create_if_needed
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.retrieve_group_or_create_if_needed(group_path, dir_path, file_group_path, project, create_group_if_not_exists, group_is_logical = false)
Method prepare_parameters_for_displaying
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.prepare_parameters_for_displaying(code_module, template_name)
params = {}
params['Targets'] = code_module.project_targets.join(',') if code_module.project_targets
params['Module path'] = code_module.project_file_path if code_module.project_file_path
- 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 setup_username
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def setup_username
username = Generamba::UserPreferences.obtain_username
unless username
puts('The author name is not configured!'.red)
git_username = Git.init.config['user.name']
- 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
Avoid parameter lists longer than 5 parameters. [9/5] Open
def process_files_if_needed(files, code_module, template, project, targets, group_path, dir_path, root_path, processed_groups = [])
- Read upRead up
- Exclude checks
This cop checks for methods with too many parameters. The maximum number of parameters is configurable. Keyword arguments can optionally be excluded from the total count.
Method add_group_to_project
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.add_group_to_project(project, group_path, dir_path, directory_name, group_is_logical)
Method ask_file_with_path
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def ask_file_with_path(pattern, message_file_name)
project_files = Dir[pattern]
count = project_files.count
default_message = "The path to a #{message_file_name}:"
if count == 1
- 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
Avoid parameter lists longer than 5 parameters. [8/5] Open
def self.add_file_to_project_and_targets(project, targets_name, group_path, dir_path, file_group_path, file_name, root_path, file_is_resource = false)
- Read upRead up
- Exclude checks
This cop checks for methods with too many parameters. The maximum number of parameters is configurable. Keyword arguments can optionally be excluded from the total count.
Method check_all_required_dependencies_has_in_podfile
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.check_all_required_dependencies_has_in_podfile(dependencies, podfile_path)
return if !dependencies || dependencies.count == 0 || !podfile_path
dependencies_names = []
Pod::Podfile.from_file(Pathname.new(podfile_path)).dependencies.each do |dependency|
- 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 all_nil_mandatory_fields_for_target_type
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def all_nil_mandatory_fields_for_target_type(target_type, code_module)
fields = []
variable_name = "#{target_type}_targets"
- 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"