Method increment_the_branch
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def increment_the_branch( array_to_sub, selector, next_selector )
if selector > next_selector #going up the tree and reset
selectors_to_reset = @substitutions.inject([]){ |m,(k,v)| m << k if k > next_selector; m }
selectors_to_reset.each do | this_selector |
substitutor = @substitutions[this_selector]
- 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 leaders.rb
has 297 lines of code (exceeds 250 allowed). Consider refactoring. Open
module LegalToMarkdown
extend self
module Leaders
Method get_the_levels
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def get_the_levels
begin
@headers.each do | header, value |
if @deep_leaders
search = "l" + header[-1] + "." if header =~ /level-\d/
- 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 build_the_block_for_jason
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def build_the_block_for_jason( arrayed_block )
require 'securerandom'
annotations_hash = {}
provisions_hash = arrayed_block.inject({}) do |block, arrayed_line|
(sub_it, reference, selector, arrayed_line) = block_builder arrayed_line
Method log_the_key
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def log_the_key( block, sub_it, reference, selector, arrayed_line, arrayed_block )
Method build_the_block_for_jason
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def build_the_block_for_jason( arrayed_block )
require 'securerandom'
annotations_hash = {}
provisions_hash = arrayed_block.inject({}) do |block, arrayed_line|
(sub_it, reference, selector, arrayed_line) = block_builder arrayed_line
- 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 chew_on_the_block
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def chew_on_the_block
# @substitutions hash example
# {"ll."OR "l2."=>[:type8, "Article ", "(", "1", ")", :no_reset || nil, :no_indent || nil, :preval || :pre || nil],}
@cross_references = {}
arrayed_block = []
- 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 build_an_annotation
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def build_an_annotation( start, stop, cite, parent, substitution )
Avoid too many return
statements within this method. Open
return[:type8, value.delete("(" + $1 + ")"), "(", $1, ")"]
Avoid too many return
statements within this method. Open
return[:type9, value.delete("(" + $1 + ")"), "(", $1, ")"]
Avoid too many return
statements within this method. Open
return[:type0, value.delete($1 + "."), "", $1, "."]
Avoid too many return
statements within this method. Open
return[:type5, value.delete($1 + "."), "", $1, "."]
Avoid too many return
statements within this method. Open
return[:type7, value.delete($1 + "."), "", $1, "."]
Avoid too many return
statements within this method. Open
return[:type6, value.delete("(" + $1 + ")"), "(", $1, ")"]
Method romans_setup
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def romans_setup( array_to_sub )
if @r_l || @r_u
array_to_sub[3] = RomanNumerals.to_roman_upper(array_to_sub[3]) if @r_u
array_to_sub[3] = RomanNumerals.to_roman_lower(array_to_sub[3]) if @r_l
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 get_selector_above
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_selector_above( selector )
if @deep_leaders
selector_above = "l" + (selector[1].to_i-1).to_s + "."
selector_above = "l1." if selector_above == "l0."
else
- 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"