openjaf/cenit

View on GitHub

Showing 829 of 829 total issues

Method format_triggers_on has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def format_triggers_on(field, required = false)
      begin
        send("#{field}=", json = send(field).gsub('=>', ':'))
        hash = JSON.parse(json)
        hash.delete('_')
Severity: Minor
Found in app/models/setup/triggers_formatter.rb - About 1 hr to fix

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

        def run(message)
          parser_options = (message['parser_options'] || {}).dup.with_indifferent_access
          parser_options[:create_callback] = -> model {
            unless authorize_action(action: :create, klass: model)
              fail "Not authorized to create records of type #{model}"
    Severity: Minor
    Found in app/models/setup/asynchronous_persistence.rb - About 1 hr to fix

      Method write_attribute has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def write_attribute(name, value)
            if name.to_s == 'map_attributes'
              value.delete('_type')
              value.delete(:_type)
              value.each do |k, v|
      Severity: Minor
      Found in app/models/setup/mapping_converter.rb - About 1 hr to fix

        Method parameters has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def parameters(*relation_names)
                relation_names = relation_names.collect(&:to_s)
                @parameters_relations_names = [parameters_relations_names, relation_names].flatten.compact
                relation_names.each do |relation_name|
                  inverse_name = "#{relation_name}_#{to_s.split('::').last.underscore}"
        Severity: Minor
        Found in app/models/concerns/setup/parameters.rb - About 1 hr to fix

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

              def to_json_schema
                return documenting(qualify_element(ref).to_json_schema) if ref
                json_schema =
                  {
                    'title' => name.to_title,
          Severity: Minor
          Found in lib/xsd/element.rb - About 1 hr to fix

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

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

                Method run has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    def run(message)
                      if (translator = agent_from_msg)
                        unless message[:options].is_a?(Hash)
                          begin
                            message[:options] = self.class.parse_options(message[:options].to_s)
                Severity: Minor
                Found in app/models/concerns/setup/translation_common.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 check_authorization has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    def check_authorization
                      if using_authorization.present?
                        field = authorization_handler ? :template_parameters : :headers
                        auth_params = using_authorization.class.send("auth_#{field}")
                        conflicting_keys = send(field).select { |p| auth_params.key?(p.key) }.collect(&:key)
                Severity: Minor
                Found in app/models/concerns/setup/authorization_handler.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 format_triggers_on has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    def format_triggers_on(field, required = false)
                      begin
                        send("#{field}=", json = send(field).gsub('=>', ':'))
                        hash = JSON.parse(json)
                        hash.delete('_')
                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 init! has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                      def init!
                        do_configure = where(origin: :cenit).empty?
                
                        Setup::BuildInDataType.each { |dt| dt.db_data_type(true) }
                
                
                Severity: Minor
                Found in app/models/setup/cenit_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 run has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    def run(options = {})
                      context_options = try("context_options_for_#{type.to_s.downcase}", options) || {}
                      self.class.fields.keys.each { |key| context_options[key.to_sym] = send(key) }
                      self.class.relations.keys.each { |key| context_options[key.to_sym] = send(key) }
                      context_options[:data_type] = data_type
                Severity: Minor
                Found in app/models/setup/legacy_translator.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 new_from has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    def new_from(data, options = {})
                      json_data = (data.is_a?(Hash) && data) ||
                        begin
                          JSON.parse(data)
                        rescue
                Severity: Minor
                Found in app/models/setup/common_parser.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 schema has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    def schema
                      sch =
                        if type.blank?
                          {}
                        elsif %w(integer number boolean string object).include?(type)
                Severity: Minor
                Found in app/models/setup/algorithm_parameter.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 finish has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    def finish(status, message, message_type, time)
                      self.status = status
                      thread_token.destroy if thread_token.present?
                      self.thread_token = nil
                      Thread.current[:task_token] = nil
                Severity: Minor
                Found in app/models/setup/task.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 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    def validates_configuration
                      if mime_type.present?
                        if (extensions = file_extension_enum).empty?
                          remove_attribute(:file_extension)
                        elsif file_extension.blank?
                Severity: Minor
                Found in app/models/setup/template.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 verify_triggers has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    def verify_triggers
                      if changed_attributes.key?('triggers')
                        self.trigger_evaluator = nil unless changed_attributes.key?('trigger_evaluator_id') && trigger_evaluator
                      elsif changed_attributes.key?('trigger_evaluator_id')
                        self.triggers = nil unless changed_attributes.key?('triggers') && triggers.present?
                Severity: Minor
                Found in app/models/setup/observer.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 format_triggers has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    def format_triggers
                      if data_type.blank?
                        errors.add(:data_type, "can't be blank")
                      elsif triggers.present? && trigger_evaluator.present?
                        errors.add(:base, 'Can not define both triggers and evaluator')
                Severity: Minor
                Found in app/models/setup/observer.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_retry has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    def get_digest_retry(_request, _options = {})
                      if (execution = self.retry)
                        if execution.is_a?(Setup::SystemNotification)
                          fail execution.message
                        end
                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_reinstall has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    def get_digest_reinstall(_request, _options = {})
                      if User.current_super_admin?
                        execution = ::Setup::BuildInAppReinstall.process(
                          build_in_app_id: id,
                          task_description: "Re-installing build-in app #{app_module_name}"
                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

                Severity
                Category
                Status
                Source
                Language