openjaf/cenit

View on GitHub

Showing 829 of 829 total issues

Method do_store_output has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    def do_store_output(output)
      rc = []
      r = nil

      while output.capataz_proxy?
Severity: Minor
Found in app/models/setup/algorithm.rb - About 3 hrs 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 authorize has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

  def authorize
    if (tenant = Tenant.where(id: params[:tenant_id]).first)
      tenant.switch do
        errors = nil
        auth = @authorization = Setup::Authorization.where(id: params[:id]).first
Severity: Minor
Found in app/controllers/authorization_controller.rb - About 3 hrs 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 prepare_attributes has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    def prepare_attributes
      document[:_type] = orm_model.to_s if orm_model.type_polymorphic?
      @fields.each do |field, value|
        nested = (association = orm_model.associations[field]) && association.nested?
        if nested || document[field].nil?
Severity: Minor
Found in lib/mongoff/record.rb - About 3 hrs 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 check_items has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    def check_items(items_schema, items, state, data_type, options)
      path = options[:path] || '#'
      if items.is_a?(Mongoff::RecordArray)
        items_schema = items.orm_model.schema
        data_type = items.orm_model.data_type
Severity: Minor
Found in lib/mongoff/validator.rb - About 3 hrs 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 add_dependencies has 97 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def add_dependencies
      return true unless @add_dependencies
      self.warnings = []
      collecting_models = {}
      COLLECTING_PROPERTIES.each do |property|
Severity: Major
Found in app/models/concerns/setup/collection_behavior.rb - About 3 hrs to fix

    Method build_schema has 97 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def build_schema
          @discarding ||= []
          schema = Mongoff::Model.base_schema.deep_merge('properties' => { 'id' => {} })
          properties = schema['properties']
          if model < ClassHierarchyAware
    Severity: Major
    Found in app/models/setup/build_in_data_type.rb - About 3 hrs to fix

      Method do_merge_schema has 96 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def do_merge_schema(schema, options = {})
            if schema.is_a?(Array)
              return schema.collect { |sch| do_merge_schema(sch, options) }
            end
            return schema unless schema.is_a?(Hash)
      Severity: Major
      Found in app/models/setup/schema_handler.rb - About 3 hrs to fix

        Method process_connection has 96 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def process_connection(template_parameters, verbose_response, last_response, options, &block)
              conformed_url = template_parameters[:url]
              conformed_path = template_parameters[:path]
              body = template_parameters[:body]
              halt_anyway = false
        Severity: Major
        Found in app/models/concerns/setup/webhook_common.rb - About 3 hrs to fix

          Class ApiController has 31 methods (exceeds 20 allowed). Consider refactoring.
          Open

            class ApiController < ApplicationController
          
              before_action :authorize_account, except: [:new_user, :cors_check, :auth]
              before_action :save_request_data, except: [:cors_check, :auth]
              before_action :authorize_action, except: [:auth, :new_user, :cors_check, :push]
          Severity: Minor
          Found in app/controllers/api/v2/api_controller.rb - About 3 hrs to fix

            Method install has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
            Open

                def install(options)
                  collection = options[:collection]
                  origin = options[:origin] || (self.origin == :default ? self.class.default_origin : self.origin)
                  collection.add_dependencies if options[:add_dependencies]
            
            
            Severity: Minor
            Found in app/models/setup/cross_shared_collection.rb - About 3 hrs 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 check_dependentSchemas has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
            Open

                def check_dependentSchemas(properties, instance, _, data_type)
                  return unless instance
                  if instance.is_a?(Mongoff::Record)
                    has_errors = false
                    stored_properties = instance.orm_model.stored_properties_on(instance).map(&:to_s)
            Severity: Minor
            Found in lib/mongoff/validator.rb - About 3 hrs 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

            Class ActiveTenant has 30 methods (exceeds 20 allowed). Consider refactoring.
            Open

              class ActiveTenant
                include Setup::CenitUnscoped
            
                build_in_data_type.on_origin(:admin)
            
            
            Severity: Minor
            Found in app/models/cenit/active_tenant.rb - About 3 hrs to fix

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

                  def save_request_data
                    @data_types ||= {}
                    @request_id = request.uuid
                    @webhook_body = request.body.read
                    @ns_slug = params[:ns]
              Severity: Major
              Found in app/controllers/api/v2/api_controller.rb - About 3 hrs to fix

                File base_pull.rb has 317 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                module Setup
                  class BasePull < Setup::Task
                    include UploaderHelper
                
                    abstract_class
                Severity: Minor
                Found in app/models/setup/base_pull.rb - About 3 hrs to fix

                  Method source_ids_from has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def source_ids_from(message)
                        if (object_ids = message[:object_ids])
                          object_ids
                        elsif (id = message[:source_id])
                          [id]
                  Severity: Minor
                  Found in app/models/setup/flow.rb - About 3 hrs 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 write_attribute has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def write_attribute(name, value)
                        if name.to_s == 'map_attributes'
                          value.delete('_type')
                          value.delete(:_type)
                          value.each do |k, v|
                  Severity: Minor
                  Found in app/models/setup/converter.rb - About 3 hrs 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 25 (exceeds 5 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 3 hrs 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_pull_import has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def post_digest_pull_import(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 3 hrs 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 for has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def for(app_id, scope, user_or_id, options = {})
                          tenant = options[:tenant] || Cenit::MultiTenancy.tenant_model.current
                          user_model = Cenit::MultiTenancy.user_model
                          user =
                            if user_model && user_or_id.is_a?(user_model)
                  Severity: Minor
                  Found in app/models/cenit/oauth_access_token.rb - About 3 hrs 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 init has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def init
                          channel_mutex.lock
                          if ENV['SKIP_RABBIT_MQ'].to_b
                            puts 'RabbitMQ SKIPPED'
                            false
                  Severity: Minor
                  Found in lib/cenit/rabbit.rb - About 3 hrs 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