Showing 28 of 48 total issues
Class Configuration
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class Configuration
def initialize #:nodoc:#
reset
end
Class Template
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class Template
attr_accessor :report, :per_file_data
private
# Creates a new erb evaluated result from the passed in section.
Method get_elements
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def get_elements
begin
while (line = @file_handle.readline) do
return [] if line.nil? || line !~ /\S/
element ||= 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 add_method_data
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def add_method_data
@rcov.each_pair do |file_path, info|
file_contents = ""
coverage = []
- 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 13 (exceeds 5 allowed). Consider refactoring. Open
def per_file_info(out)
@saikuro_data[:files].each do |file_data|
next if File.extname(file_data[:filename]) == '.erb' || !File.exists?(file_data[:filename])
begin
line_numbers = MetricFu::LineNumbers.new(File.open(file_data[:filename], 'r').read)
- 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 12 (exceeds 5 allowed). Consider refactoring. Open
def per_file_info(out)
@matches.each do |file_data|
file_path = file_data[:file_path]
next if File.extname(file_path) =~ /\.erb|\.html|\.haml/
begin
- 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 write_file_data
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def write_file_data
per_file_data.each_pair do |file, lines|
data = File.open(file, 'r').readlines
fn = "#{file.gsub(%r{/}, '_')}.html"
- 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 write_file_data
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def write_file_data
per_file_data.each_pair do |file, lines|
data = File.open(file, 'r').readlines
fn = "#{file.gsub(%r{/}, '_')}.html"
Method get_metrics
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def get_metrics(metrics, date)
if metrics && metrics[:reek]
counter = @labels.size
@labels.update( { @labels.size => 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
Method add_method_data
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add_method_data
@rcov.each_pair do |file_path, info|
file_contents = ""
coverage = []
Method write
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def write
# Getting rid of the crap before and after the project name from integrity
# @name = File.basename(Dir.pwd).gsub(/^\w+-|-\w+$/, "")
@name = Pathname.new(Dir.pwd).basename
Method validate
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def validate(options) # remove this method if you want fewer lines of code and don't need validations
options.each_pair do |key, value|
opt = @options.find_all{ |o| o[0] == key }.first
key = "--" << key.to_s.gsub("_", "-")
unless opt[2][:value_in_set].nil? || opt[2][:value_in_set].include?(value)
- 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
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.get(file_path, class_name, method_name)
# This could be more 'confident' using Maybe, but we want it to be as fast as possible
file_path_copy = file_path == nil ? nil : file_path.clone
class_name_copy = class_name == nil ? nil : class_name.clone
method_name_copy = method_name == nil ? nil : method_name.clone
- 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 file_url
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def file_url(name, line) # :nodoc:
return '' unless name
filename = complete_file_path(name)
link_prefix = MetricFu.configuration.link_prefix
if link_prefix
- 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 pluralize
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def pluralize(word)
result = word.to_s.dup
if word.empty? || inflections.uncountables.include?(result.downcase)
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 emit
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def emit
files = []
MetricFu.flog[:dirs_to_flog].each do |directory|
directory = "." if directory=='./'
dir_files = Dir.glob("#{directory}/**/*.rb")
- 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 initialize
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def initialize(contents,file_path='')
if contents.to_s.size.zero?
puts "NON PARSEABLE INPUT: File is empty at path #{file_path.inspect}\n\t#{caller.join("\n\t")}"
else
rp = RubyParser.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 constantize
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def constantize(camel_cased_word) #:nodoc:
names = camel_cased_word.split('::')
names.shift if names.empty? || names.first.empty?
constant = Object
- 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 emit
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def emit
options_string = MetricFu.saikuro.inject("") do |options, option|
option[0] == :input_directory ? options : options + "--#{option.join(' ')} "
end
- 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 constantize
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def constantize(camel_cased_word)
names = camel_cased_word.split('::')
names.shift if names.empty? || names.first.empty?
constant = Object
- 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"