openjaf/cenit

View on GitHub

Showing 829 of 829 total issues

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

      def data_type_schemas(source, options = {})
        options[:schemas] = schemas =
          case source
          when nil # All schemas
            Setup::Schema.all
Severity: Minor
Found in app/models/setup/data_type_generation.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 (obj = (obj.reload rescue nil))
Severity: Major
Found in app/models/setup/base_pull.rb - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                    unless t_target_dt == sub_map_target_dt
                      sub_map.errors.add(:transformation, "target data type (#{t_target_dt ? t_target_dt.custom_title : 'nil'}) is invalid (#{sub_map_target_dt.custom_title} expected)")
                    end
    Severity: Major
    Found in app/models/setup/converter.rb - About 45 mins to fix

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

          def store_fields(instance_variable, *fields)
            if fields
              fail 'Illegal argument' unless fields.present?
              fields = [fields] unless fields.is_a?(Enumerable)
              instance_variable_set(instance_variable, fields.flatten.collect(&:to_s).uniq.select(&:present?))
      Severity: Minor
      Found in app/models/setup/build_in_data_type.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

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

          def process(message = {}, &block)
            execution_graph = current_thread_cache.last || {}
            if (trigger_flow_id = execution_graph['trigger_flow_id'])
              execution_graph[trigger_flow_id] ||= []
              adjacency_list = execution_graph[trigger_flow_id]
      Severity: Minor
      Found in app/models/setup/flow.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

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

          def descriptions
            d = []
            if valid?
              d << 'View your email' if email?
              d << 'View your basic profile' if profile?
      Severity: Minor
      Found in app/models/cenit/oauth_scope.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

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

        def init_heroku_db
          if ENV['HEROKU_MLAB'] && new_record?
            heroku_name = "hub-#{id.to_s}"
            app = HerokuClient::App.create(heroku_name)
            if app
      Severity: Minor
      Found in app/models/account.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

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

          def post_digest(request, _options = {})
            options = JSON.parse(request.body.read)
            execution = Setup::Translation.process(
              translator_id: id,
              data_type_id: (
      Severity: Minor
      Found in app/controllers/api/v3/api_controller.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 !data.key?(:email) || data[:email] == token_data[:email]
                        data.merge!(captcha_token.data || {}) { |_, left, right| left || right }
                        captcha_token.destroy
                        _, status, response = create_user_with(data)
                        response
      Severity: Major
      Found in app/controllers/api/v3/api_controller.rb - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                      case scope[i]
                        when '{'
                          stack += 1
                        when '}'
                          stack -= 1
        Severity: Major
        Found in app/models/cenit/oauth_scope.rb - About 45 mins to fix

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

              def new_from_edi(string_or_readable, options = {})
                if data_type_methods.any? { |alg| alg.name == 'new_from_edi' }
                  return method_missing(:new_from_edi, string_or_readable, options)
                end
                if options[:data_type_parser]
          Severity: Minor
          Found in app/models/setup/file_data_type.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

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

                def post_digest_pull(request, _options)
                  data = JSON.parse(request.body.read)
                  execution = pull(
                    pull_parameters: data['pull_parameters'] || {}
                  )
          Severity: Minor
          Found in app/controllers/api/v3/api_controller.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 !error_description && (x_tenant_id || access_token.set_current_tenant!)
                        access_grant = Cenit::OauthAccessGrant.where(application_id: access_token.application_id).first
                        if access_grant
                          @oauth_scope = access_grant.oauth_scope
                        else
          Severity: Major
          Found in app/controllers/Oauth2AccountAuthorization.rb - About 45 mins to fix

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

                def post_digest(request, _options = {})
                  options = JSON.parse(request.body.read)
                  execution = Setup::Translation.process(
                    translator_id: id,
                    data_type_id: (
            Severity: Minor
            Found in app/controllers/api/v3/api_controller.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

                          rescue Exception => ex
                            errors = [ex.message]
            Severity: Major
            Found in app/controllers/authorization_controller.rb - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                          if (x_tenant_id = request.headers['X-Tenant-Id'])
                            if (x_tenant = Account.find_where(id: x_tenant_id).first)
                              Account.current = x_tenant
                            else
                              error_description = 'Invalid tenant'
              Severity: Major
              Found in app/controllers/Oauth2AccountAuthorization.rb - About 45 mins to fix

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

                      def get_digest_config(_request, _options = {})
                        if (config = self.config).new_record?
                          config = {}
                        else
                          config = config.to_hash
                Severity: Minor
                Found in app/controllers/api/v3/api_controller.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 !data.key?(:email) || data[:email] == token_data[:email]
                                  data.merge!(captcha_token.data || {}) { |_, left, right| left || right }
                                  captcha_token.destroy
                                  _, status, response = create_user_with(data)
                                  response
                Severity: Major
                Found in app/controllers/api/v2/api_controller.rb - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                if (filename.nil? || (uploader = find_version(uploader, uploader.path_for(record, field, filename)))) &&
                                  (content = uploader.read)
                                  send_data content,
                                            filename: uploader.identifier,
                                            type: uploader.file.content_type,
                  Severity: Major
                  Found in app/controllers/file_controller.rb - About 45 mins to fix

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

                        def new_from_xml(string_or_readable, options = {})
                          if data_type_methods.any? { |alg| alg.name == 'new_from_xml' }
                            return method_missing(:new_from_xml, string_or_readable, options)
                          end
                          if options[:data_type_parser]
                    Severity: Minor
                    Found in app/models/setup/file_data_type.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

                    Severity
                    Category
                    Status
                    Source
                    Language