Showing 26 of 28 total issues
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_jason
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def build_jason
if @content.is_a?(Array)
@content[0] = build_header_and_text_hashs @content[0] unless @content[0].empty?
@content[2] = build_header_and_text_hashs @content[2] unless @content[2].empty?
content_hash = {}
- 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 write_it
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def write_it( final_content, writer )
final_content = final_content.gsub(/ +\n/, "\n") if writer == :markdown
require 'json' if writer == :jason
if @output_file && @output_file != "-"
File.open(@output_file, "w") {|f| f.write( final_content ); f.close } if writer == :markdown
- 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 verbose_after_process
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def verbose_after_process source, action
if @verbose
puts
puts Paint["Here's what I found after running the #{action}.", :blue, :bold]
puts Paint['=============================================', :blue]
- 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 clauses_churn_add
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def clauses_churn_add
@clauses_added.each do | mixin |
pattern = /(\[\{\{#{mixin}\}\}\s*?)(.*?\n*?)(\])/m
sub_pattern = /\[\{\{(\S+?)\}\}\s*?/
@content[pattern]
- 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 clauses_churn_delete
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def clauses_churn_delete
@clauses_deleted.each do | mixin |
pattern = /(\[\{\{#{mixin}\}\}\s*?)(.*?\n*?)(\])/m
sub_pattern = /\[\{\{(\S+?)\}\}\s*?/
@content[pattern]
- 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_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 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_an_annotation
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def build_an_annotation( start, stop, cite, parent, substitution )
Method filter_yaml
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def filter_yaml pattern
# @headers will be a hash, stuff is an array, returns a filtered hash
stuff = pattern.is_a?(Regexp) ? scan_doc(pattern) : pattern
if stuff
stuff_in_yaml = stuff.inject({}) do |hash, elem|
- 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_new_yaml_frontmatter
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def build_new_yaml_frontmatter
@content = "\n---\n\n" + @content
replacers = {0=>"Mixins", 1=>"Optional Clauses", 2=>"Structured Headers", 3=>"Properties", 4=>"Document Meta-Data"}
stringy = @yaml_data_as_array.inject("") do |string, section|
unless section.empty?
- 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 text_mixins
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def text_mixins
@headers.each do | mixin, replacer |
unless mixin =~ /level-\d/ or mixin =~ /no-reset/ or mixin =~ /no-indent/ or mixin =~ /level-style/
replacer = replacer.to_s
mixin_pattern = /(\{\{#{mixin}\}\})/
- 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
Avoid too many return
statements within this method. Open
return[:type6, 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[:type7, value.delete($1 + "."), "", $1, "."]