npolar/argos-ruby

View on GitHub
lib/argos/ds.rb

Summary

Maintainability
D
2 days
Test Coverage

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

    def parse(filename=nil)

      self.clear # Needed if you parse multiple times
      @messages = []
      @valid = false
Severity: Minor
Found in lib/argos/ds.rb - About 4 hrs 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 69 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def parse(filename=nil)

      self.clear # Needed if you parse multiple times
      @messages = []
      @valid = false
Severity: Major
Found in lib/argos/ds.rb - About 2 hrs to fix

    File ds.rb has 272 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module Argos
    
      # Argos DS|DAT file parser
      #
      # Usage
    Severity: Minor
    Found in lib/argos/ds.rb - About 2 hrs to fix

      Method combine_header_with_transmission has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          def combine_header_with_transmission(measurements, header)
            unless header.is_a? Array
              header = header.split(" ")
            end
            latitude = longitude = positioned = nil
      Severity: Minor
      Found in lib/argos/ds.rb - About 2 hrs 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 combine_header_with_transmission has 55 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def combine_header_with_transmission(measurements, header)
            unless header.is_a? Array
              header = header.split(" ")
            end
            latitude = longitude = positioned = nil
      Severity: Major
      Found in lib/argos/ds.rb - About 2 hrs to fix

        Class Ds has 21 methods (exceeds 20 allowed). Consider refactoring.
        Open

          class Ds < Array
            include Argos::Ascii
        
            attr_writer :log, :filename, :bundle
        
        
        Severity: Minor
        Found in lib/argos/ds.rb - About 2 hrs to fix

          Method unfold has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def unfold
          
                # First, grab all segments *without* measurements (if any)
                unfolded = messages.reject {|ds| ds.key?(:measurements) or ds[:measurements].nil? }.map {|m| m[:cardinality] = 0 }
                log.debug "#{messages.size - unfolded.size} / #{messages.size} messages contained measurements"
          Severity: Minor
          Found in lib/argos/ds.rb - About 25 mins 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

          There are no issues that match your filters.

          Category
          Status