aozorahack/aozora2html

View on GitHub
lib/aozora2html/utils.rb

Summary

Maintainability
F
3 days
Test Coverage

Consider simplifying this complex logical expression.
Open

      if ((code >= '81ad') && (code <= '81b7')) ||
         ((code >= '81c0') && (code <= '81c7')) ||
         ((code >= '81cf') && (code <= '81d9')) ||
         ((code >= '81e9') && (code <= '81ef')) ||
         ((code >= '81f8') && (code <= '81fb')) ||
Severity: Critical
Found in lib/aozora2html/utils.rb - About 2 days to fix

    Method illegal_char_check has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring.
    Open

        def illegal_char_check(char, line)
          return unless char.is_a?(String)
    
          code = char.unpack1('H*')
          if (code == '21') ||
    Severity: Minor
    Found in lib/aozora2html/utils.rb - About 1 day 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

    Consider simplifying this complex logical expression.
    Open

          if (code == '21') ||
             (code == '23') ||
             ((code >= 'a1') && (code <= 'a5')) ||
             ((code >= '28') && (code <= '29')) ||
             (code == '5b') ||
    Severity: Critical
    Found in lib/aozora2html/utils.rb - About 3 hrs to fix

      Method illegal_char_check has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def illegal_char_check(char, line)
            return unless char.is_a?(String)
      
            code = char.unpack1('H*')
            if (code == '21') ||
      Severity: Minor
      Found in lib/aozora2html/utils.rb - About 1 hr to fix

        There are no issues that match your filters.

        Category
        Status