OpenC3/cosmos

View on GitHub

Showing 819 of 1,354 total issues

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

    def process_file(filename)
      # Partial files are included into another file and thus aren't directly processed
      return if File.basename(filename)[0] == '_' # Partials start with underscore
      @filename = filename
      @last_config = [File.basename(filename), File.read(filename)]
Severity: Major
Found in openc3/lib/openc3/tools/table_manager/table_config.rb - About 3 hrs to fix

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

        def initialize(name, is_plugin: false)
          @shutdown_complete = false
          raise "Microservice must be named" unless name
    
          @name = name
    Severity: Major
    Found in openc3/lib/openc3/microservices/microservice.rb - About 3 hrs to fix

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

          def process_file(filename, process_target_name, language = 'ruby')
            # Handle .xtce files
            extension = File.extname(filename).to_s.downcase
            if extension == ".xtce" or extension == ".xml"
              XtceParser.process(@commands, @telemetry, @warnings, filename, process_target_name)
      Severity: Major
      Found in openc3/lib/openc3/packets/packet_config.rb - About 3 hrs to fix

        Method histogram has 91 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def histogram(num_buckets = nil, numeric = false, &block)
            buckets = {}
        
            # Count the occurance of each value
            self.each do |value|
        Severity: Major
        Found in openc3/lib/openc3/core_ext/array.rb - About 3 hrs to fix

          Function diff_cleanupSemanticLossless has 90 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          diff_match_patch.prototype.diff_cleanupSemanticLossless = function (diffs) {
            /**
             * Given two strings, compute a score representing whether the internal
             * boundary falls on logical boundaries.
             * Scores range from 6 (best) to 0 (worst).

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

                def process_file(filename, type, entry_nanoseconds, file_nanoseconds)
                  throttle = OpenC3::Throttle.new(@max_cpu_utilization)
                  file = BucketFile.new(filename)
                  file.retrieve
                  unless File.exist?(file.local_path)
            Severity: Major
            Found in openc3/lib/openc3/microservices/reducer_microservice.rb - About 3 hrs to fix

              Method read_item has 90 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def read_item(item, value_type = :CONVERTED, buffer = @buffer, given_raw = nil)
                    if given_raw
                      # Must clone this since value is returned
                      value = given_raw.clone
                    else
              Severity: Major
              Found in openc3/lib/openc3/packets/packet.rb - About 3 hrs to fix

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

                    def handle_config(parser, keyword, parameters)
                      case keyword
                      when 'MAP_TARGET'
                        parser.verify_num_parameters(1, 1, "#{keyword} <Target Name>")
                        target_name = parameters[0].upcase
                Severity: Major
                Found in openc3/lib/openc3/models/interface_model.rb - About 3 hrs to fix

                  Function patch_apply has 89 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  diff_match_patch.prototype.patch_apply = function (patches, text) {
                    if (patches.length == 0) {
                      return [text, []]
                    }
                    // Deep copy the patches so that no changes are made to originals.

                    Method process_targets has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def process_targets(parser, filename, targets_config_dir)
                          parser.parse_file(filename) do |keyword, parameters|
                            case keyword
                            when 'AUTO_DECLARE_TARGETS'
                              usage = "#{keyword}"
                    Severity: Major
                    Found in openc3/lib/openc3/system/system_config.rb - About 3 hrs to fix

                      Function patch_splitMax has 87 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      diff_match_patch.prototype.patch_splitMax = function (patches) {
                        var patch_size = this.Match_MaxBits
                        for (var x = 0; x < patches.length; x++) {
                          if (patches[x].length1 <= patch_size) {
                            continue

                        Method process_suite has 87 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def self.process_suite(name, contents, new_process: true, username: nil, scope:)
                            python = false
                            python = true if File.extname(name) == '.py'
                        
                            start = Time.now
                        Severity: Major
                        Found in openc3-cosmos-script-runner-api/app/models/script.rb - About 3 hrs to fix

                          Function __init__ has 86 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              def __init__(self, target_name):
                                  super().__init__(target_name)
                          
                                  self.target = System.targets[target_name]
                                  position_filename = os.path.join(self.target.dir, "data", "position.bin")

                            Method update has 86 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                def update
                                  @previous_microservices = @microservices.dup
                                  # Get all the microservice configuration
                                  @microservices = MicroserviceModel.all
                            
                            
                            Severity: Major
                            Found in openc3/lib/openc3/operators/microservice_operator.rb - About 3 hrs to fix

                              Function exports has 83 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              module.exports = (webpackConfigEnv, argv) => {
                                const orgName = 'openc3'
                                const defaultConfig = singleSpaDefaults({
                                  orgName,
                                  projectName: 'tool-base',
                              Severity: Major
                              Found in openc3-cosmos-init/plugins/openc3-tool-base/webpack.config.js - About 3 hrs to fix

                                Method each_lexed_segment has 83 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  def each_lexed_segment(text)
                                    inside_begin = false
                                    lex = RubyLex.new
                                    lex_io = StringIO.new(text)
                                    lex.set_input(lex_io, context: @context)
                                Severity: Major
                                Found in openc3/lib/openc3/utilities/ruby_lex_utils.rb - About 3 hrs to fix

                                  Method read has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      def read(name, value_type = :CONVERTED, reduced_type = nil)
                                        value = nil
                                        array_index = nil
                                        # Check for array index to handle array items but also make sure there
                                        # isn't a REAL item that has brackets in the name
                                  Severity: Major
                                  Found in openc3/lib/openc3/packets/json_packet.rb - About 3 hrs to fix

                                    Function diff_halfMatch_ has 79 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    diff_match_patch.prototype.diff_halfMatch_ = function (text1, text2) {
                                      if (this.Diff_Timeout <= 0) {
                                        // Don't risk returning a non-optimal diff if we have unlimited time.
                                        return null
                                      }

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

                                          def initialize(
                                            write_item_name = nil,
                                            strip_crc = false,
                                            bad_strategy = "ERROR",
                                            bit_offset = -32,
                                      Severity: Major
                                      Found in openc3/lib/openc3/interfaces/protocols/crc_protocol.rb - About 3 hrs to fix

                                        Method spawn has 79 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                          def self.spawn(scope, name, suite_runner = nil, disconnect = false, environment = nil, user_full_name = nil, username = nil)
                                            if File.extname(name) == '.py'
                                              process_name = 'python'
                                              runner_path = File.join(RAILS_ROOT, 'scripts', 'run_script.py')
                                            else
                                        Severity: Major
                                        Found in openc3-cosmos-script-runner-api/app/models/running_script.rb - About 3 hrs to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language