openjaf/cenit

View on GitHub

Showing 829 of 829 total issues

Method output_method has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def output_method(xml_doc = code)
      xml_doc ||= code
      xml_doc = Nokogiri::XML(xml_doc) unless xml_doc.is_a?(Nokogiri::XML::Document)
      xsl_prefix = xml_doc.root.namespace.prefix
      if (e = xml_doc.xpath("//#{xsl_prefix}:output").first) && (e = e.attribute('method'))
Severity: Minor
Found in app/models/setup/xslt_template_common.rb - About 55 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 run has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def run(message)
      if (webhook = Setup::Webhook.where(id: (webhook_id = message[:webhook_id])).first)
        if (connection = Setup::Connection.where(id: (connection_id = message[:connection_id])).first)
          auth = nil
          if (auth_id = message[:authorization_id]).present? &&
Severity: Minor
Found in app/models/setup/submission.rb - About 55 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 mapping= has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def mapping=(data)
      unless data.is_a?(Hash)
        data =
          if data.is_a?(String)
            JSON.parse(data)
Severity: Minor
Found in app/models/setup/mapping_converter.rb - About 55 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 run has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def run(message)
      collection = Setup::Collection.find(message['collection_id'])
      if collection.destroy
        not_destroyed = []
        Setup::Collection.reflect_on_all_associations(:has_and_belongs_to_many).each do |relation|
Severity: Minor
Found in app/models/setup/collection_shredding.rb - About 55 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_parameters has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def validate_parameters
      not_required = false
      parameters.each do |p|
        next unless not_required ||= !p.required
        p.errors.add(:required, 'marked as "Required" must come before non marked') if p.required
Severity: Minor
Found in app/models/setup/algorithm.rb - About 55 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_code has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def parse_code
      if language == :auto
        logs = {}
        lang = self.class.language_enum.values.detect do |language|
          next if language == :auto
Severity: Minor
Found in app/models/setup/algorithm.rb - About 55 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 has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def check
      errors.add(:callback_resolver, "can't be blank") unless callback_resolver
      %w(callback_resolver parameters_signer).each do |relation|
        next unless (alg = send(relation))
        errors.add(relation.to_sym, " must have two parameters") unless alg.parameters.size == 2
Severity: Minor
Found in app/models/setup/generic_callback_authorization.rb - About 55 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 selector_from has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def selector_from(message)
      if (selector = message[:selector])
        if selector.is_a?(Hash) || selector.is_a?(Array)
          selector
        else
Severity: Minor
Found in app/models/setup/flow.rb - About 55 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 9 (exceeds 5 allowed). Consider refactoring.
Open

    def method_missing(symbol, *args, &block)
      method =
        if symbol == :del
          :delete
        elsif symbol == :del!
Severity: Minor
Found in app/models/setup/resource.rb - About 55 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 run has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def run(message)
      each_entry do |entry_name, spec|
        url = base_url.blank? ? entry_name : "#{base_url}/#{entry_name}"
        if (api_spec = Setup::ApiSpec.create(url: url, specification: spec)).errors.blank?
          if api_spec.title.blank?
Severity: Minor
Found in app/models/setup/api_spec_import.rb - About 55 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 post_digest has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def post_digest(request, _options = {})
      hash = input = JSON.parse(request.body.read)
      if input.is_a?(Array)
        hash = parameters.map { |p, index| [p.name, input[index]] }
      else
Severity: Minor
Found in app/controllers/api/v3/api_controller.rb - About 55 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 new_from_json has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def new_from_json(json_or_readable, options = {})
      if data_type_methods.any? { |alg| alg.name == 'new_from_json' }
        return method_missing(:new_from_json, json_or_readable, options)
      end
      if options[:data_type_parser]
Severity: Minor
Found in app/models/setup/file_data_type.rb - About 55 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 post_digest has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def post_digest(request, _options = {})
    hash = input = JSON.parse(request.body.read)
    if input.is_a?(Array)
      hash = parameters.map { |p, index| [p.name, input[index]] }
    else
Severity: Minor
Found in app/controllers/api/v3/api_controller.rb - About 55 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 authorize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def authorize
      if (auth = @item).is_a?(Setup::Oauth2Authorization)
        if (redirect_uri = params[:redirect_uri])
          if auth.check
            cenit_token = CallbackAuthorizationToken.create(authorization: auth, data: { redirect_uri: redirect_uri })
Severity: Minor
Found in app/controllers/api/v2/api_controller.rb - About 55 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 9 (exceeds 5 allowed). Consider refactoring.
Open

      def method_missing(symbol, *args)
        if !symbol.to_s.end_with?('=') && ((args.length.zero? && block_given?) || args.length == 1 && !block_given?)
          self[symbol] = block_given? ? yield : args[0]
        elsif args.length.zero? && !block_given?
          self[symbol]
Severity: Minor
Found in lib/mongoff/model.rb - About 55 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 submodel_of? has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def submodel_of?(model)
      return true if eql?(model) || (@base_model && @base_model.submodel_of?(model))
      base_model =
        if (base_data_type = data_type.find_data_type(data_type.schema['extends']))
          Model.for(data_type: base_data_type, cache: caching?)
Severity: Minor
Found in lib/mongoff/model.rb - About 55 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 attribute_key has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def attribute_key(field, field_metadata = {})
      field_metadata[:model] ||= property_model(field)
      model = field_metadata[:model]
      if model&.persistable? && (schema = (field_metadata[:schema] ||= property_schema(field)))['referenced']
        ((schema['type'] == 'array') ? field.to_s.singularize + '_ids' : "#{field}_id").to_sym
Severity: Minor
Found in lib/mongoff/model.rb - About 55 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_json_schema has a Cognitive Complexity of 9 (exceeds 5 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 55 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 show has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def show
      if @item.orm_model.data_type.is_a?(Setup::FileDataType)
        send_data @item.data, filename: @item[:filename], type: @item[:contentType]
      else
        option = {}
Severity: Minor
Found in app/controllers/api/v1/api_controller.rb - About 55 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_edi has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def parse_edi(data_type, content, options = {}, record = nil)
        start = options[:start] || 0
        content = content.gsub("\r", '')
        segment_sep = "\n" if (segment_sep = options[:segment_separator]) == :new_line
        raise Exception.new("Record model #{record.orm_model} does not match data type model#{data_type.orm_model}") unless record.nil? || record.orm_model == data_type.records_model
Severity: Minor
Found in lib/edi/parser.rb - About 55 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