openjaf/cenit

View on GitHub

Showing 829 of 829 total issues

Method rejects has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def rejects(*fields)
      r = false
      fields.each do |field|
        next unless send(field).present?
        changed =
Severity: Minor
Found in app/models/concerns/setup/req_rej_validator.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 validate_code has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def validate_code
      if code.blank?
        errors.add(:code, "can't be blank")
      else
        logs = parse_code
Severity: Minor
Found in app/models/setup/algorithm.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 mapping_schema has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def mapping_schema(target_data_type_id = nil)
        sch = {
          SCHEMA_FLAG.to_s => true,
          type: 'object',
          properties: {
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 post_digest_upload has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def post_digest_upload(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

Method get_digest_switch_sudo has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def get_digest_switch_sudo(_request, options = {})
    if has_role?(:super_admin)
      if update(super_admin_enabled: !super_admin_enabled)
        {
          json: to_hash(options)
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 schema has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def schema
      sch =
        if type.blank?
          {}
        elsif (json_type = BASIC_TYPES[type])
Severity: Minor
Found in app/models/cenit/application_parameter.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 delete_digest_token has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def delete_digest_token(request, _options = {})
      token = OauthAccessToken.where(id: request.params[:id], token: request.params[:token]).first
      if token
        if token.destroy
          {
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_cross has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def post_digest_cross(request, _options = {})
      fail 'Unable to cross' unless model.is_a?(Class) && (
        model < CrossOrigin::Document ||
        model == Collection
      )
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 11 (exceeds 5 allowed). Consider refactoring.
Open

    def post_digest(request, _options = {})
      begin
        message = JSON.parse(request.body.read)
        fail unless message.is_a?(Hash)
      rescue
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 stored_properties_on has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def stored_properties_on(record)
        properties = Set.new
        begin
          data_type.schema['properties'].keys.each do |key|
            properties << key unless record[key].nil? && record.try(key).nil?
Severity: Minor
Found in lib/mongoid/cenit_extension.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 do_parse_xml has 10 arguments (exceeds 4 allowed). Consider refactoring.
Open

      def do_parse_xml(data_type, model, element, options, json_schema, record = nil, new_record = nil, enclosed_property = nil, container = nil, container_schema = nil)
Severity: Major
Found in lib/edi/parser.rb - About 1 hr to fix

    Method difference has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

      def difference(other)
        hash = {}
        other.each do |other_key, other_value|
          unless has_key?(other_key)
            hash[other_key] = other_value
    Severity: Minor
    Found in lib/cenit/core_ext.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 associated_ids has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

          def associated_ids(association, criteria)
            associations =
              begin
                association.klass.get_associations
              rescue
    Severity: Minor
    Found in lib/cenit/utility.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 read_from_store has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

          def read_from_store(file, len)
            cursor = file.cursor
            return nil if cursor == file.length
            chunk_size = file[:chunkSize]
            current_chunk = cursor / chunk_size
    Severity: Minor
    Found in lib/cenit/file_store/local_db.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 create_authorization! has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def create_authorization!(auth_data = {})
          auth_class = self.class.preferred_authorization_class(provider)
          auth = auth_class.new(namespace: auth_data[:namespace], client_id: id, metadata: auth_data[:metadata])
          auth.name = auth_data[:name] || "#{provider.name.to_title} #{auth_class.to_s.split('::').last.to_title} #{auth.id}"
          if auth_class <= Setup::Oauth2Authorization
    Severity: Minor
    Found in app/models/setup/oauth_client.rb - About 1 hr to fix

      Method digest has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def digest
          status = :accepted
          json = {}
          if request.body.length > MAX_SIZE
            status = :bad_request
      Severity: Minor
      Found in app/controllers/hook_controller.rb - About 1 hr to fix

        Method select_items has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def select_items
              asc = true
              if (order = @criteria.delete(:order))
                order.strip!
                asc = !order.match(/^-.*/)
        Severity: Minor
        Found in app/controllers/api/v2/api_controller.rb - About 1 hr to fix

          Method select_items has 31 lines of code (exceeds 25 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

            Method start has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def start
                    Thread.new do
                      Cenit::Redis.new.subscribe(:hook) do |on|
                        on.subscribe do |channel, subscriptions|
                          puts "Redis Hook adapter subscribed to ##{channel} (#{subscriptions} subscriptions)"
            Severity: Minor
            Found in app/models/cenit/hook.rb - About 1 hr to fix

              Method push has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def push
                    response =
                      {
                        success: success_report = Hash.new { |h, k| h[k] = [] },
                        errors: broken_report = Hash.new { |h, k| h[k] = [] }
              Severity: Minor
              Found in app/controllers/api/v2/api_controller.rb - About 1 hr to fix
                Severity
                Category
                Status
                Source
                Language