openjaf/cenit

View on GitHub

Showing 829 of 829 total issues

Method finish has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def finish(status, message, message_type, time)
      self.status = status
      thread_token.destroy if thread_token.present?
      self.thread_token = nil
      Thread.current[:task_token] = nil
Severity: Minor
Found in app/models/setup/task.rb - About 1 hr to fix

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

        def run(input = [], task = nil)
          input = Cenit::Utility.json_value_of(input)
          input = [input] unless input.is_a?(Array)
          input = input.dup
          input_size = input.length
    Severity: Minor
    Found in app/models/setup/algorithm.rb - About 1 hr to fix

      Method pretty_errors has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def pretty_errors(record, stack = Set.new)
            return {} unless record
            stack << record
            errors = record.errors.messages.dup.with_indifferent_access
            if errors.key?(:base) && !property?(:base)
      Severity: Minor
      Found in lib/mongoff/pretty_errors.rb - About 1 hr to fix

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

            def run(message)
              if (flow = agent_from_msg)
                if flow.active
                  unless (execution_graph = message[:execution_graph])
                    execution_graph = message[:execution_graph] = {}
        Severity: Minor
        Found in app/models/setup/flow_execution.rb - About 1 hr to fix

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

              def run(message)
                clear_hashes
                if pull_request_hash.present?
                  pull_request_hash[:install] = message[:install].to_b if ask_for_install?
                  if (pull_parameters = message[:pull_parameters]).is_a?(Hash)
          Severity: Minor
          Found in app/models/setup/base_pull.rb - About 1 hr to fix

            Method process_on has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def process_on(hash_data, options = {})
                  options ||= {}
                  errors.clear
                  properties_locations.each do |property_location|
                    property_location.errors.clear
            Severity: Minor
            Found in app/models/setup/cross_collection_pull_parameter.rb - About 1 hr to fix

              Method where has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                    def where(expression)
                      config_criteria = nil
                      if expression.is_a?(Hash)
                        nil_configs = false
                        config_options = {}
              Severity: Minor
              Found in app/models/concerns/setup/model_configurable.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 a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                def run(message)
                  if (script = agent_from_msg)
                    result = script.run(self)
                    klass = Setup::BuildInDataType::SCHEMA_TYPE_MAP.keys.detect do |type|
                      type && (result.class == type || result.class < type)
              Severity: Minor
              Found in app/models/script_execution.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 where has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                    def where(expression)
                      ids = nil
                      if expression.is_a?(Hash)
                        binds.each do |metadata|
                          c_str = expression.delete(metadata.name.to_s)
              Severity: Minor
              Found in app/models/concerns/setup/bindings.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 build_attachment has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  def build_attachment(hash)
                    unless hash.key?(:filename)
                      filename = hash[:base_name] || DateTime.now.strftime('%Y-%m-%d_%Hh%Mm%S')
                      if (content_type = hash[:contentType]) && (types = ::MIME::Types[content_type])
                        types.each do |type|
              Severity: Minor
              Found in app/models/concerns/setup/webhook_common.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_transformation has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  def run_transformation(transformation, source_data_type, source, options)
                    source = [source] unless source.is_a?(Enumerable)
                    if (transformation.type == :Export && transformation.try(:bulk_source)) ||
                      (transformation.type == :Conversion && transformation.try(:source_handler)) #TODO After remove legacy translators check try(:bulk_source) and try(:source_handler)
                      r = transformation.run(source_data_type: source_data_type, objects: source, save_result: false, options: options)
              Severity: Minor
              Found in app/models/setup/mapping_converter.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 validates_configuration has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  def validates_configuration
                    super
                    unless requires(:email_channel, :email_data_type)
                      if transformation.is_a?(Setup::Converter)
                        unless transformation.source_data_type.eql?(data_type)
              Severity: Minor
              Found in app/models/setup/email_notification.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 validates_configuration has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  def validates_configuration
                    method = output_method
                    if %w(xml html text).include?(method)
                      if mime_type.present?
                        unless mime_type[method]
              Severity: Minor
              Found in app/models/setup/xslt_template.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 build_indices has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  def build_indices
                    unique_properties = self.unique_properties
                    indexed_properties = []
                    begin
                      records_model.collection.indexes.each do |index|
              Severity: Minor
              Found in app/models/setup/json_data_type.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 a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  def run(message)
                    algorithm_id = message[:algorithm_id]
                    if (algorithm = agent_from_msg)
                      result = algorithm.run(message[:input], self).capataz_slave
                      klass = Setup::BuildInDataType::SCHEMA_TYPE_MAP.keys.detect do |type|
              Severity: Minor
              Found in app/models/setup/algorithm_execution.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_transformation has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  def run_transformation(transformation, source_data_type, source, options)
                    source = [source] unless source.is_a?(Enumerable)
                    if (transformation.type == :Export && transformation.bulk_source) ||
                      (transformation.type == :Conversion && transformation.source_handler)
                      r = transformation.run(source_data_type: source_data_type, objects: source, save_result: false, options: options)
              Severity: Minor
              Found in app/models/setup/converter.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 parse_connections has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  def parse_connections(namespace, collection)
                    spec = self.spec_doc
                    auth = collection[:authorizations].first
              
                    collection[:connections] << conn = {
              Severity: Minor
              Found in app/models/setup/api_spec.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 google_v4_refresh_token has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  def google_v4_refresh_token(authorization)
                    if (refresh_token = authorization.refresh_token) && is_time_to_refresh?(authorization)
                      fail 'Missing client configuration' unless authorization.client
                      post = Setup::Connection.post('https://www.googleapis.com/oauth2/v4/token')
                      http_response = post.submit(
              Severity: Minor
              Found in app/models/setup/base_oauth_provider.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 select_items has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  def select_items
                    asc = true
                    if (order = query_selector.delete(:order))
                      order.strip!
                      asc = !order.match(/^-.*/)
              Severity: Minor
              Found in app/controllers/api/v3/api_controller.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 post_digest has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  def post_digest(request, options = {})
                    readable =
                      if request.content_type.downcase == 'multipart/form-data'
                        request.params[:data] || request.params[:file] || fail('Missing data (or file) part')
                      else
              Severity: Minor
              Found in app/controllers/api/v3/api_controller.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

              Severity
              Category
              Status
              Source
              Language