Showing 9 of 9 total issues
Method handle_html_block
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def self.handle_html_block(instance)
doc = Nokogiri::HTML(instance.output)
doc.css('script').each do |node|
blk_type = node['type']
- 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 Processor
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class Processor
@@_hooks = {}
@@_registers = []
@@_processers = []
@@_priority = nil
Method hook
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def self.hook(container, event, &block)
return if not hook_register container, event
# define dispatch proc
dispatch = ->(instance) {
- 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 dispatch
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def dispatch(container, event)
method = "on_#{container}_#{event}"
self.send method, @page if self.respond_to? method
if event.to_s.start_with?('pre')
- 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 handle_html_block
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.handle_html_block(instance)
doc = Nokogiri::HTML(instance.output)
doc.css('script').each do |node|
blk_type = node['type']
Method use
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def self.use(name)
name = name.to_s.gsub(/-/, '').downcase
name += 'processor' unless name.match(/processor$/)
self.walk(File.join(File.dirname(__FILE__), '/../processors')) do |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 hook
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.hook(container, event, &block)
return if not hook_register container, event
# define dispatch proc
dispatch = ->(instance) {
Method walk
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.walk(start, &block)
Dir.foreach start do |x|
path = File.join(start, x)
if x == '.' or x == '..'
next
- 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_register
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def initialize_register
if @@_registers.size.zero?
self.class.register :pages, :pre_render, :post_render
self.class.register :posts, :pre_render, :post_render
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"