npolar/api.npolar.no

View on GitHub
lib/tracking.rb

Summary

Maintainability
C
1 day
Test Coverage

Method decode_sensor_data has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

  def decode_sensor_data

    # For Argos data data prior to 2014-03-01 (DS/DIAG data) the sensor data may either integer or hex
    # Argos data from 2014-03-01 and onwards (XML from SOAP web service) contain both integer and hex data,
    # as well as platform_model string
Severity: Minor
Found in lib/tracking.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 decode_sensor_data has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def decode_sensor_data

    # For Argos data data prior to 2014-03-01 (DS/DIAG data) the sensor data may either integer or hex
    # Argos data from 2014-03-01 and onwards (XML from SOAP web service) contain both integer and hex data,
    # as well as platform_model string
Severity: Minor
Found in lib/tracking.rb - About 1 hr to fix

    Method inject_platform_deployment_metadata has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def inject_platform_deployment_metadata
        
        deployment = deployment_hash
        
        if not deployment.nil? and deployment.key? :id
    Severity: Minor
    Found in lib/tracking.rb - About 1 hr to fix

      Method inject_platform_deployment_metadata has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

        def inject_platform_deployment_metadata
          
          deployment = deployment_hash
          
          if not deployment.nil? and deployment.key? :id
      Severity: Minor
      Found in lib/tracking.rb - About 55 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

      Method inject_indvidual has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

        def inject_indvidual
          deployment = deployment_hash
          
          if deployment.key? :individual
          
      Severity: Minor
      Found in lib/tracking.rb - About 55 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

      Avoid deeply nested control flow statements.
      Open

                    if self[:type] =~ /^(ds|diag)$/
                      decoder.sensor_data_format = "hex"
                      self[:sensor_data_format] = "hex"
                    end
      Severity: Major
      Found in lib/tracking.rb - About 45 mins to fix

        Method next_deployment_after_measured has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          def next_deployment_after_measured
            measured = Time.parse(self[:measured]||self[:positioned])
            
            # Simple case first: measured is after deployed and before terminated    
            if idx = deployments.find_index { |d|
        Severity: Minor
        Found in lib/tracking.rb - About 35 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