openjaf/cenit

View on GitHub

Showing 829 of 829 total issues

Method validate_data has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def validate_data(data)
      case schema_type
      when :json_schema
        unless data.is_a?(Hash)
          data =
Severity: Minor
Found in app/models/setup/schema.rb - About 1 hr to fix

    Method validate_configuration has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def validate_configuration
          self.title = self.name if title.blank?
          validators_classes = Hash.new { |h, k| h[k] = [] }
          if validators.present?
            validators.each { |validator| validators_classes[validator.class] << validator }
    Severity: Minor
    Found in app/models/setup/file_data_type.rb - About 1 hr to fix

      Method evolve_hash has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def evolve_hash(hash)
              if (association = model.associations[field]) && association.referenced?
                operators = {}
                sub_criteria = {}
                hash.each do |key, value|
      Severity: Minor
      Found in lib/mongoff/criteria.rb - About 1 hr to fix

        Method detask has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def detask(message)
                report = nil
                case task = message.delete(:task)
                when Class
                  task_class = task
        Severity: Minor
        Found in lib/cenit/rabbit.rb - About 1 hr to fix

          Method process_ftp has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def process_ftp(opts)
                result = nil
                path = URI.decode(opts[:path])
                username, password = check(opts[:template_parameters], :username, :password)
          
          
          Severity: Minor
          Found in app/models/concerns/setup/webhook_common.rb - About 1 hr to fix

            Method simple_translate has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def simple_translate(message)
                  if translator.try(:source_handler)
                    options = {
                      object_ids: object_ids_from(message),
                      data_type: data_type_from(message),
            Severity: Minor
            Found in app/models/setup/translation.rb - About 1 hr to fix

              Method build_indices has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def build_indices
                    unique_properties = self.unique_properties
                    indexed_properties = []
                    begin
                      records_model.collection.indexes.each do |index|
              Severity: Minor
              Found in app/models/setup/json_data_type.rb - About 1 hr to fix

                Method google_v4_refresh_token has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def google_v4_refresh_token(authorization)
                      if (refresh_token = authorization.refresh_token) && is_time_to_refresh?(authorization)
                        fail 'Missing client configuration' unless authorization.client
                        post = Setup::Connection.post('https://www.googleapis.com/oauth2/v4/token')
                        http_response = post.submit(
                Severity: Minor
                Found in app/models/setup/base_oauth_provider.rb - About 1 hr to fix

                  Method days has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def days
                        month = @solution[0]
                        weeks_days = @conf[:weeks_days]
                        weeks_days = (0..6).to_a if weeks_days.blank?
                        weeks_month = @conf[:weeks_month]
                  Severity: Minor
                  Found in app/models/setup/scheduler.rb - About 1 hr to fix

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

                      Method method_missing has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          def method_missing(symbol, *args, &block)
                            if METHODS.include?(symbol)
                              options =
                                if args.length == 1 && block
                                  base_method_name =
                      Severity: Minor
                      Found in app/controllers/build_in_app_base_controller.rb - About 1 hr to fix

                        Method query_selector has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            def query_selector(selector = nil)
                              parse_query_params =
                                if selector
                                  @criteria = nil
                                else
                        Severity: Minor
                        Found in app/controllers/api/v3/api_controller.rb - About 1 hr to fix

                          Method save_request_data has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              def save_request_data
                                @data_types ||= {}
                                @request_id = request.uuid
                                @webhook_body = request.body.read
                                @ns_slug = params[:ns]
                          Severity: Minor
                          Found in app/controllers/api/v1/api_controller.rb - About 1 hr to fix

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

                              Method json_value_of has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                    def json_value_of(value)
                                      return value unless value.is_a?(String)
                                      value = value.strip
                                      if value.blank?
                                        nil
                              Severity: Minor
                              Found in lib/cenit/utility.rb - About 1 hr to fix

                                Consider simplifying this complex logical expression.
                                Open

                                        if @ability.can?(action_symbol, options[:item] || options[:klass] || @item || klass) &&
                                          (@oauth_scope.nil? || @oauth_scope.can?(action_symbol, options[:klass] || klass))
                                          @access_token.hit if @access_token
                                        else
                                          success = false
                                Severity: Major
                                Found in app/controllers/api/v3/api_controller.rb - About 1 hr to fix

                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                  Open

                                      def check_name
                                        if name.blank?
                                          hash = JSON.parse(triggers)
                                          triggered_fields = hash.keys
                                          n = "#{self.data_type.custom_title} on #{triggered_fields.to_sentence}"
                                  Severity: Minor
                                  Found in app/models/setup/filter.rb and 1 other location - About 1 hr to fix
                                  app/models/setup/observer.rb on lines 90..98

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 47.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                  Open

                                      def check_name
                                        if name.blank?
                                          hash = JSON.parse(triggers)
                                          triggered_fields = hash.keys
                                          n = "#{self.data_type.custom_title} on #{triggered_fields.to_sentence}"
                                  Severity: Minor
                                  Found in app/models/setup/observer.rb and 1 other location - About 1 hr to fix
                                  app/models/setup/filter.rb on lines 44..52

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 47.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Identical blocks of code found in 2 locations. Consider refactoring.
                                  Open

                                        def storage_size(scale = 1)
                                          subtype_count = data_type.subtype? && data_type.count
                                          data_type.all_data_type_storage_collections_names.inject(0) do |size, name|
                                            s =
                                              begin
                                  Severity: Minor
                                  Found in lib/mongoid/cenit_extension.rb and 1 other location - About 55 mins to fix
                                  lib/mongoff/model.rb on lines 212..226

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 46.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Identical blocks of code found in 2 locations. Consider refactoring.
                                  Open

                                      def storage_size(scale = 1)
                                        subtype_count = data_type.subtype? && data_type.count
                                        data_type.all_data_type_storage_collections_names.inject(0) do |size, name|
                                          s =
                                            begin
                                  Severity: Minor
                                  Found in lib/mongoff/model.rb and 1 other location - About 55 mins to fix
                                  lib/mongoid/cenit_extension.rb on lines 82..96

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 46.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language