zacstewart/tengai

View on GitHub

Showing 25 of 25 total issues

File vector_ephemeris_parser.rb has 4347 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'date'
module Tengai
  class VectorEphemerisParser
    def self.parse(data, ephemeris_table_parser=EphemerisTableParser)
      data = data.unpack('c*') if data.is_a? String
Severity: Major
Found in ext/horizons/vector_ephemeris_parser.rb - About 1 wk to fix

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

    self._ephemeris_parser_trans_targs = [
        1, 2, 3, 4, 5, 6, 7, 8, 
        9, 10, 11, 12, 13, 14, 15, 16, 
        17, 18, 19, 20, 948, 21, 22, 947, 
        22, 23, 24, 45, 25, 26, 27, 28, 
    Severity: Major
    Found in ext/horizons/vector_ephemeris_parser.rb and 1 other location - About 6 days to fix
    ext/horizons/vector_ephemeris_parser.rb on lines 4177..4377

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

    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._ephemeris_parser_trans_actions = [
        0, 0, 0, 0, 0, 0, 0, 0, 
        0, 0, 0, 0, 0, 0, 0, 0, 
        0, 0, 0, 0, 0, 0, 1, 17, 
        0, 0, 0, 0, 0, 0, 0, 0, 
    Severity: Major
    Found in ext/horizons/vector_ephemeris_parser.rb and 1 other location - About 6 days to fix
    ext/horizons/vector_ephemeris_parser.rb on lines 3971..4171

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

    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._ephemeris_parser_key_offsets = [
        0, 0, 1, 3, 5, 7, 9, 11, 
        13, 15, 17, 19, 21, 23, 25, 27, 
        29, 31, 33, 37, 47, 58, 62, 68, 
        70, 73, 76, 79, 82, 85, 88, 91, 
    Severity: Major
    Found in ext/horizons/vector_ephemeris_parser.rb and 3 other locations - About 6 days to fix
    ext/horizons/vector_ephemeris_parser.rb on lines 1920..2112
    ext/horizons/vector_ephemeris_parser.rb on lines 2118..2310
    ext/horizons/vector_ephemeris_parser.rb on lines 2316..2508

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

    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._ephemeris_parser_range_lengths = [
        0, 0, 0, 0, 0, 0, 0, 0, 
        0, 0, 0, 0, 0, 0, 0, 0, 
        0, 0, 1, 4, 4, 1, 1, 0, 
        0, 0, 0, 0, 0, 0, 0, 0, 
    Severity: Major
    Found in ext/horizons/vector_ephemeris_parser.rb and 3 other locations - About 6 days to fix
    ext/horizons/vector_ephemeris_parser.rb on lines 208..400
    ext/horizons/vector_ephemeris_parser.rb on lines 1920..2112
    ext/horizons/vector_ephemeris_parser.rb on lines 2316..2508

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

    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._ephemeris_parser_single_lengths = [
        0, 1, 2, 2, 2, 2, 2, 2, 
        2, 2, 2, 2, 2, 2, 2, 2, 
        2, 2, 2, 2, 3, 2, 4, 2, 
        3, 3, 3, 3, 3, 3, 3, 3, 
    Severity: Major
    Found in ext/horizons/vector_ephemeris_parser.rb and 3 other locations - About 6 days to fix
    ext/horizons/vector_ephemeris_parser.rb on lines 208..400
    ext/horizons/vector_ephemeris_parser.rb on lines 2118..2310
    ext/horizons/vector_ephemeris_parser.rb on lines 2316..2508

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

    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._ephemeris_parser_index_offsets = [
        0, 0, 2, 5, 8, 11, 14, 17, 
        20, 23, 26, 29, 32, 35, 38, 41, 
        44, 47, 50, 54, 61, 69, 73, 79, 
        82, 86, 90, 94, 98, 102, 106, 110, 
    Severity: Major
    Found in ext/horizons/vector_ephemeris_parser.rb and 3 other locations - About 6 days to fix
    ext/horizons/vector_ephemeris_parser.rb on lines 208..400
    ext/horizons/vector_ephemeris_parser.rb on lines 1920..2112
    ext/horizons/vector_ephemeris_parser.rb on lines 2118..2310

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

    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

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

        def self.parse(data, ephemeris_table_parser=EphemerisTableParser)
          data = data.unpack('c*') if data.is_a? String
          eof = data.length
    
          
    Severity: Minor
    Found in ext/horizons/vector_ephemeris_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 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 147 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def self.parse(data, ephemeris_table_parser=EphemerisTableParser)
          data = data.unpack('c*') if data.is_a? String
          eof = data.length
    
          
    Severity: Major
    Found in ext/horizons/vector_ephemeris_parser.rb - About 5 hrs to fix

      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

        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

            begin
              if _klen > 0
                 _lower = _keys
                 _upper = _keys + _klen - 1
        
        
        Severity: Major
        Found in ext/horizons/vector_ephemeris_parser.rb and 1 other location - About 4 hrs to fix
        ext/horizons/body_data_sheet_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

        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

          Method receive_data has 43 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def receive_data(data)
                case data
                when Prompts::DEFAULT
                  send_command 'E'
                when Prompts::TABLE
          Severity: Minor
          Found in lib/tengai/requests/telnet_ephemeris_request.rb - About 1 hr to fix

            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_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_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_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

            Severity
            Category
            Status
            Source
            Language