OpenC3/cosmos

View on GitHub

Showing 1,379 of 1,379 total issues

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

        raw_keys.each do |key|
          if reduced["#{key}__VALS"]
            reduced["_NUM_SAMPLES"] ||= reduced["#{key}__VALS"].length # Keep a single sample count per packet
            reduced["#{key}__A"], reduced["#{key}__S"] =
              Math.stddev_population(reduced["#{key}__VALS"])
Severity: Major
Found in openc3/lib/openc3/microservices/reducer_microservice.rb and 1 other location - About 1 hr to fix
openc3/lib/openc3/microservices/reducer_microservice.rb on lines 565..572

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

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

        converted_keys.each do |key|
          if reduced["#{key}__CVALS"]
            reduced["_NUM_SAMPLES"] ||= reduced["#{key}__CVALS"].length # Keep a single sample count per packet
            reduced["#{key}__CA"], reduced["#{key}__CS"] =
              Math.stddev_population(reduced["#{key}__CVALS"])
Severity: Major
Found in openc3/lib/openc3/microservices/reducer_microservice.rb and 1 other location - About 1 hr to fix
openc3/lib/openc3/microservices/reducer_microservice.rb on lines 555..561

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

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

      @telemetry.each do |target_name, packets|
        next if target_name == 'UNKNOWN'

        FileUtils.mkdir_p(File.join(output_dir, target_name, 'cmd_tlm'))
        filename = File.join(output_dir, target_name, 'cmd_tlm', target_name.downcase + '_tlm.txt')
Severity: Major
Found in openc3/lib/openc3/packets/packet_config.rb and 1 other location - About 1 hr to fix
openc3/lib/openc3/packets/packet_config.rb on lines 276..289

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

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

      @commands.each do |target_name, packets|
        next if target_name == 'UNKNOWN'

        FileUtils.mkdir_p(File.join(output_dir, target_name, 'cmd_tlm'))
        filename = File.join(output_dir, target_name, 'cmd_tlm', target_name.downcase + '_cmd.txt')
Severity: Major
Found in openc3/lib/openc3/packets/packet_config.rb and 1 other location - About 1 hr to fix
openc3/lib/openc3/packets/packet_config.rb on lines 258..271

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

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

Function _execute_wait has 9 arguments (exceeds 4 allowed). Consider refactoring.
Open

def _execute_wait(
Severity: Major
Found in openc3/python/openc3/script/api_shared.py - About 1 hr to fix

    Function _openc3_script_wait_tolerance has 9 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def _openc3_script_wait_tolerance(
    Severity: Major
    Found in openc3/python/openc3/script/api_shared.py - About 1 hr to fix

      Function __init__ has 9 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(
      Severity: Major
      Found in openc3/python/openc3/models/scope_model.py - About 1 hr to fix

        Function write_array has 9 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def write_array(
        Severity: Major
        Found in openc3/python/openc3/accessors/binary_accessor.py - About 1 hr to fix

          Function _openc3_script_wait_tolerance has 9 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def _openc3_script_wait_tolerance(
          Severity: Major
          Found in openc3/python/openc3/api/api_shared.py - About 1 hr to fix

            Function _execute_wait has 9 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def _execute_wait(
            Severity: Major
            Found in openc3/python/openc3/api/api_shared.py - About 1 hr to fix

              Function __init__ has 9 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def __init__(
              Severity: Major
              Found in openc3/python/openc3/interfaces/protocols/slip_protocol.py - About 1 hr to fix

                Method _openc3_script_wait_implementation_tolerance has 9 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def _openc3_script_wait_implementation_tolerance(target_name, packet_name, item_name, value_type, expected_value, tolerance, timeout, polling_rate = DEFAULT_TLM_POLLING_RATE, scope: $openc3_scope, token: $openc3_token, &block)
                Severity: Major
                Found in openc3/lib/openc3/script/api_shared.rb - About 1 hr to fix

                  Method initialize has 9 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                        start_char = nil,
                        read_strip_characters = true,
                        read_enable_escaping = true,
                        write_enable_escaping = true,
                        end_char = 0xC0,
                  Severity: Major
                  Found in openc3/lib/openc3/interfaces/protocols/slip_protocol.rb - About 1 hr to fix

                    Method initialize has 9 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def initialize(write_port_name,
                                       read_port_name,
                                       baud_rate,
                                       parity,
                                       stop_bits,
                    Severity: Major
                    Found in openc3/lib/openc3/interfaces/serial_interface.rb - About 1 hr to fix

                      Method initialize has 9 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                            hostname,
                            write_dest_port,
                            read_port,
                            write_src_port = nil,
                            interface_address = nil,
                      Severity: Major
                      Found in openc3/lib/openc3/interfaces/udp_interface.rb - About 1 hr to fix

                        Method initialize has 9 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            def initialize(write_port_name,
                                           read_port_name,
                                           baud_rate,
                                           parity,
                                           stop_bits,
                        Severity: Major
                        Found in openc3/lib/openc3/streams/serial_stream.rb - About 1 hr to fix

                          Method initialize has 9 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                                remote_log_directory,
                                label,
                                logging_enabled = true,
                                cycle_time = nil,
                                cycle_size = 1_000_000_000,
                          Severity: Major
                          Found in openc3/lib/openc3/logs/buffered_packet_log_writer.rb - About 1 hr to fix

                            Function defaultSourceLookup has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function defaultSourceLookup(filePath) {
                              try {
                                filePath = filePath.split(path.sep).join(path.posix.sep)
                                // Remove any Windows drive letters
                                filePath = filePath.replace('C:', '')
                            Severity: Minor
                            Found in playwright/context.js - About 1 hr to fix

                              Function diff_linesToCharsMunge_ has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                function diff_linesToCharsMunge_(text) {
                                  var chars = ''
                                  // Walk the text, pulling out a substring for each line.
                                  // text.split('\n') would would temporarily double our memory footprint.
                                  // Modifying text would create many large strings to garbage collect.

                                Function addConnector has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                function addConnector(
                                  acediff,
                                  leftStartLine,
                                  leftEndLine,
                                  rightStartLine,
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language