zacstewart/tengai

View on GitHub
ext/horizons/body_data_sheet_parser.rb

Summary

Maintainability
F
4 days
Test Coverage

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

    def self.parse(data)
      data = data.unpack('c*') if data.is_a? String
      eof = data.length

      
Severity: Minor
Found in ext/horizons/body_data_sheet_parser.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

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

    def self.parse(data)
      data = data.unpack('c*') if data.is_a? String
      eof = data.length

      
Severity: Major
Found in ext/horizons/body_data_sheet_parser.rb - About 5 hrs to fix

    File body_data_sheet_parser.rb has 305 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'date'
    
    module Tengai
      class BodyDataSheetParser
        def self.parse(data)
    Severity: Minor
    Found in ext/horizons/body_data_sheet_parser.rb - About 3 hrs to fix

      Avoid deeply nested control flow statements.
      Open

                  case _body_data_sheet_parser_actions[_acts - 1]
      when 0 then
      # line 5 "ext/horizons/body_data_sheet_parser.rl"
              begin
       mark = p         end
      Severity: Major
      Found in ext/horizons/body_data_sheet_parser.rb - About 45 mins to fix

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

            begin
              if _klen > 0
                 _lower = _keys
                 _upper = _keys + _klen - 1
        
        
        Severity: Major
        Found in ext/horizons/body_data_sheet_parser.rb and 1 other location - About 4 hrs to fix
        ext/horizons/vector_ephemeris_parser.rb on lines 53..96

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

        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._body_data_sheet_parser_trans_actions = [
            0, 0, 0, 0, 0, 0, 0, 0, 
            0, 1, 1, 0, 0, 0, 0, 0, 
            0, 0, 0, 0, 0, 3, 0, 1, 
            1, 0, 0, 0, 5, 5, 0, 0, 
        Severity: Major
        Found in ext/horizons/body_data_sheet_parser.rb and 1 other location - About 1 hr to fix
        ext/horizons/body_data_sheet_parser.rb on lines 307..314

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

        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._body_data_sheet_parser_trans_targs = [
            1, 2, 3, 4, 5, 6, 7, 8, 
            9, 10, 42, 11, 12, 13, 14, 15, 
            16, 17, 18, 19, 20, 21, 22, 23, 
            41, 23, 24, 31, 25, 29, 26, 27, 
        Severity: Major
        Found in ext/horizons/body_data_sheet_parser.rb and 1 other location - About 1 hr to fix
        ext/horizons/body_data_sheet_parser.rb on lines 320..327

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

        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 4 locations. Consider refactoring.
        Open

        self._body_data_sheet_parser_key_offsets = [
            0, 0, 1, 3, 5, 7, 9, 11, 
            13, 16, 20, 23, 26, 28, 31, 34, 
            36, 38, 41, 44, 47, 50, 52, 62, 
            72, 84, 88, 92, 98, 101, 113, 125, 
        Severity: Major
        Found in ext/horizons/body_data_sheet_parser.rb and 3 other locations - About 1 hr to fix
        ext/horizons/body_data_sheet_parser.rb on lines 232..239
        ext/horizons/body_data_sheet_parser.rb on lines 245..252
        ext/horizons/body_data_sheet_parser.rb on lines 258..265

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

        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 4 locations. Consider refactoring.
        Open

        self._body_data_sheet_parser_single_lengths = [
            0, 1, 2, 2, 2, 2, 2, 2, 
            3, 2, 1, 1, 2, 1, 1, 2, 
            2, 1, 1, 1, 1, 2, 2, 2, 
            2, 2, 2, 2, 1, 2, 2, 3, 
        Severity: Major
        Found in ext/horizons/body_data_sheet_parser.rb and 3 other locations - About 1 hr to fix
        ext/horizons/body_data_sheet_parser.rb on lines 178..185
        ext/horizons/body_data_sheet_parser.rb on lines 245..252
        ext/horizons/body_data_sheet_parser.rb on lines 258..265

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

        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 4 locations. Consider refactoring.
        Open

        self._body_data_sheet_parser_index_offsets = [
            0, 0, 2, 5, 8, 11, 14, 17, 
            20, 24, 28, 31, 34, 37, 40, 43, 
            46, 49, 52, 55, 58, 61, 64, 71, 
            78, 86, 90, 94, 99, 102, 110, 118, 
        Severity: Major
        Found in ext/horizons/body_data_sheet_parser.rb and 3 other locations - About 1 hr to fix
        ext/horizons/body_data_sheet_parser.rb on lines 178..185
        ext/horizons/body_data_sheet_parser.rb on lines 232..239
        ext/horizons/body_data_sheet_parser.rb on lines 245..252

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

        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 4 locations. Consider refactoring.
        Open

        self._body_data_sheet_parser_range_lengths = [
            0, 0, 0, 0, 0, 0, 0, 0, 
            0, 1, 1, 1, 0, 1, 1, 0, 
            0, 1, 1, 1, 1, 0, 4, 4, 
            5, 1, 1, 2, 1, 5, 5, 5, 
        Severity: Major
        Found in ext/horizons/body_data_sheet_parser.rb and 3 other locations - About 1 hr to fix
        ext/horizons/body_data_sheet_parser.rb on lines 178..185
        ext/horizons/body_data_sheet_parser.rb on lines 232..239
        ext/horizons/body_data_sheet_parser.rb on lines 258..265

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

        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

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

            if _goto_level <= _again
            if cs == 0
                _goto_level = _out
                next
            end
        Severity: Minor
        Found in ext/horizons/body_data_sheet_parser.rb and 1 other location - About 15 mins to fix
        ext/horizons/vector_ephemeris_parser.rb on lines 161..170

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

        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