lib/maruku/input/mdline.rb
Method line_md_type
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
Open
def line_md_type
# The order of evaluation is important (:text is a catch-all)
return :text if self =~ /\A[a-zA-Z]/
return :empty if self =~ /\A\s*\z/
return :footnote_text if self =~ FootnoteText
- 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
Open
return :code if number_of_leading_spaces >= 4
Avoid too many return
statements within this method. Open
Open
return :quote if self =~ /\A>/
Avoid too many return
statements within this method. Open
Open
return :text if self =~ /\A[ ]{0,3}<\w+:\/\//
Avoid too many return
statements within this method. Open
Open
return :header2 if self =~ /\A([-\s])+\z/
Avoid too many return
statements within this method. Open
Open
return :ulist if self =~ /\A[ ]{0,3}([\*\-\+])\s+.*/
Avoid too many return
statements within this method. Open
Open
return :ald if self =~ AttributeDefinitionList
Avoid too many return
statements within this method. Open
Open
return :hrule if self =~ /\A(\s*[\*\-_]\s*){3,}\z/
Avoid too many return
statements within this method. Open
Open
return :abbreviation if self =~ Abbreviation
Avoid too many return
statements within this method. Open
Open
return :text if self =~ /\A[ ]{0,3}#{EMailAddress}/
Avoid too many return
statements within this method. Open
Open
return :definition if self =~ Definition
Avoid too many return
statements within this method. Open
Open
return :raw_html if self =~ /\A[ ]{0,3}<\!\-\-/
Avoid too many return
statements within this method. Open
Open
return :raw_html if self =~ %r{\A[ ]{0,3}</?\s*\w+}
Avoid too many return
statements within this method. Open
Open
return :text # else, it's just text
Avoid too many return
statements within this method. Open
Open
return :xml_instr if self =~ /\A\s*<\?/
Avoid too many return
statements within this method. Open
Open
return :ial if self =~ InlineAttributeList
Avoid too many return
statements within this method. Open
Open
return :header1 if self =~ /\A(=)+/
Avoid too many return
statements within this method. Open
Open
return :header3 if self =~ /\A(#)+\s*\S+/
Avoid too many return
statements within this method. Open
Open
return :olist if self =~ /\A[ ]{0,3}\d+\.\s+.*/