plurimath/mathml2asciimath

View on GitHub

Showing 4 of 8 total issues

Method parse has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
Open

  def self.parse(node)
    out = ""
    if node.text?
      return encodechars(HTMLEntities.new.decode(node.text))
    end
Severity: Minor
Found in lib/mathml2asciimath/m2a.rb - About 7 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 encodechars has 148 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def self.encodechars(xml)
    xml.gsub(/\u03b1/, "alpha")
      .gsub(/\u03b2/, "beta")
      .gsub(/\u03b3/, "gamma")
      .gsub(/\u0393/, "Gamma")
Severity: Major
Found in lib/mathml2asciimath/m2a.rb - About 5 hrs to fix

    Method parse has 96 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def self.parse(node)
        out = ""
        if node.text?
          return encodechars(HTMLEntities.new.decode(node.text))
        end
    Severity: Major
    Found in lib/mathml2asciimath/m2a.rb - About 3 hrs to fix

      File m2a.rb has 263 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require "nokogiri"
      require "htmlentities"
      require "pp"
      
      module MathML2AsciiMath
      Severity: Minor
      Found in lib/mathml2asciimath/m2a.rb - About 2 hrs to fix
        Severity
        Category
        Status
        Source
        Language