openjaf/cenit

View on GitHub

Showing 829 of 829 total issues

Avoid deeply nested control flow statements.
Open

                next if updating && ((property_name == '_id' || primary_fields.include?(name.to_sym)) && !record.send(property_name).nil?)
Severity: Major
Found in lib/edi/parser.rb - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                    if (existing = Cenit::Utility.find_record({ id: json }, container))
                      record = existing
                    else
                      record.id = json
                    end
    Severity: Major
    Found in lib/edi/parser.rb - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                        if (resume_interval = task.resume_interval)
                          message[:publish_at] = Time.now + resume_interval
                        end
      Severity: Major
      Found in lib/cenit/rabbit.rb - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                        raise Exception.new('Can not infers segment separator without EDI segment metadata in next sub-segment schema') unless next_seg_schema['edi'] && next_seg_id = next_seg_schema['edi']['segment']
        Severity: Major
        Found in lib/edi/parser.rb - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                            if field_sep == :by_fixed_length
                              value.join
                            else
                              while value.last.blank?
                                value.pop
          Severity: Major
          Found in lib/edi/formater.rb - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                              return false unless save_references(value, options, saved, visited)
            Severity: Major
            Found in lib/cenit/utility.rb - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                              if Cenit::Utility.json_object?(sub_record)
                                json_objects << sub_record
                              else
                                elements << record_to_xml_element(data_type, property_schema, sub_record, xml_doc, nil, options, namespaces)
                              end
              Severity: Major
              Found in lib/edi/formater.rb - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                              if (obj = (obj.reload rescue nil))
                Severity: Major
                Found in lib/cenit/utility.rb - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                  if delayed
                                    Setup::DelayedMessage.create(message: message, publish_at: publish_at, scheduler: scheduler)
                                  else
                                    begin
                                      channel_mutex.lock
                  Severity: Major
                  Found in lib/cenit/rabbit.rb - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                    next unless updating || !property_model&.modelable? || record.send(property_name).nil?
                    Severity: Major
                    Found in lib/edi/parser.rb - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                      if json.key?(name)
                                        record.send("#{property_name}=", json[name])
                                      end
                      Severity: Major
                      Found in lib/edi/parser.rb - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                        if fields_count.positive?
                                          while fields_count.positive?
                                            cursor = content.index(field_sep, cursor) + 1
                                            fields_count -= 1
                                          end
                        Severity: Major
                        Found in lib/edi/parser.rb - About 45 mins to fix

                          Method array_hash_merge has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                                def array_hash_merge(val1, val2, options = {}, &block)
                                  if val1.is_a?(Array) && val2.is_a?(Array)
                                    if options[:array_uniq]
                                      (val2 + val1).uniq(&block)
                                    else
                          Severity: Minor
                          Found in lib/cenit/utility.rb - About 45 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

                                            values = [values] unless values.is_a?(Array)
                          Severity: Major
                          Found in lib/cenit/xmlrpc.rb - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                            unless saved.include?(value)
                                              new_record = value.new_record?
                                              if value.changed?
                                                if value.save(options)
                                                  if new_record || value.instance_variable_get(:@dynamically_created)
                            Severity: Major
                            Found in lib/cenit/utility.rb - About 45 mins to fix

                              Method file_stores has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  def file_stores(*args)
                                    if args.length.zero?
                                      options[:file_stores] || [options.key?(:default_file_store) ? default_file_store : Cenit::FileStore::LocalDb]
                                    else
                                      args = args.flatten
                              Severity: Minor
                              Found in lib/cenit/cenit.rb - About 45 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 (sub_record = do_parse_xml(data_type, property_model, sub_element, options, property_schema, nil, nil, property))
                                                  record.send("#{property}=", sub_record)
                                                end
                              Severity: Major
                              Found in lib/edi/parser.rb - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                if (token = message[:token])
                                                  TaskToken.where(token: token).delete_all
                                                end
                                Severity: Major
                                Found in lib/cenit/rabbit.rb - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                    members = [members] unless members.is_a?(Array)
                                  Severity: Major
                                  Found in lib/cenit/xmlrpc.rb - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                      if (association_track = associations[property])
                                                        next unless associations[:kept]
                                                        sub_values = association_track[:new]
                                                      else
                                                        associations[property] = {
                                    Severity: Major
                                    Found in lib/edi/parser.rb - About 45 mins to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language