ManaManaFramework/manamana

View on GitHub
lib/manamana/rdsl/lexer.rb

Summary

Maintainability
F
1 wk
Test Coverage

Method tokenize has a Cognitive Complexity of 130 (exceeds 5 allowed). Consider refactoring.
Open

      def tokenize(data)
        data = data.unpack("c*") if(data.is_a?(String))
        eof = data.length
        token_array = []

Severity: Minor
Found in lib/manamana/rdsl/lexer.rb - About 2 days 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 tokenize has 215 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def tokenize(data)
        data = data.unpack("c*") if(data.is_a?(String))
        eof = data.length
        token_array = []

Severity: Major
Found in lib/manamana/rdsl/lexer.rb - About 1 day to fix

    Method initialize has 179 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def initialize
            
    # line 20 "lib/manamana/rdsl/lexer.rb"
    class << self
        attr_accessor :_lexer_actions
    Severity: Major
    Found in lib/manamana/rdsl/lexer.rb - About 7 hrs to fix

      File lexer.rb has 430 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      module ManaMana
      
        module RDSL
      
          class Lexer
      Severity: Minor
      Found in lib/manamana/rdsl/lexer.rb - About 6 hrs to fix

        Avoid deeply nested control flow statements.
        Open

                    case _lexer_actions[_acts - 1]
        when 3 then
        # line 1 "NONE"
                begin
        te = p+1
        Severity: Major
        Found in lib/manamana/rdsl/lexer.rb - About 45 mins to fix

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              if _goto_level <= _resume
              _acts = _lexer_from_state_actions[cs]
              _nacts = _lexer_actions[_acts]
              _acts += 1
              while _nacts > 0
          Severity: Major
          Found in lib/manamana/rdsl/lexer.rb and 1 other location - About 6 hrs to fix
          lib/manamana/tdsl/lexer.rb on lines 303..371

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 226.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          self._lexer_trans_targs = [
              23, 2, 27, 6, 26, 9, 4, 5, 
              3, 10, 28, 1, 13, 0, 29, 23, 
              15, 33, 20, 31, 17, 14, 18, 32, 
              19, 23, 22, 34, 23, 24, 12, 23, 
          Severity: Minor
          Found in lib/manamana/rdsl/lexer.rb and 1 other location - About 55 mins to fix
          lib/manamana/rdsl/lexer.rb on lines 150..157

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 45.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          self._lexer_trans_actions = [
              17, 0, 3, 0, 3, 0, 0, 0, 
              0, 0, 0, 0, 0, 0, 3, 15, 
              0, 3, 0, 3, 0, 0, 0, 3, 
              0, 19, 0, 24, 5, 3, 0, 13, 
          Severity: Minor
          Found in lib/manamana/rdsl/lexer.rb and 1 other location - About 55 mins to fix
          lib/manamana/rdsl/lexer.rb on lines 137..144

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 45.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 7 locations. Consider refactoring.
          Open

          self._lexer_to_state_actions = [
              0, 0, 0, 0, 0, 0, 0, 0, 
              0, 0, 0, 0, 0, 0, 0, 0, 
              0, 0, 0, 0, 0, 0, 0, 21, 
              0, 0, 0, 0, 0, 0, 0, 0, 
          Severity: Major
          Found in lib/manamana/rdsl/lexer.rb and 6 other locations - About 40 mins to fix
          lib/manamana/rdsl/lexer.rb on lines 35..41
          lib/manamana/rdsl/lexer.rb on lines 74..80
          lib/manamana/rdsl/lexer.rb on lines 86..92
          lib/manamana/rdsl/lexer.rb on lines 98..104
          lib/manamana/rdsl/lexer.rb on lines 175..181
          lib/manamana/rdsl/lexer.rb on lines 187..193

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 38.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 7 locations. Consider refactoring.
          Open

          self._lexer_eof_trans = [
              0, 1, 1, 1, 1, 1, 1, 1, 
              1, 1, 1, 1, 0, 0, 16, 16, 
              16, 16, 16, 16, 16, 16, 26, 0, 
              32, 32, 32, 32, 37, 38, 38, 38, 
          Severity: Major
          Found in lib/manamana/rdsl/lexer.rb and 6 other locations - About 40 mins to fix
          lib/manamana/rdsl/lexer.rb on lines 35..41
          lib/manamana/rdsl/lexer.rb on lines 74..80
          lib/manamana/rdsl/lexer.rb on lines 86..92
          lib/manamana/rdsl/lexer.rb on lines 98..104
          lib/manamana/rdsl/lexer.rb on lines 163..169
          lib/manamana/rdsl/lexer.rb on lines 175..181

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 38.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 7 locations. Consider refactoring.
          Open

          self._lexer_index_offsets = [
              0, 0, 12, 22, 33, 42, 45, 47, 
              49, 51, 53, 55, 57, 59, 64, 76, 
              86, 88, 90, 92, 95, 97, 99, 102, 
              112, 117, 122, 126, 129, 131, 136, 141, 
          Severity: Major
          Found in lib/manamana/rdsl/lexer.rb and 6 other locations - About 40 mins to fix
          lib/manamana/rdsl/lexer.rb on lines 35..41
          lib/manamana/rdsl/lexer.rb on lines 74..80
          lib/manamana/rdsl/lexer.rb on lines 86..92
          lib/manamana/rdsl/lexer.rb on lines 163..169
          lib/manamana/rdsl/lexer.rb on lines 175..181
          lib/manamana/rdsl/lexer.rb on lines 187..193

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 38.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 7 locations. Consider refactoring.
          Open

          self._lexer_single_lengths = [
              0, 7, 5, 6, 4, 2, 1, 1, 
              1, 1, 1, 1, 1, 1, 7, 5, 
              1, 1, 1, 2, 1, 1, 1, 4, 
              3, 4, 2, 2, 1, 3, 4, 2, 
          Severity: Major
          Found in lib/manamana/rdsl/lexer.rb and 6 other locations - About 40 mins to fix
          lib/manamana/rdsl/lexer.rb on lines 35..41
          lib/manamana/rdsl/lexer.rb on lines 86..92
          lib/manamana/rdsl/lexer.rb on lines 98..104
          lib/manamana/rdsl/lexer.rb on lines 163..169
          lib/manamana/rdsl/lexer.rb on lines 175..181
          lib/manamana/rdsl/lexer.rb on lines 187..193

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 38.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 7 locations. Consider refactoring.
          Open

          self._lexer_from_state_actions = [
              0, 0, 0, 0, 0, 0, 0, 0, 
              0, 0, 0, 0, 0, 0, 0, 0, 
              0, 0, 0, 0, 0, 0, 0, 1, 
              0, 0, 0, 0, 0, 0, 0, 0, 
          Severity: Major
          Found in lib/manamana/rdsl/lexer.rb and 6 other locations - About 40 mins to fix
          lib/manamana/rdsl/lexer.rb on lines 35..41
          lib/manamana/rdsl/lexer.rb on lines 74..80
          lib/manamana/rdsl/lexer.rb on lines 86..92
          lib/manamana/rdsl/lexer.rb on lines 98..104
          lib/manamana/rdsl/lexer.rb on lines 163..169
          lib/manamana/rdsl/lexer.rb on lines 187..193

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 38.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 7 locations. Consider refactoring.
          Open

          self._lexer_key_offsets = [
              0, 0, 15, 28, 42, 54, 56, 57, 
              58, 59, 60, 61, 62, 63, 70, 85, 
              98, 99, 100, 101, 103, 104, 105, 108, 
              122, 127, 131, 135, 137, 138, 143, 147, 
          Severity: Major
          Found in lib/manamana/rdsl/lexer.rb and 6 other locations - About 40 mins to fix
          lib/manamana/rdsl/lexer.rb on lines 74..80
          lib/manamana/rdsl/lexer.rb on lines 86..92
          lib/manamana/rdsl/lexer.rb on lines 98..104
          lib/manamana/rdsl/lexer.rb on lines 163..169
          lib/manamana/rdsl/lexer.rb on lines 175..181
          lib/manamana/rdsl/lexer.rb on lines 187..193

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 38.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 7 locations. Consider refactoring.
          Open

          self._lexer_range_lengths = [
              0, 4, 4, 4, 4, 0, 0, 0, 
              0, 0, 0, 0, 0, 3, 4, 4, 
              0, 0, 0, 0, 0, 0, 1, 5, 
              1, 0, 1, 0, 0, 1, 0, 1, 
          Severity: Major
          Found in lib/manamana/rdsl/lexer.rb and 6 other locations - About 40 mins to fix
          lib/manamana/rdsl/lexer.rb on lines 35..41
          lib/manamana/rdsl/lexer.rb on lines 74..80
          lib/manamana/rdsl/lexer.rb on lines 98..104
          lib/manamana/rdsl/lexer.rb on lines 163..169
          lib/manamana/rdsl/lexer.rb on lines 175..181
          lib/manamana/rdsl/lexer.rb on lines 187..193

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 38.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              0, 1, 2, 1, 3, 1, 5, 1, 
              6, 1, 7, 1, 8, 1, 9, 1, 
              10, 1, 11, 1, 12, 2, 0, 1, 
              2, 3, 4
          Severity: Minor
          Found in lib/manamana/rdsl/lexer.rb and 1 other location - About 20 mins to fix
          lib/manamana/rdsl/parser.rb on lines 43..45

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 28.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          There are no issues that match your filters.

          Category
          Status