npolar/argos-ruby

View on GitHub

Showing 31 of 31 total issues

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 download has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

    def self.download(username, password, archive, log, days=20)

      log.debug "Starting download of Argos XML to #{archive}"

      soap = Argos::Soap.new({username: username, password: password})
Severity: Minor
Found in lib/argos/download.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

Class Soap has 31 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Soap

    # A [simple](http://wanderingbarque.com/nonintersecting/2006/11/15/the-s-stands-for-simple/) Soap client for the Argos satellite tracking webservice operated by CLS
    
    # client [Savon] (version 3)
Severity: Minor
Found in lib/argos/soap.rb - About 3 hrs to fix

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

        def initialize(argv=ARGV, param = PARAM)
          @param = param
    
          option_parser = OptionParser.new(argv) do |opts|
          
    Severity: Major
    Found in lib/argos/soap_command.rb - About 3 hrs to fix

      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

        Method download has 68 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def self.download(username, password, archive, log, days=20)
        
              log.debug "Starting download of Argos XML to #{archive}"
        
              soap = Argos::Soap.new({username: username, password: password})
        Severity: Major
        Found in lib/argos/download.rb - About 2 hrs to fix

          File soap.rb has 276 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require "savon"
          
          module Argos
            class Soap
          
          
          Severity: Minor
          Found in lib/argos/soap.rb - About 2 hrs to fix

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

                def parse(filename=nil)
                  if filename.nil?
                    filename = @filename
                  end
                  
            Severity: Major
            Found in lib/argos/diag.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 create_diag_hash has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def create_diag_hash(contact="")
                      platform = contact[/^(\d{5,})/,1]
                      location_data = contact[/Date : (\d{2}.\d{2}.\d{2} \d{2}:\d{2}:\d{2})/,1]
                      contact_time = convert_date(location_data) unless location_data ==nil
                      lc = contact[/LC : (3|2|1|0|A|B|Z)/,1]
                Severity: Major
                Found in lib/argos/diag.rb - About 2 hrs to fix

                  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 parse has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def parse(filename=nil)
                            if filename.nil?
                              filename = @filename
                            end
                            
                      Severity: Minor
                      Found in lib/argos/diag.rb - About 1 hr 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 a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def initialize(argv=ARGV, param = PARAM)
                            @param = param
                      
                            option_parser = OptionParser.new(argv) do |opts|
                            
                      Severity: Minor
                      Found in lib/argos/soap_command.rb - About 1 hr 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 sensor_data= has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def sensor_data=(sensor_data)
                            
                            # Hex string?
                            if sensor_data.is_a? String
                              bytes = (sensor_data.size/2)
                      Severity: Minor
                      Found in lib/argos/sensor_data.rb - About 1 hr 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 run has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          def run
                            begin
                              @soap = Argos::Soap.new(param)
                              
                              @result = nil
                      Severity: Minor
                      Found in lib/argos/soap_command.rb - About 1 hr to fix

                        Method source has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            def self.source(argos)
                          
                              argos.parse(argos.filename)
                          
                              latitude_mean = longitude_mean = nil
                        Severity: Minor
                        Found in lib/argos/ascii.rb - About 1 hr to fix

                          Method create_diag_hash has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def create_diag_hash(contact="")
                                platform = contact[/^(\d{5,})/,1]
                                location_data = contact[/Date : (\d{2}.\d{2}.\d{2} \d{2}:\d{2}:\d{2})/,1]
                                contact_time = convert_date(location_data) unless location_data ==nil
                                lc = contact[/LC : (3|2|1|0|A|B|Z)/,1]
                          Severity: Minor
                          Found in lib/argos/diag.rb - About 1 hr 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 _call_xml_operation has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def _call_xml_operation(op_sym, body, extract=nil)
                                @operation = _operation(op_sym)
                                @operation.body = body
                                @response = operation.call
                          
                          
                          Severity: Minor
                          Found in lib/argos/soap.rb - About 1 hr 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

                          Severity
                          Category
                          Status
                          Source
                          Language