Showing 91 of 91 total issues
Method inspect
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def inspect
''.tap do |s|
s << 'Props('
s << (raw_content? ? 'r' : '_')
s << (attributes? ? 'a' : '_')
- 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_files_in
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def all_files_in(dir_name, extra_files, recursion_limit = 10)
all_files_and_dirs_in(dir_name, extra_files).map do |fn|
case File.ftype(fn)
when 'link'
if recursion_limit.zero?
- 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 load
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def load(site, action_provider: nil)
rule_memory_store = Nanoc::Int::RuleMemoryStore.new(site: site)
dependency_store =
Nanoc::Int::DependencyStore.new(site.items.to_a + site.layouts.to_a, site: site)
Method run
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
unless File.exist?(source_path)
raise Errors::OutputDirDoesNotExist.new(source_path)
end
Method behavior_for
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def behavior_for(obj)
case obj
when String, Symbol, Numeric
RawUpdateBehavior
when Pathname
Method start
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def start
Nanoc::Int::NotificationCenter.on(:filtering_started) do |rep, filter_name|
@times_per_rep[rep] ||= {}
@times_per_rep[rep][filter_name] ||= {}
Method remove_empty_directories
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def remove_empty_directories(present_dirs)
present_dirs.reverse_each do |dir|
next if Dir.foreach(dir) { |n| break true if n !~ /\A\.\.?\z/ }
next if exclude?(dir)
delete_dir(dir)
- 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 read
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def read(filename)
# Read
begin
data = File.read(filename)
rescue => e
- 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 resolution_for
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def resolution_for(error)
error = unwrap_error(error)
case error
when LoadError
- 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 start
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def start
Nanoc::Int::NotificationCenter.on(:filtering_started) do |rep, filter_name|
@times_per_rep[rep] ||= {}
@times_per_rep[rep][filter_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
Method memoize
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def memoize(method_name)
original_method_name = '__nonmemoized_' + method_name.to_s
alias_method original_method_name, method_name
define_method(method_name) do |*args|
- 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 content_for
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def content_for(*args, &block)
if block_given? # Set content
name = args[0]
params =
case args.size
- 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 render
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def render(identifier, other_assigns = {}, &block)
# Find layout
layout_view = @layouts[identifier]
layout_view ||= @layouts[identifier.__nanoc_cleaned_identifier]
raise Nanoc::Int::Errors::UnknownLayout.new(identifier) if layout_view.nil?
Method run
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run(content, params = {})
if ::Redcarpet::VERSION > '2'
options = params.fetch(:options, {})
renderer_class = params.fetch(:renderer, ::Redcarpet::Render::HTML)
renderer_options = params.fetch(:renderer_options, {})
Method run
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
load_adsf
require 'rack'
load_site
Method files_and_dirs_in
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def files_and_dirs_in(dir)
present_files = []
present_dirs = []
Find.find(dir) do |f|
- 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 routing_rules_for
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def routing_rules_for(rep)
rules = {}
@item_routing_rules.each do |rule|
next unless rule.applicable_to?(rep.item)
next if rule.rep_name != rep.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
Method run
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
# Extract arguments
if arguments.length != 1
raise Nanoc::Int::Errors::GenericTrivial, "usage: #{command.usage}"
end
Method start
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def start
Nanoc::Int::NotificationCenter.on(:compilation_started, self) do |rep|
@start_times[rep] = Time.now
@acc_durations[rep] ||= 0.0
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 render
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def render(identifier, other_assigns = {}, &block)
# Find layout
layout_view = @layouts[identifier]
layout_view ||= @layouts[identifier.__nanoc_cleaned_identifier]
raise Nanoc::Int::Errors::UnknownLayout.new(identifier) if layout_view.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"