openjaf/cenit

View on GitHub

Showing 829 of 829 total issues

Method each_entry has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def each_entry(&block)
      state.clear if state[:done]
      if decompress_content?
        begin
          Zip::InputStream.open(StringIO.new(data.read)) do |zis|
Severity: Minor
Found in app/models/concerns/setup/data_iterator.rb - About 1 hr to fix

    Method post_digest_pull_import has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

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

      Consider simplifying this complex logical expression.
      Open

                if element.max_occurs == :unbounded || element.max_occurs > 1 || element.min_occurs > 1
                  plural_title = (element_schema['title'] || element.name || element.try(:nice_name) || element.tag_name).to_title.pluralize
                  p = (element.name || element_schema['title'] || element.try(:nice_name) || element.tag_name).pluralize.to_method_name(properties)
                  properties[p] = { 'title' => "List of #{plural_title}",
                                    'type' => 'array',
      Severity: Critical
      Found in lib/xsd/container.rb - About 1 hr to fix

        Consider simplifying this complex logical expression.
        Open

                      if scheduler || publish_at || async_message
                        if (token = message[:token])
                          TaskToken.where(token: token).delete_all
                        end
                        message[:task_id] = task.id.to_s
        Severity: Critical
        Found in lib/cenit/rabbit.rb - About 1 hr to fix

          Method mongo_value has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def mongo_value(value, field, schema = nil, &success_block)
                field = '_id' if field.to_s == 'id'
                types =
                  if !caching? || schema
                    mongo_type_for(field, schema)
          Severity: Minor
          Found in lib/mongoff/model.rb - About 1 hr to fix

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

                def run(message)
                  message = message.with_indifferent_access
                  data_types =
                    case source = message[:source]
                    when nil # All data types
            Severity: Minor
            Found in app/models/setup/data_type_expansion.rb - About 1 hr to fix

              Method new_user has 40 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def new_user
                    data = (JSON.parse(@webhook_body) rescue {}).keep_if { |key, _| %w(email password password_confirmation token code).include?(key) }
                    data = data.with_indifferent_access
                    data.reverse_merge!(email: params[:email], password: pwd = params[:password], password_confirmation: params[:password_confirmation] || pwd)
                    status = :not_acceptable
              Severity: Minor
              Found in app/controllers/api/v1/api_controller.rb - About 1 hr to fix

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

                    def valuate(cond_v, klass)
                      return if cond_v.nil?
                      return cond_v if cond_v.is_a?(klass)
                      cond_v = [cond_v] unless (is_array = cond_v.is_a?(Array))
                      to_obj_class = CONVERSION_METHOD[klass]
                Severity: Minor
                Found in app/models/setup/triggers_formatter.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 validates_configuration has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    def validates_configuration
                      unless requires :data_type, :observers, :transformation
                        mismatch_observers = observers.select { |observer| observer.data_type_id != data_type_id }
                        unless mismatch_observers.empty?
                          errors.add(:observers, "data type mismatch: #{observers.map(&:custom_title).to_sentence}")
                Severity: Minor
                Found in app/models/setup/notification_flow.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 cross_origins has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                      def cross_origins
                        if @origins
                          @origins.collect do |origin|
                            if origin.respond_to?(:call)
                              origin.call
                Severity: Minor
                Found in app/models/concerns/cross_origin/cenit_document.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 store has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    def store(source, opts)
                      uploader = opts.is_a?(CarrierWave::Uploader) ? opts : opts[:on]
                      fail "Invalid options argument #{opts}, an uploader expected :on" unless uploader.is_a?(CarrierWave::Uploader::Base)
                      field = uploader.mounted_as
                      if source.is_a?(CarrierWave::Uploader::Base)
                Severity: Minor
                Found in app/models/concerns/setup/uploader_helper.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 start_migration has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    def start_migration
                      if persisted? && (changed_attributes.key?('file_store') || changed_attributes.key?('public_read'))
                        if Setup::FileStoreMigration.cannot_migrate?(data_type)
                          errors.add(:file_store, 'can not be updated')
                        else
                Severity: Minor
                Found in app/models/setup/file_store_config.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 validates_configuration has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    def validates_configuration
                      [:before_save_callbacks, :after_save_callbacks].each do |association|
                        invalid_algorithms = []
                        self.send(association).each { |algorithm| invalid_algorithms << algorithm unless algorithm.parameters.size == 1 }
                        if invalid_algorithms.present?
                Severity: Minor
                Found in app/models/setup/data_type.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 match? has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    def match?(path)
                      @request_path = path
                      @path_params = {}
                      tokens = self.path.split('/').from(1)
                      path_tokens = path.split('/')
                Severity: Minor
                Found in app/models/setup/action.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 validates_pull_parameters has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    def validates_pull_parameters
                      with_errors = false
                      data =
                        if installed
                          if new_record?
                Severity: Minor
                Found in app/models/setup/cross_shared_collection.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_data has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    def validate_data(data)
                      unless data.is_a?(Nokogiri::XML::Document)
                        unless data.is_a?(String)
                          data =
                            if data.respond_to?(:to_xml)
                Severity: Minor
                Found in app/models/setup/xslt_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 update has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    def update
                      parser_options = self.parser_options.dup
                      parser_options[:add_only] = true
                      async = klass.is_a?(Class) && klass < Setup::AsynchronousPersistence::Model
                      if async
                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_origins has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    def get_digest_origins(_request, _options = {})
                      model = records_model
                      origins =
                        if (model.is_a?(Class) && model < CrossOrigin::Document) || model == Collection
                          origins = model.origins
                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 handle_delete_digest has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    def handle_delete_digest(controller)
                      query = where(controller.query_selector)
                      response =
                        if query.count == 1
                          item = query.first
                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 can? has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                  def can?(action, subject, *extra_args)
                    return true if action == :digest
                    if action == :json_edit
                      subject.is_a?(Mongoff::Record) && !subject.is_a?(Mongoff::GridFs::File)
                    elsif (action == :simple_cross && crossing_models.exclude?(subject.is_a?(Class) ? subject : subject.class)) ||
                Severity: Minor
                Found in app/models/ability.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

                Severity
                Category
                Status
                Source
                Language