Showing 85 of 91 total issues
Method print_item_dependencies
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def print_item_dependencies(items, dependency_store)
print_header('Item dependencies')
puts 'Legend:'
puts ' r = dependency on raw content'
- 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 a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def run(content, params = {})
Nanoc::Extra::JRubyNokogiriWarner.check_and_warn
# Take colorizers from parameters
@colorizers = Hash.new(params[:default_colorizer] || DEFAULT_COLORIZER)
- 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 compile.rb
has 328 lines of code (exceeds 250 allowed). Consider refactoring. Open
usage 'compile [options]'
summary 'compile items of this site'
description <<-EOS
Compile all items of the current site.
EOS
Method validate
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def validate(href)
# Parse
url = nil
begin
url = URI.parse(href)
- 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
Class Filesystem
has 29 methods (exceeds 20 allowed). Consider refactoring. Open
class Filesystem < Nanoc::DataSource
identifiers :filesystem, :filesystem_unified
# See {Nanoc::DataSource#up}.
def up; end
Method xml_sitemap
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def xml_sitemap(params = {})
require 'builder'
# Extract parameters
items = params.fetch(:items) { @items.reject { |i| i[:is_hidden] } }
- 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 filesystem.rb
has 292 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Nanoc::DataSources
# The filesystem data source stores its items and layouts in nested
# directories. Items and layouts are represented by one or two files; if it
# is represented using one file, the metadata can be contained in this file.
#
Class ErrorHandler
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class ErrorHandler
# @param [Nanoc::CLI::Command, nil] command The command that is
# currently being executed, or nil if there is none
def initialize(command: nil)
@command = command
Class CleaningStream
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class CleaningStream
# @param [IO, StringIO] stream The stream to wrap
def initialize(stream)
@stream = stream
@stream_cleaners = []
Method run
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def run
unless File.exist?(source_path)
raise Errors::OutputDirDoesNotExist.new(source_path)
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 each
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def each
queue = SizedQueue.new(2 * @parallelism)
error = nil
threads = (1..@parallelism).map do
- 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 a Cognitive Complexity of 15 (exceeds 5 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, {})
- 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
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
def validate(href)
# Parse
url = nil
begin
url = URI.parse(href)
Method all_split_files_in
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def all_split_files_in(dir_name)
by_basename =
all_files_in(dir_name)
.reject { |fn| fn =~ /(~|\.orig|\.rej|\.bak)$/ }
.group_by { |fn| basename_of(fn) }
- 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 14 (exceeds 5 allowed). Consider refactoring. Open
def start
require 'tempfile'
setup_diffs
old_contents = {}
Nanoc::Int::NotificationCenter.on(:will_write_rep, self) do |rep, 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 run
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run(content, params = {})
Nanoc::Extra::JRubyNokogiriWarner.check_and_warn
# Take colorizers from parameters
@colorizers = Hash.new(params[:default_colorizer] || DEFAULT_COLORIZER)
Method print_item_dependencies
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def print_item_dependencies(items, dependency_store)
print_header('Item dependencies')
puts 'Legend:'
puts ' r = dependency on raw content'
Method run
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
# Check arguments
if arguments.any?
raise Nanoc::Int::Errors::GenericTrivial, "usage: #{command.usage}"
end
Method content_for
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def content_for(*args, &block)
if block_given? # Set content
name = args[0]
params =
case args.size
Method mtime_of
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def mtime_of(content_filename, meta_filename)
meta_mtime = meta_filename ? File.stat(meta_filename).mtime : nil
content_mtime = content_filename ? File.stat(content_filename).mtime : nil
if meta_mtime && content_mtime
meta_mtime > content_mtime ? meta_mtime : content_mtime
- 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"