openjaf/cenit

View on GitHub

Showing 829 of 829 total issues

Avoid deeply nested control flow statements.
Open

              if scope.is_a?(Mongoid::Criteria)
                scope.delete_all
              else
                scope.delete_many
              end
Severity: Major
Found in app/models/setup/deletion.rb - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                    value.delete(k) if v.empty?
    Severity: Major
    Found in app/models/setup/mapping_converter.rb - About 45 mins to fix

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

          def check_snippet
            if snippet_required?
              configure_snippet
              if snippet_ref.changed? && !snippet_ref.save
                snippet_ref.errors.full_messages.each do |msg|
      Severity: Minor
      Found in app/models/concerns/setup/snippet_code.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 process_http_connection has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def process_http_connection(connection, template_parameters, verbose_response, last_response, options, &block)
      Severity: Minor
      Found in app/models/concerns/setup/webhook_common.rb - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                    next unless (base_properties = base_model['properties'])
        Severity: Major
        Found in app/models/setup/schema_handler.rb - About 45 mins to fix

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

                def parse_options(options)
                  options = options.to_s.strip
                  options = "{#{options}" unless options.start_with?('{')
                  options = "#{options}}" unless options.ends_with?('}')
                  ast =
          Severity: Minor
          Found in app/models/concerns/setup/translation_common.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 configure_snippet has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def configure_snippet
                if snippet_ref.new_record?
                  snippet_ref.namespace = snippet_ref.namespace.presence || namespace
                  name = snippet_ref.name.presence || snippet_name
                  i = 0
          Severity: Minor
          Found in app/models/concerns/setup/snippet_code.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

                          unless t_target_dt == sub_map_target_dt
                            sub_map.errors.add(:transformation, "target data type (#{t_target_dt ? t_target_dt.custom_title : 'nil'}) is invalid (#{sub_map_target_dt.custom_title} expected)")
                          end
          Severity: Major
          Found in app/models/setup/mapping_converter.rb - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                              options[:object_ids] = enum.collect { |obj| obj.id.is_a?(BSON::ObjectId) ? obj.id.to_s : obj.id }
            Severity: Major
            Found in app/models/setup/legacy_translator.rb - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                            if response_translator.data_type
                              rejects(:response_data_type)
                            else
                              requires(:response_data_type)
                            end
              Severity: Major
              Found in app/models/setup/flow.rb - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                              raise Exception.new("specification of property '#{property_name}' is not valid") unless property_spec.is_a?(Hash)
                Severity: Major
                Found in app/models/setup/json_data_type.rb - About 45 mins to fix

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

                      def translate(message, &block)
                        if translator.present?
                          begin
                            flow_execution = current_thread_cache
                            flow_execution << (message[:execution_graph] || {}).merge('trigger_flow_id' => id.to_s)
                  Severity: Minor
                  Found in app/models/setup/flow.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

                                  value.delete(k) if v.empty?
                  Severity: Major
                  Found in app/models/setup/converter.rb - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                    if (value = options[:value]).nil?
                                      obj.delete(property_name) unless options[:keep_values]
                                    else
                                      obj[property_name] = value
                                    end
                    Severity: Major
                    Found in app/models/setup/cross_collection_pull_parameter.rb - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                        enum = (limit ? model.limit(limit) : model.all).skip(offset).to_enum
                      Severity: Major
                      Found in app/models/setup/with_source_options.rb - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                          options[:object_ids] = enum.collect { |obj| obj.id.is_a?(BSON::ObjectId) ? obj.id.to_s : obj.id }
                        Severity: Major
                        Found in app/models/setup/with_source_options.rb - About 45 mins to fix

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

                              def start
                                return unless next_time
                                Setup::Task.where(scheduler: self).each do |task|
                                  task.retry(action: :scheduled) unless TaskToken.where(task_id: task.id).exists?
                                end
                          Severity: Minor
                          Found in app/models/setup/scheduler.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 method_missing has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                                def method_missing(symbol, *args)
                                  if CONFIG_FIELDS.any? { |field| "auth_#{field.pluralize}" == symbol.to_s }
                                    ivar = "@#{symbol}".to_sym
                                    instance_variable_set(ivar, args[0].stringify_keys) if args.length.positive?
                                    value = instance_variable_get(ivar) || {}
                          Severity: Minor
                          Found in app/models/setup/authorization.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 defined_types.include?(camelized_property_name) && !(property_spec['$ref'] || 'object'.eql?(property_spec['type']))
                                          raise Exception.new("'#{name.underscore}' already defines #{property_name} (use #/[definitions|properties]/#{property_name} instead)")
                                        end
                          Severity: Major
                          Found in app/models/setup/json_data_type.rb - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                            unless scope_evaluator.parameters.first.name == 'scope'
                                              errors.add(:scope_evaluator, "argument name should be 'scope'")
                                            end
                            Severity: Major
                            Found in app/models/setup/flow.rb - About 45 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language