openjaf/cenit

View on GitHub

Showing 829 of 829 total issues

Method show has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def show
      item = @item
      if (json_path = request.headers['X-JSON-Path']) && json_path =~ /\A\$(.(^[.\[\]])*(\[[0-9]+\])?)+\Z/
        json_path = json_path.split('.')
        json_path.shift
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 evolve has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

      def evolve(value)
        if value.respond_to?(:orm_model) && value.respond_to?(:id)
          value.id
        else
          case value
Severity: Minor
Found in lib/mongoff/criteria.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 _handle_error has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def _handle_error(instance, err, property = :base)
      return unless instance
      msg = err.is_a?(String) ? err : err.message
      if block_given?
        msg = yield msg
Severity: Minor
Found in lib/mongoff/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 chunking has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

      def chunking(io, chunk_size, &block)
        if io.method(:read).arity.zero?
          data = io.read
          i = 0
          loop do
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 parse_viewport has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def parse_viewport(value)
      value = value.to_s.split(' ').map do |seq|
        seq.chars.inject([]) do |a, char|
          case char
            when '{', '}'
Severity: Minor
Found in lib/edi/formater.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_slug has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def validate_slug
      check_taken = true
      unless slug.present?
        candidate =
          if (candidate = slug_candidate).blank?
Severity: Minor
Found in app/models/concerns/setup/slug.rb - About 1 hr to fix

    Method run has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def run(message)
          data_type = data_type_from(message)
          if data_type
            if data_type.bulkable_deletable?
              if (model = data_type.records_model)
    Severity: Minor
    Found in app/models/setup/deletion.rb - About 1 hr to fix

      Method data_type_schemas has 39 lines of code (exceeds 25 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 1 hr to fix

        Method check_propertyNames has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def check_propertyNames(schema, instance, state, data_type, options)
              path = options[:path] || '#'
              schema = data_type.merge_schema(schema)
              if instance.is_a?(Mongoff::Record)
                unless state[:instance_clear]
        Severity: Minor
        Found in lib/mongoff/validator.rb - About 1 hr to fix

          Method to_json_schema has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def to_json_schema
                json_schema = documenting('type' => 'object')
                if name
                  json_schema['title'] = name.to_title
                end
          Severity: Minor
          Found in lib/xsd/complex_type.rb - About 1 hr to fix

            Method save has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def save(record, options = {})
                    saved = options[:saved_collector] || Set.new
                    if bind_references(record, options.delete(:bind_references))
                      success =
                        if record.try(:save_self_before_refs)
            Severity: Minor
            Found in lib/cenit/utility.rb - About 1 hr to fix

              Method to_map_schema has 38 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def to_map_schema(sch)
                      if sch['type'] == 'object' && (properties = sch['properties']).is_a?(Hash)
                        new_properties = {}
                        id_optional = true
                        properties.each do |property, property_schema|
              Severity: Minor
              Found in app/models/setup/mapping_converter.rb - About 1 hr to fix

                Method source_options has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def source_options(options, source_key_options = self.source_key_options)
                      data_type_key = source_key_options[:data_type_key] || :source_data_type
                      if (data_type = send(data_type_key) || options[data_type_key] || options[:data_type])
                        model = data_type.records_model
                        offset = options[:offset] || 0
                Severity: Minor
                Found in app/models/setup/with_source_options.rb - About 1 hr to fix

                  Method new has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def new
                        response = {}
                        %w(success warnings errors).each { |key| response[key.to_sym] = Hash.new { |h, k| h[k] = [] } }
                        @payload.each do |root, message|
                          if (data_type = @payload.data_type_for(root))
                  Severity: Minor
                  Found in app/controllers/api/v2/api_controller.rb - About 1 hr to fix

                    Method new has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def new
                        if (provider = params[:with])
                          redirect_to "/app/#{::Cenit::OpenId.app_key}?with=#{provider}&redirect_uri=#{Cenit.homepage}#{session_path(resource_name)}"
                        elsif (code = params[:code])
                          if (user = ::Cenit::OpenId.get_user_by(code))
                    Severity: Minor
                    Found in app/controllers/sessions_controller.rb - About 1 hr to fix

                      Method token has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def token
                          response = {}
                          response_code = :bad_request
                          errors = ''
                          token_class =
                      Severity: Minor
                      Found in app/controllers/oauth_controller.rb - About 1 hr to fix

                        Method authorize_action has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            def authorize_action(options = {})
                              action = options[:action] || @_action_name
                              success = true
                              if klass
                                action_symbol =
                        Severity: Minor
                        Found in app/controllers/api/v3/api_controller.rb - About 1 hr to fix

                          Method check_dependentRequired has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              def check_dependentRequired(properties, instance)
                                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 1 hr to fix

                            Method index has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                def index
                                  if klass
                                    @items =
                                      if @criteria.present?
                                        if (sort_key = @criteria.delete(:sort_by))
                            Severity: Minor
                            Found in app/controllers/api/v1/api_controller.rb - About 1 hr to fix

                              Method bundled_javascript_code has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                    def bundled_javascript_code(algorithm)
                                      arguments_param = false
                                      i = -1
                                      js_vars = ''
                                      params_initializer =
                              Severity: Minor
                              Found in lib/cenit/bundler_interpreter.rb - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language