OpenC3/cosmos

View on GitHub

Showing 1,379 of 1,379 total issues

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

    def identify_and_finish_packet
      packet_data = nil
      identified_packet = nil

      if @telemetry
Severity: Major
Found in openc3/lib/openc3/interfaces/protocols/fixed_protocol.rb - About 2 hrs to fix

    Method connect has 63 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def connect
          @server = WEBrick::HTTPServer.new(:BindAddress => @listen_address, :Port => @port)
          @request_queue = Queue.new
    
          # Create a response hook for every command packet
    Severity: Major
    Found in openc3/lib/openc3/interfaces/http_server_interface.rb - About 2 hrs to fix

      Method start has 63 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def start
            @thread_sleeper = Sleeper.new
            @thread = Thread.new do
              @cancel_thread = false
              begin
      Severity: Major
      Found in openc3/lib/openc3/tools/cmd_tlm_server/interface_thread.rb - About 2 hrs to fix

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

            def initialize(name)
              @mutex = Mutex.new
              super(name)
        
              @interface_or_router = self.class.name.to_s.split("Microservice")[0].upcase.split("::")[-1]
        Severity: Major
        Found in openc3/lib/openc3/microservices/interface_microservice.rb - About 2 hrs to fix

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

            def sanitize_params(param_list, require_params: true, allow_forward_slash: false)
              if require_params
                result = params.require(param_list)
              else
                result = []
          openc3-cosmos-script-runner-api/app/controllers/application_controller.rb on lines 71..98

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

          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

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

            def sanitize_params(param_list, require_params: true, allow_forward_slash: false)
              if require_params
                result = params.require(param_list)
              else
                result = []
          openc3-cosmos-cmd-tlm-api/app/controllers/application_controller.rb on lines 60..87

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

          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

          class ExampleGroup < OpenC3::Group
            def setup
              puts "Setup"
            end
          
          
          openc3-cosmos-init/plugins/packages/openc3-cosmos-demo/targets/INST/procedures/my_test_suite.rb on lines 3..36

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

          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

          class ExampleTest < OpenC3::Test
            def setup
              puts "Setup"
            end
          
          
          openc3-cosmos-init/plugins/packages/openc3-cosmos-demo/targets/INST/procedures/my_script_suite.rb on lines 4..37

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

          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

          Method process_file has 61 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def process_file(filename)
                Logger.instance.info "Processing target definition in file '#{filename}'"
                parser = ConfigParser.new("https://docs.openc3.com/docs/configuration/target")
                parser.parse_file(filename) do |keyword, parameters|
                  case keyword
          Severity: Major
          Found in openc3/lib/openc3/system/target.rb - About 2 hrs to fix

            Function diff_cleanupEfficiency has 60 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            diff_match_patch.prototype.diff_cleanupEfficiency = function (diffs) {
              var changes = false
              var equalities = [] // Stack of indices where equalities are found.
              var equalitiesLength = 0 // Keeping our own length var is faster in JS.
              /** @type {?string} */

              Method run has 60 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def run
                    begin
                      if @interface.read_allowed?
                        @logger.info "#{@interface.name}: Starting packet reading"
                      else
              Severity: Major
              Found in openc3/lib/openc3/microservices/interface_microservice.rb - About 2 hrs to fix

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

                      if (k1 == -d || (k1 != d && v1[k1_offset - 1] < v1[k1_offset + 1])) {
                        x1 = v1[k1_offset + 1]
                      } else {
                        x1 = v1[k1_offset - 1] + 1
                      }
                openc3-cosmos-init/plugins/packages/openc3-cosmos-ace-diff/src/diff-match-patch.js on lines 408..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 83.

                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

                      if (k2 == -d || (k2 != d && v2[k2_offset - 1] < v2[k2_offset + 1])) {
                        x2 = v2[k2_offset + 1]
                      } else {
                        x2 = v2[k2_offset - 1] + 1
                      }
                openc3-cosmos-init/plugins/packages/openc3-cosmos-ace-diff/src/diff-match-patch.js on lines 370..374

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

                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 modifyLimits has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    modifyLimits(limitsSettings) {
                      // By default the red bars take 10% of the display
                      this.redLow = 10
                      this.redHigh = 10
                
                

                  Method handle_config has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def handle_config(parser, keyword, parameters)
                        case keyword
                        when 'ENV'
                          parser.verify_num_parameters(2, 2, "#{keyword} <Key> <Value>")
                          @env[parameters[0]] = parameters[1]
                  Severity: Major
                  Found in openc3/lib/openc3/models/microservice_model.rb - About 2 hrs to fix

                    Method run has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def self.run
                          ScopeModel.names.each do |scope|
                            puts "Processing scope #{scope}"
                    
                            # Update all old TriggerModels just so they work when we delete the ReactionModel
                    Severity: Major
                    Found in openc3/lib/openc3/migrations/20230615000000_autonomic.rb - About 2 hrs to fix

                      Method build_json_hash has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          def self.build_json_hash(binary, definition_filename)
                            config = TableConfig.process_file(definition_filename)
                            tables = []
                            json = { tables: tables }
                            begin
                      Severity: Major
                      Found in openc3/lib/openc3/tools/table_manager/table_manager_core.rb - About 2 hrs to fix

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

                          delete: function (
                            path,
                            {
                              params,
                              headers = acceptOnlyDefaultHeaders,
                        openc3-cosmos-init/plugins/packages/openc3-tool-common/src/services/api.js on lines 77..94

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

                        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

                          get: function (
                            path,
                            {
                              params,
                              headers = acceptOnlyDefaultHeaders,
                        openc3-cosmos-init/plugins/packages/openc3-tool-common/src/services/api.js on lines 138..155

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

                        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

                          post: function (
                            path,
                            { data, params, headers = fullDefaultHeaders, noScope, noAuth } = {}
                          ) {
                            return request('post', path, { data, params, headers, noScope, noAuth })
                        Severity: Major
                        Found in openc3/templates/tool_svelte/src/services/api.js and 1 other location - About 2 hrs to fix
                        openc3/templates/tool_svelte/src/services/api.js on lines 72..77

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

                        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

                        Severity
                        Category
                        Status
                        Source
                        Language