openjaf/cenit

View on GitHub

Showing 829 of 829 total issues

Method new_from has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def new_from(string_or_readable, options = {})
      if options[:data_type_parser]
        super
      else
        options.reverse_merge!(default_attributes)
Severity: Minor
Found in app/models/setup/file_data_type.rb - About 35 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 index has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def index
    content = @app_action.run(@app_control)
    render plain: content if @app_control && !@app_control.done?
  rescue Exception => ex
    Setup::SystemNotification.create_from(ex, "Handling action #{@app.custom_title} -> #{@app_action}")
Severity: Minor
Found in app/controllers/app_controller.rb - About 35 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 set_not_new_record has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def set_not_new_record
      return unless new_record?
      self.new_record = false
      @fields.each do |field, value|
        next unless value && (association = orm_model.associations[field]) && association.nested?
Severity: Minor
Found in lib/mongoff/record.rb - About 35 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 qualify has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def qualify(name)
      ns = (i = name.rindex(':')) ? xmlns(name[0..i-1]) : xmlns(:default)
      if ns.blank?
        name
      else
Severity: Minor
Found in lib/xsd/basic_tag.rb - About 35 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 check_maximum has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def check_maximum(maximum, instance, _state, _data_type, _options, schema)
      if instance.is_a?(Numeric)
        if schema['exclusiveMaximum'].is_a?(TrueClass)
          raise_path_less_error "must be strictly less than #{maximum}" if instance >= maximum
        else
Severity: Minor
Found in lib/mongoff/validator.rb - About 35 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 save has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def save(options = {})
      instance_variable_set(:@discard_event_lookup, true) if options && options[:discard_events]
      super
    rescue Exception => ex
      report = Setup::SystemReport.create_from(ex)
Severity: Minor
Found in lib/mongoid/cenit_extension.rb - About 35 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 each_root has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def each_root(&block)
        if (roots = Nokogiri::XML::DocumentFragment.parse(config[:message]).element_children)
          roots.each do |root|
            if (elements = root.element_children)
              elements.each { |e| block.call(root.name, e) }
Severity: Minor
Found in app/controllers/api/v1/api_controller.rb - About 35 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 before_save_callbacks has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def before_save_callbacks
      success = true
      if (data_type = (model = orm_model).data_type).records_model == model
        data_type.before_save_callbacks.each do |callback|
          next unless success
Severity: Minor
Found in lib/mongoff/record.rb - About 35 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 pull has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def pull
      if @item.is_a?(Setup::CrossSharedCollection)
        begin
          pull_request = @webhook_body.present? ? JSON.parse(@webhook_body) : {}
          render json: @item.pull(pull_request).to_json
Severity: Minor
Found in app/controllers/api/v1/api_controller.rb - About 35 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 initialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def initialize(data_type, options = {})
      @data_type_id =
        if data_type.is_a?(Setup::BuildInDataType) || options[:cache] || !data_type.persisted?
          data_type
        else
Severity: Minor
Found in lib/mongoff/model.rb - About 35 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 initialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def initialize(model, attributes = nil, new_record = true)
      @orm_model = model
      @document = BSON::Document.new
      @fields = {}
      @new_record = new_record || false
Severity: Minor
Found in lib/mongoff/record.rb - About 35 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 parse_json has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def parse_json(data_type, content, options = {}, record = nil, model = nil)
        content = JSON.parse(content) unless content.is_a?(Hash)
        process_options(options)
        do_parse_json(data_type, model || record&.orm_model || data_type.records_model, content.with_indifferent_access, options, (record && record.orm_model.schema) || (model && model.schema) || data_type.merged_schema, nil, record)
      end
Severity: Minor
Found in lib/edi/parser.rb - About 35 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 validate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def validate(record)
        return unless assertion = options[:assertion]
        assertion = assertion.with_indifferent_access
        if condition_if = eval_condition(record, assertion[:if])
          if error = assertion[:then_error]
Severity: Minor
Found in lib/mongoid/validatable/assertion_validator.rb - About 35 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 after_save_callbacks has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def after_save_callbacks
      success = true
      if (data_type = (model = orm_model).data_type).records_model == model
        data_type.after_save_callbacks.each do |callback|
          next unless success
Severity: Minor
Found in lib/mongoff/record.rb - About 35 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 check_minimum has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def check_minimum(minimum, instance, _state, _data_type, _options, schema)
      if instance.is_a?(Numeric)
        if schema['exclusiveMinimum'].is_a?(TrueClass)
          raise_path_less_error "must be strictly greater than #{minimum}" if instance <= minimum
        else
Severity: Minor
Found in lib/mongoff/validator.rb - About 35 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 each has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def each(*args, &blk)
      query.each do |document|
        m =
          if (type = document['_type'])
            model.for(name: type)
Severity: Minor
Found in lib/mongoff/criteria.rb - About 35 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 to_s has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def to_s
      if orm_model
        case (template = orm_model.label_template)
        when String
          template
Severity: Minor
Found in lib/mongoff/record.rb - About 35 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 to_params has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def to_params(options = {})
    unsafe = options[:unsafe]
    sort.map do |k, values|
      if values.is_a?(Array)
        values << nil if values.empty?
Severity: Minor
Found in lib/edi/formater.rb - About 35 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 bundle has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def bundle(symbol, algorithm)
        method =
          begin
            interpreter.method(symbol)
          rescue
Severity: Minor
Found in lib/cenit/bundler_interpreter.rb - About 35 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 parse_method_response has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def parse_method_response(xml)
      parsing_xml = Encoder.hash_decode(Hash.from_xml(xml))
      fail 'No valid method response!' if parsing_xml['methodName']
      parsing_xml = parsing_xml['methodResponse']
      if parsing_xml['fault']
Severity: Minor
Found in lib/cenit/xmlrpc.rb - About 35 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

Severity
Category
Status
Source
Language