openjaf/cenit

View on GitHub

Showing 739 of 829 total issues

Method create_http_client has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def create_http_client(options = {})
      if (http_proxy = Cenit.http_proxy)
        options[:proxy] ||= http_proxy
      end
      options[:request_token_url] ||= request_token_endpoint
Severity: Minor
Found in app/models/setup/oauth_authorization.rb - About 25 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 translate_export has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def translate_export(message)
      options = {
        object_ids: object_ids_from(message),
        source_data_type: data_type_from(message),
        task: self,
Severity: Minor
Found in app/models/setup/translation.rb - About 25 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 all_data_type_storage_collections_names has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def all_data_type_storage_collections_names
      if model < CrossOrigin::CenitDocument
        origins = model.origins.select { |origin| Setup::Crossing.authorized_crossing_origins.include?(origin) }
        origins.collect do |origin|
          if origin == :default
Severity: Minor
Found in app/models/setup/build_in_data_type.rb - About 25 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 map_model has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def map_model
      if source_data_type && target_data_type
        if @mongoff_model && @mongoff_model.data_type != target_data_type
          @mongoff_model = nil
        end
Severity: Minor
Found in app/models/setup/converter.rb - About 25 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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def run(_message)
      each_entry do |entry_name, schema|
        uri = base_uri.blank? ? entry_name : "#{base_uri}/#{entry_name}"
        schema = Setup::Schema.create(namespace: namespace, uri: uri, schema: schema)
        fail schema.errors.full_messages.to_sentence unless schema.errors.blank?
Severity: Minor
Found in app/models/setup/schemas_import.rb - About 25 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 can? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def can?(action, model)
      method = (ACCESS_TOKENS.include?(action) && action) || nil
      return true if super_method?(method)
      return false unless (data_type = model.try(:data_type))
      criteria = access_by_ids.criteria_for(method)
Severity: Minor
Found in app/models/cenit/oauth_scope.rb - About 25 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 get_digest_email_data_type has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def self.get_digest_email_data_type(_request, _options = {})
      if (data_type = Setup::Configuration.singleton_record.email_data_type)
        {
          json: {
            id: data_type.id.to_s,
Severity: Minor
Found in app/controllers/api/v3/api_controller.rb - About 25 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 digest_schema has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def digest_schema(request, options = {})
      data =
        if request.get?
          merged_schema(options)
        else
Severity: Minor
Found in app/controllers/api/v3/api_controller.rb - About 25 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 find_version has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def find_version(uploader, path)
    if uploader.path == path
      uploader
    else
      uploader.versions.values.each do |uploader_version|
Severity: Minor
Found in app/controllers/file_controller.rb - About 25 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 digest has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def digest(token, slug, data, content_type)
          if (tenant = where(id: token)&.first&.tenant)
            tenant.owner_switch do
              if (hook = Hook.where(token: token).first)
                message = {
Severity: Minor
Found in app/models/cenit/hook.rb - About 25 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 check_attributes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def check_attributes
    remove_attribute(:super_admin_enabled) unless has_role?(:super_admin)
    if attributes['name'] && attributes['given_name'].present? && attributes['family_name'].present?
      remove_attribute(:name)
    end
Severity: Minor
Found in app/models/user.rb - About 25 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 setup_hook has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def setup_hook(hook, tenant = Tenant.current)
          if (record = where(hook_id: hook.id, tenant_id: tenant.id).first)
            unless record.id == hook.token
              record.delete
              record = nil
Severity: Minor
Found in app/models/cenit/hook.rb - About 25 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_config has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def post_digest_config(request, _options = {})
      self.configuration = request.body.read
      if save
        {
          body: nil
Severity: Minor
Found in app/controllers/api/v3/api_controller.rb - About 25 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 get_digest_switch_trust has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def get_digest_switch_trust(_request, options = {})
      self.trusted = !trusted
      if save
        {
          json: to_hash(options)
Severity: Minor
Found in app/controllers/api/v3/api_controller.rb - About 25 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 setup_request has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def setup_request(options = {})
      if (@klass = options[:klass])
        @ns_name = @klass.data_type.namespace
      else
        @ns_name = nil
Severity: Minor
Found in app/controllers/api/v3/api_controller.rb - About 25 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 handle_get_digest_download has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def handle_get_digest_download(controller)
      file = where(controller.query_selector).first
      if file
        controller.send_data(file.data, filename: file.filename, type: file.contentType)
      else
Severity: Minor
Found in app/controllers/api/v3/api_controller.rb - About 25 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 get_digest_access has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def get_digest_access(_request, options = {})
      access_grant = ::Cenit::OauthAccessGrant.where(
        application_id_id: application_id_id
      ).first
      if access_grant
Severity: Minor
Found in app/controllers/api/v3/api_controller.rb - About 25 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 get_limit has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def get_limit
      unless @limit
        limit_option = @criteria_options.delete(:limit)
        limit = (@criteria.delete(:limit) || limit_option).to_i
        @limit =
Severity: Minor
Found in app/controllers/api/v2/api_controller.rb - About 25 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 scope_current_account has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def scope_current_account
    Account.current = nil
    clean_thread_cache
    if current_user && current_user.account.nil?
      current_user.account = current_user.accounts.first || Account.new_for_create(owner: current_user)
Severity: Minor
Found in app/controllers/application_controller.rb - About 25 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 check_maxProperties has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def check_maxProperties(max, instance)
      if instance.is_a?(Mongoff::Record) || instance.is_a?(Hash)
        instance = instance.orm_model.stored_properties_on(instance) if instance.is_a?(Mongoff::Record)
        raise_path_less_error "has too many properties (#{instance.size} of #{max} max)" if instance.size > max
      end
Severity: Minor
Found in lib/mongoff/validator.rb - About 25 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