bhollis/maruku

View on GitHub
lib/maruku/ext/math/mathml_engines/blahtex.rb

Summary

Maintainability
B
5 hrs
Test Coverage

Method convert_to_png_blahtex has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

  def convert_to_png_blahtex(kind, tex)
    FileUtils.mkdir_p get_setting(:html_png_dir)

    # first, we check whether this image has already been processed
    md5sum = Digest::MD5.hexdigest(tex + " params: ")
Severity: Minor
Found in lib/maruku/ext/math/mathml_engines/blahtex.rb - About 3 hrs to fix

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 convert_to_png_blahtex has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def convert_to_png_blahtex(kind, tex)
    FileUtils.mkdir_p get_setting(:html_png_dir)

    # first, we check whether this image has already been processed
    md5sum = Digest::MD5.hexdigest(tex + " params: ")
Severity: Minor
Found in lib/maruku/ext/math/mathml_engines/blahtex.rb - About 1 hr to fix

    Method convert_to_mathml_blahtex has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def convert_to_mathml_blahtex(kind, tex)
        result = run_blahtex(tex, %w[--mathml])
    
        doc = REXML::Document.new(result)
        mathml = doc.get_elements('//markup').to_a.first
    Severity: Minor
    Found in lib/maruku/ext/math/mathml_engines/blahtex.rb - About 35 mins to fix

    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

    There are no issues that match your filters.

    Category
    Status