rapid7/metasploit-framework

View on GitHub
modules/auxiliary/client/iec104/iec104.rb

Summary

Maintainability
F
1 wk
Test Coverage

File iec104.rb has 507 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class MetasploitModule < Msf::Auxiliary
  #
  # this module sends IEC104 commands
  #

Severity: Major
Found in modules/auxiliary/client/iec104/iec104.rb - About 1 day to fix

    Method parse_response has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

      def parse_response(response)
        response_elements = response.split("\x68")
        response_elements.shift
        response_elements.each do |response_element|
          if response_element[5].eql?("\x64")
    Severity: Minor
    Found in modules/auxiliary/client/iec104/iec104.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 parse_response has 72 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def parse_response(response)
        response_elements = response.split("\x68")
        response_elements.shift
        response_elements.each do |response_element|
          if response_element[5].eql?("\x64")
    Severity: Major
    Found in modules/auxiliary/client/iec104/iec104.rb - About 2 hrs to fix

      Class MetasploitModule has 22 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class MetasploitModule < Msf::Auxiliary
        #
        # this module sends IEC104 commands
        #
      
      
      Severity: Minor
      Found in modules/auxiliary/client/iec104/iec104.rb - About 2 hrs to fix

        Method parse_headers has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

          def parse_headers(response_data)
            if !response_data[0].eql?("\x04") && !response_data[1].eql?("\x01")
              $rx = + (response_data[2].unpack('H*').first + response_data[1].unpack('H*').first).to_i(16)
              print_good("    TX: " + response_data[4].unpack('H*').first + response_data[3].unpack('H*').first + \
                         " RX: " + response_data[2].unpack('H*').first + response_data[1].unpack('H*').first)
        Severity: Minor
        Found in modules/auxiliary/client/iec104/iec104.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 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def run
            $rx = 0
            $tx = 0
            begin
              connect
        Severity: Minor
        Found in modules/auxiliary/client/iec104/iec104.rb - About 1 hr to fix

          Method parse_headers has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def parse_headers(response_data)
              if !response_data[0].eql?("\x04") && !response_data[1].eql?("\x01")
                $rx = + (response_data[2].unpack('H*').first + response_data[1].unpack('H*').first).to_i(16)
                print_good("    TX: " + response_data[4].unpack('H*').first + response_data[3].unpack('H*').first + \
                           " RX: " + response_data[2].unpack('H*').first + response_data[1].unpack('H*').first)
          Severity: Minor
          Found in modules/auxiliary/client/iec104/iec104.rb - About 1 hr to fix

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

              def run
                $rx = 0
                $tx = 0
                begin
                  connect
            Severity: Minor
            Found in modules/auxiliary/client/iec104/iec104.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

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

              def parse_m_st_na_1(response_data)
                sq_bit = Integer(response_data[6].unpack('C').first) & 0b10000000
                response_data = response_data[11..-1] # cut out acpi data
                if sq_bit.eql?(0b10000000)
                  ioa = response_data[0..3]
            Severity: Minor
            Found in modules/auxiliary/client/iec104/iec104.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

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

              def parse_c_sc_na_1(response_data)
                sq_bit = Integer(response_data[6].unpack('C').first) & 0b10000000
                response_data = response_data[11..-1] # cut out acpi data
                if sq_bit.eql?(0b10000000)
                  ioa = response_data[0..3]
            Severity: Minor
            Found in modules/auxiliary/client/iec104/iec104.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

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

              def parse_c_dc_na_1(response_data)
                sq_bit = Integer(response_data[6].unpack('C').first) & 0b10000000
                response_data = response_data[11..-1] # cut out acpi data
                if sq_bit.eql?(0b10000000)
                  ioa = response_data[0..3]
            Severity: Minor
            Found in modules/auxiliary/client/iec104/iec104.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

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

              def parse_m_it_na_1(response_data)
                sq_bit = Integer(response_data[6].unpack('C').first) & 0b10000000
                response_data = response_data[11..-1] # cut out acpi data
                if sq_bit.eql?(0b10000000)
                  response_data = response_data[11..-1]
            Severity: Minor
            Found in modules/auxiliary/client/iec104/iec104.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

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

              def parse_m_bo_na_1(response_data)
                sq_bit = Integer(response_data[6].unpack('C').first) & 0b10000000
                response_data = response_data[11..-1] # cut out acpi data
                if sq_bit.eql?(0b10000000)
                  ioa = response_data[0..3]
            Severity: Minor
            Found in modules/auxiliary/client/iec104/iec104.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

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

              def parse_m_dp_tb_1(response_data)
                sq_bit = Integer(response_data[6].unpack('C').first) & 0b10000000
                response_data = response_data[11..-1] # cut out acpi data
                if sq_bit.eql?(0b10000000)
                  ioa = response_data[0..3]
            Severity: Minor
            Found in modules/auxiliary/client/iec104/iec104.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

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

              def parse_m_me_nc_1(response_data)
                sq_bit = Integer(response_data[6].unpack('C').first) & 0b10000000
                response_data = response_data[11..-1] # cut out acpi data
                if sq_bit.eql?(0b10000000)
                  ioa = response_data[0..3]
            Severity: Minor
            Found in modules/auxiliary/client/iec104/iec104.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

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

              def parse_m_sp_na_1(response_data)
                sq_bit = Integer(response_data[6].unpack('C').first) & 0b10000000 # this bit determines the object addressing structure
                response_data = response_data[11..-1] # cut out acpi data
                if sq_bit.eql?(0b10000000)
                  ioa = response_data[0..3] # extract ioa value
            Severity: Minor
            Found in modules/auxiliary/client/iec104/iec104.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

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

              def parse_m_me_na_1(response_data)
                sq_bit = Integer(response_data[6].unpack('C').first) & 0b10000000
                response_data = response_data[11..-1] # cut out acpi data
                if sq_bit.eql?(0b10000000)
                  ioa = response_data[0..3]
            Severity: Minor
            Found in modules/auxiliary/client/iec104/iec104.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

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

              def parse_m_dp_na_1(response_data)
                sq_bit = Integer(response_data[6].unpack('C').first) & 0b10000000
                response_data = response_data[11..-1] # cut out acpi data
                if sq_bit.eql?(0b10000000)
                  ioa = response_data[0..3]
            Severity: Minor
            Found in modules/auxiliary/client/iec104/iec104.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

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

              def parse_m_me_nb_1(response_data)
                sq_bit = Integer(response_data[6].unpack('C').first) & 0b10000000
                response_data = response_data[11..-1] # cut out acpi data
                if sq_bit.eql?(0b10000000)
                  ioa = response_data[0..3]
            Severity: Minor
            Found in modules/auxiliary/client/iec104/iec104.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

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

              def parse_m_sp_tb_1(response_data)
                sq_bit = Integer(response_data[6].unpack('C').first) & 0b10000000
                response_data = response_data[11..-1] # cut out acpi data
                if sq_bit.eql?(0b10000000)
                  ioa = response_data[0..3]
            Severity: Minor
            Found in modules/auxiliary/client/iec104/iec104.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

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

                sq_bit = Integer(response_data[6].unpack('C').first) & 0b10000000
                response_data = response_data[11..-1] # cut out acpi data
                if sq_bit.eql?(0b10000000)
                  ioa = response_data[0..3]
                  response_data = response_data[3..-1]
            Severity: Major
            Found in modules/auxiliary/client/iec104/iec104.rb and 4 other locations - About 4 hrs to fix
            modules/auxiliary/client/iec104/iec104.rb on lines 229..247
            modules/auxiliary/client/iec104/iec104.rb on lines 348..366
            modules/auxiliary/client/iec104/iec104.rb on lines 371..389
            modules/auxiliary/client/iec104/iec104.rb on lines 394..412

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

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

                sq_bit = Integer(response_data[6].unpack('C').first) & 0b10000000
                response_data = response_data[11..-1] # cut out acpi data
                if sq_bit.eql?(0b10000000)
                  ioa = response_data[0..3]
                  response_data = response_data[3..-1]
            Severity: Major
            Found in modules/auxiliary/client/iec104/iec104.rb and 4 other locations - About 4 hrs to fix
            modules/auxiliary/client/iec104/iec104.rb on lines 229..247
            modules/auxiliary/client/iec104/iec104.rb on lines 325..343
            modules/auxiliary/client/iec104/iec104.rb on lines 371..389
            modules/auxiliary/client/iec104/iec104.rb on lines 394..412

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

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

                sq_bit = Integer(response_data[6].unpack('C').first) & 0b10000000
                response_data = response_data[11..-1] # cut out acpi data
                if sq_bit.eql?(0b10000000)
                  ioa = response_data[0..3]
                  response_data = response_data[3..-1]
            Severity: Major
            Found in modules/auxiliary/client/iec104/iec104.rb and 4 other locations - About 4 hrs to fix
            modules/auxiliary/client/iec104/iec104.rb on lines 325..343
            modules/auxiliary/client/iec104/iec104.rb on lines 348..366
            modules/auxiliary/client/iec104/iec104.rb on lines 371..389
            modules/auxiliary/client/iec104/iec104.rb on lines 394..412

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

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

                sq_bit = Integer(response_data[6].unpack('C').first) & 0b10000000
                response_data = response_data[11..-1] # cut out acpi data
                if sq_bit.eql?(0b10000000)
                  ioa = response_data[0..3]
                  response_data = response_data[3..-1]
            Severity: Major
            Found in modules/auxiliary/client/iec104/iec104.rb and 4 other locations - About 4 hrs to fix
            modules/auxiliary/client/iec104/iec104.rb on lines 229..247
            modules/auxiliary/client/iec104/iec104.rb on lines 325..343
            modules/auxiliary/client/iec104/iec104.rb on lines 348..366
            modules/auxiliary/client/iec104/iec104.rb on lines 371..389

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

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

                sq_bit = Integer(response_data[6].unpack('C').first) & 0b10000000
                response_data = response_data[11..-1] # cut out acpi data
                if sq_bit.eql?(0b10000000)
                  response_data = response_data[11..-1]
                  ioa = response_data[0..3]
            Severity: Major
            Found in modules/auxiliary/client/iec104/iec104.rb and 4 other locations - About 4 hrs to fix
            modules/auxiliary/client/iec104/iec104.rb on lines 229..247
            modules/auxiliary/client/iec104/iec104.rb on lines 325..343
            modules/auxiliary/client/iec104/iec104.rb on lines 348..366
            modules/auxiliary/client/iec104/iec104.rb on lines 394..412

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

            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

                sq_bit = Integer(response_data[6].unpack('C').first) & 0b10000000
                response_data = response_data[11..-1] # cut out acpi data
                if sq_bit.eql?(0b10000000)
                  ioa = response_data[0..3]
                  response_data = response_data[3..-1]
            Severity: Major
            Found in modules/auxiliary/client/iec104/iec104.rb and 1 other location - About 4 hrs to fix
            modules/auxiliary/client/iec104/iec104.rb on lines 277..297

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

            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

                sq_bit = Integer(response_data[6].unpack('C').first) & 0b10000000
                response_data = response_data[11..-1] # cut out acpi data
                if sq_bit.eql?(0b10000000)
                  ioa = response_data[0..3]
                  response_data = response_data[3..-1]
            Severity: Major
            Found in modules/auxiliary/client/iec104/iec104.rb and 1 other location - About 4 hrs to fix
            modules/auxiliary/client/iec104/iec104.rb on lines 252..272

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

            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

                sq_bit = Integer(response_data[6].unpack('C').first) & 0b10000000
                response_data = response_data[11..-1] # cut out acpi data
                if sq_bit.eql?(0b10000000)
                  ioa = response_data[0..3]
                  response_data = response_data[3..-1]
            Severity: Major
            Found in modules/auxiliary/client/iec104/iec104.rb and 3 other locations - About 3 hrs to fix
            modules/auxiliary/client/iec104/iec104.rb on lines 137..155
            modules/auxiliary/client/iec104/iec104.rb on lines 183..201
            modules/auxiliary/client/iec104/iec104.rb on lines 302..320

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

            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

                sq_bit = Integer(response_data[6].unpack('C').first) & 0b10000000
                response_data = response_data[11..-1] # cut out acpi data
                if sq_bit.eql?(0b10000000)
                  ioa = response_data[0..3]
                  response_data = response_data[3..-1]
            Severity: Major
            Found in modules/auxiliary/client/iec104/iec104.rb and 3 other locations - About 3 hrs to fix
            modules/auxiliary/client/iec104/iec104.rb on lines 137..155
            modules/auxiliary/client/iec104/iec104.rb on lines 206..224
            modules/auxiliary/client/iec104/iec104.rb on lines 302..320

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

            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

                sq_bit = Integer(response_data[6].unpack('C').first) & 0b10000000
                response_data = response_data[11..-1] # cut out acpi data
                if sq_bit.eql?(0b10000000)
                  ioa = response_data[0..3]
                  response_data = response_data[3..-1]
            Severity: Major
            Found in modules/auxiliary/client/iec104/iec104.rb and 3 other locations - About 3 hrs to fix
            modules/auxiliary/client/iec104/iec104.rb on lines 137..155
            modules/auxiliary/client/iec104/iec104.rb on lines 183..201
            modules/auxiliary/client/iec104/iec104.rb on lines 206..224

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

            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

                sq_bit = Integer(response_data[6].unpack('C').first) & 0b10000000 # this bit determines the object addressing structure
                response_data = response_data[11..-1] # cut out acpi data
                if sq_bit.eql?(0b10000000)
                  ioa = response_data[0..3] # extract ioa value
                  response_data = response_data[3..-1] # cut ioa from message
            Severity: Major
            Found in modules/auxiliary/client/iec104/iec104.rb and 3 other locations - About 3 hrs to fix
            modules/auxiliary/client/iec104/iec104.rb on lines 183..201
            modules/auxiliary/client/iec104/iec104.rb on lines 206..224
            modules/auxiliary/client/iec104/iec104.rb on lines 302..320

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

            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