Showing 28 of 48 total issues
Method for
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.for(class_or_method_name)
class_or_method_name = strip_modules(class_or_method_name)
if(class_or_method_name)
begin
match = class_or_method_name.match(/(.*)((\.|\#|\:\:[a-z])(.+))/)
- 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 configure
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.configure
MetricFu.lib_require { 'core_ext' }
MetricFu.lib_require { 'configuration' }
init_files = Dir.glob(File.join(MetricFu.metrics_dir, '**/init.rb')).reject do |file|
if file =~ /rcov/o
- 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 lib_require
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.lib_require(base='',&block)
paths = []
base_path = File.join(LIB_ROOT, base)
Array((yield paths, base_path)).each do |path|
file = File.join(base_path, *Array(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 singularize
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def singularize(word)
result = word.to_s.dup
if inflections.uncountables.any? { |inflection| result =~ /\b(#{inflection})\Z/i }
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 per_file_info
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def per_file_info(out)
@method_containers.each_pair do |klass, container|
container.methods.each_pair do |method_name, data|
next if data[:path].nil?
- 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 massage_for_reek_12
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def massage_for_reek_12
section_break = ''
@output.split("\n").map do |line|
case line
when /^ /
- 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 fix_row_file_path!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def fix_row_file_path!(row)
# We know that Saikuro rows are broken
# next unless row['metric'] == :saikuro
key = [row['class_name'], row['method_name']]
current_file_path = row['file_path'].to_s
- 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 per_file_info
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def per_file_info(out)
@rails_best_practices_results[:problems].each do |problem|
next if problem[:file] == '' || problem[:problem].nil?
out[problem[: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"