openjaf/cenit

View on GitHub

Showing 829 of 829 total issues

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 (filename = params[:file])
                filename = "#{filename}.#{params[:format]}" if params[:format]
              end
Severity: Major
Found in app/controllers/file_controller.rb - About 45 mins to fix

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

          def process_options(options)
            p =
              case (p = options.delete(:primary_fields) || options.delete('primary_fields'))
              when Array
                p
    Severity: Minor
    Found in lib/edi/parser.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 access_grant
                    @oauth_scope = access_grant.oauth_scope
                  end
    Severity: Major
    Found in app/controllers/api/v2/api_controller.rb - About 45 mins to fix

      Method check_contains has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def check_contains(contains_schema, items, state, data_type, options, schema)
      Severity: Minor
      Found in lib/mongoff/validator.rb - About 45 mins to fix

        Method check_format has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def check_format(format, instance, _state, _data_type, _options, schema)
        Severity: Minor
        Found in lib/mongoff/validator.rb - About 45 mins to fix

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

              def to_json_schema
                json = documenting(qualify_type(base).to_json_schema)
                @restrictions.each do |key, value|
                  restriction =
                    case key
          Severity: Minor
          Found in lib/xsd/simple_type_restriction.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 search_selector has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def search_selector(query)
                if query.empty?
                  return {}
                end
          
          
          Severity: Minor
          Found in lib/mongoff/metadata_access.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 check_minimum has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def check_minimum(minimum, instance, _state, _data_type, _options, schema)
          Severity: Minor
          Found in lib/mongoff/validator.rb - About 45 mins to fix

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

                def check_schema_type(types)
                  return if types.nil?
                  types = [types] unless types.is_a?(Array)
                  types = types.map(&:to_s).map(&:to_sym)
                  raise_path_less_error "types are not unique" unless types.uniq.length === types.length
            Severity: Minor
            Found in lib/mongoff/validator.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 embed_files has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                    def embed_files
                      if (mounters = instance_variable_get(:@_mounters))
                        mounters.each do |field, mounter|
                          next unless mounter.uploaders.any? { |uploader| uploader.is_a?(EmbeddedUploaderBehavior) }
                          i_flag = :"@embedding_#{field}_files"
            Severity: Minor
            Found in app/uploaders/embedded_uploader_behavior.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 check_maximum has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def check_maximum(maximum, instance, _state, _data_type, _options, schema)
            Severity: Minor
            Found in lib/mongoff/validator.rb - About 45 mins to fix

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

                def find_app_control_action
                  path = request.path.split('/').from(@id_routing ? 3 : 4).join('/')
                  path ||= '/' if path.blank?
                  method = request.request_method.to_s.downcase.to_sym
                  @app_action = @app.actions.detect { |a| a.method == method && a.match?(path) }
              Severity: Minor
              Found in app/controllers/app_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

              Method check_type has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def check_type(types, instance, _, _, options, schema)
              Severity: Minor
              Found in lib/mongoff/validator.rb - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                  if (sub_record = do_parse_xml(data_type, property_model, sub_element, options, items_schema, nil, nil, property, association, property_schema)) &&
                                    (sub_values || association).exclude?(sub_record)
                                    (sub_values || association) << sub_record
                                  end
                Severity: Major
                Found in lib/edi/parser.rb - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                    if persist && sub_value['_reference'] && ((sub_value[:id].nil? && sub_value[:_id].nil?) || options[:skip_refs_binding])
                                      sub_value = Cenit::Utility.deep_remove(sub_value, '_reference')
                                      unless Cenit::Utility.find_record(sub_value, association)
                                        unless (references = record.instance_variable_get(:@_references))
                                          record.instance_variable_set(:@_references, references = {})
                  Severity: Major
                  Found in lib/edi/parser.rb - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                      length = top - start if start + length >= top
                    Severity: Major
                    Found in lib/edi/parser.rb - About 45 mins to fix

                      Method do_store has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          def do_store(json, key, value, options, schema = {}, store_anyway = false)
                      Severity: Minor
                      Found in lib/edi/formater.rb - About 45 mins to fix

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

                              def find_record(model, container, container_schema)
                                yield(criteria = {})
                                if criteria.empty?
                                  nil
                                else
                        Severity: Minor
                        Found in lib/edi/parser.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

                                          next unless kept
                        Severity: Major
                        Found in lib/edi/parser.rb - About 45 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language