ManaManaFramework/manamana

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

Summary

Maintainability
F
1 wk
Test Coverage

Method tokenize has a Cognitive Complexity of 123 (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/tdsl/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 initialize has 209 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def initialize
        
# line 21 "lib/manamana/tdsl/lexer.rb"
class << self
    attr_accessor :_lexer_actions
Severity: Major
Found in lib/manamana/tdsl/lexer.rb - About 1 day to fix

    Method tokenize has 187 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/tdsl/lexer.rb - About 7 hrs to fix

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

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

        Avoid deeply nested control flow statements.
        Open

                    case _lexer_actions[_acts - 1]
        when 2 then
        # line 1 "NONE"
                begin
        te = p+1
        Severity: Major
        Found in lib/manamana/tdsl/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/tdsl/lexer.rb and 1 other location - About 6 hrs to fix
          lib/manamana/rdsl/lexer.rb on lines 300..368

          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 = [
              2, 0, 55, 54, 3, 57, 6, 7, 
              8, 9, 10, 11, 54, 13, 14, 15, 
              16, 17, 18, 19, 20, 21, 22, 23, 
              25, 26, 27, 28, 30, 31, 32, 33, 
          Severity: Major
          Found in lib/manamana/tdsl/lexer.rb and 1 other location - About 1 hr to fix
          lib/manamana/tdsl/lexer.rb on lines 169..179

          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 70.

          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 = [
              0, 0, 5, 17, 0, 5, 0, 0, 
              0, 0, 0, 0, 7, 0, 0, 0, 
              0, 0, 0, 0, 0, 0, 0, 0, 
              0, 0, 0, 0, 0, 0, 0, 0, 
          Severity: Major
          Found in lib/manamana/tdsl/lexer.rb and 1 other location - About 1 hr to fix
          lib/manamana/tdsl/lexer.rb on lines 153..163

          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 70.

          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, 1, 11, 23, 24, 25, 26, 
              27, 28, 29, 30, 31, 32, 33, 34, 
              35, 36, 37, 38, 39, 40, 41, 42, 
              43, 44, 45, 46, 47, 48, 49, 50, 
          Severity: Major
          Found in lib/manamana/tdsl/lexer.rb and 6 other locations - About 1 hr to fix
          lib/manamana/tdsl/lexer.rb on lines 77..86
          lib/manamana/tdsl/lexer.rb on lines 92..101
          lib/manamana/tdsl/lexer.rb on lines 107..116
          lib/manamana/tdsl/lexer.rb on lines 185..194
          lib/manamana/tdsl/lexer.rb on lines 200..209
          lib/manamana/tdsl/lexer.rb on lines 215..224

          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 65.

          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, 0, 
              0, 0, 0, 0, 0, 0, 0, 0, 
          Severity: Major
          Found in lib/manamana/tdsl/lexer.rb and 6 other locations - About 1 hr to fix
          lib/manamana/tdsl/lexer.rb on lines 35..44
          lib/manamana/tdsl/lexer.rb on lines 77..86
          lib/manamana/tdsl/lexer.rb on lines 92..101
          lib/manamana/tdsl/lexer.rb on lines 107..116
          lib/manamana/tdsl/lexer.rb on lines 200..209
          lib/manamana/tdsl/lexer.rb on lines 215..224

          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 65.

          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, 1, 2, 4, 1, 1, 1, 1, 
              1, 1, 1, 1, 1, 1, 1, 1, 
              1, 1, 1, 1, 1, 1, 1, 1, 
              1, 1, 1, 1, 1, 1, 1, 1, 
          Severity: Major
          Found in lib/manamana/tdsl/lexer.rb and 6 other locations - About 1 hr to fix
          lib/manamana/tdsl/lexer.rb on lines 35..44
          lib/manamana/tdsl/lexer.rb on lines 92..101
          lib/manamana/tdsl/lexer.rb on lines 107..116
          lib/manamana/tdsl/lexer.rb on lines 185..194
          lib/manamana/tdsl/lexer.rb on lines 200..209
          lib/manamana/tdsl/lexer.rb on lines 215..224

          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 65.

          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, 0, 4, 4, 0, 0, 0, 0, 
              0, 0, 0, 0, 0, 0, 0, 0, 
              0, 0, 0, 0, 0, 0, 0, 0, 
              0, 0, 0, 0, 0, 0, 0, 0, 
          Severity: Major
          Found in lib/manamana/tdsl/lexer.rb and 6 other locations - About 1 hr to fix
          lib/manamana/tdsl/lexer.rb on lines 35..44
          lib/manamana/tdsl/lexer.rb on lines 77..86
          lib/manamana/tdsl/lexer.rb on lines 107..116
          lib/manamana/tdsl/lexer.rb on lines 185..194
          lib/manamana/tdsl/lexer.rb on lines 200..209
          lib/manamana/tdsl/lexer.rb on lines 215..224

          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 65.

          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, 0, 0, 4, 4, 0, 0, 0, 
              0, 0, 0, 0, 0, 0, 0, 0, 
              0, 0, 0, 0, 0, 0, 0, 0, 
              0, 0, 0, 0, 0, 0, 0, 0, 
          Severity: Major
          Found in lib/manamana/tdsl/lexer.rb and 6 other locations - About 1 hr to fix
          lib/manamana/tdsl/lexer.rb on lines 35..44
          lib/manamana/tdsl/lexer.rb on lines 77..86
          lib/manamana/tdsl/lexer.rb on lines 92..101
          lib/manamana/tdsl/lexer.rb on lines 107..116
          lib/manamana/tdsl/lexer.rb on lines 185..194
          lib/manamana/tdsl/lexer.rb on lines 200..209

          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 65.

          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, 0, 
              0, 0, 0, 0, 0, 0, 0, 0, 
          Severity: Major
          Found in lib/manamana/tdsl/lexer.rb and 6 other locations - About 1 hr to fix
          lib/manamana/tdsl/lexer.rb on lines 35..44
          lib/manamana/tdsl/lexer.rb on lines 77..86
          lib/manamana/tdsl/lexer.rb on lines 92..101
          lib/manamana/tdsl/lexer.rb on lines 107..116
          lib/manamana/tdsl/lexer.rb on lines 185..194
          lib/manamana/tdsl/lexer.rb on lines 215..224

          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 65.

          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, 2, 9, 18, 20, 22, 24, 
              26, 28, 30, 32, 34, 36, 38, 40, 
              42, 44, 46, 48, 50, 52, 54, 56, 
              58, 60, 62, 64, 66, 68, 70, 72, 
          Severity: Major
          Found in lib/manamana/tdsl/lexer.rb and 6 other locations - About 1 hr to fix
          lib/manamana/tdsl/lexer.rb on lines 35..44
          lib/manamana/tdsl/lexer.rb on lines 77..86
          lib/manamana/tdsl/lexer.rb on lines 92..101
          lib/manamana/tdsl/lexer.rb on lines 185..194
          lib/manamana/tdsl/lexer.rb on lines 200..209
          lib/manamana/tdsl/lexer.rb on lines 215..224

          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 65.

          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