openjaf/cenit

View on GitHub

Showing 739 of 829 total issues

Method to_edi has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def to_edi(options = {})
        if orm_model.data_type.records_methods.any? { |alg| alg.name == 'to_edi' }
          return method_missing(:to_edi, options)
        end
        data = file.data
Severity: Minor
Found in lib/mongoff/grid_fs/file_formatter.rb - About 25 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_request_data has a Cognitive Complexity of 6 (exceeds 5 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 25 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_format has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def check_format(format, instance, _state, _data_type, _options, schema)
      if instance
        if schema['type'] == 'string'
          check_string_format(format, instance)
        end
Severity: Minor
Found in lib/mongoff/validator.rb - About 25 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 property_model has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def property_model(property)
        ((relation = try(:reflect_on_association, property)) && relation.try(:klass)) ||
          (@mongoff_models && @mongoff_models[property]) ||
          (superclass.is_a?(Mongoid::Document) && superclass.property_model(property)) || nil
      end
Severity: Minor
Found in lib/mongoid/cenit_extension.rb - About 25 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_html has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def to_html(content)
      case content
      when Array
        "<ul>\n" + content.collect { |value| "<li>\n" + to_html(value) + "\n</li>" }.join("\n") + '</ul>'
      when Hash
Severity: Minor
Found in lib/xsd/documentation.rb - About 25 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 storage_size has a Cognitive Complexity of 6 (exceeds 5 allowed). 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 - About 25 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 start_element has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def start_element(name, attributes = [])
      unless @xsd_tag
        @xsd_tag = 'http://www.w3.org/2001/XMLSchema'
        attr = attributes.detect { |attr| attr[0] =~ /\Axmlns:/ && attr[1] == 'http://www.w3.org/2001/XMLSchema' }
        if attr
Severity: Minor
Found in lib/xsd/document.rb - About 25 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_minProperties has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def check_minProperties(min, instance)
      if instance.is_a?(Mongoff::Record) || instance.is_a?(Hash)
        instance = instance.orm_model.stored_properties_on(instance) if instance.is_a?(Mongoff::Record)
        raise_path_less_error "has too few properties (#{instance.size} for #{min} min)" if instance.size < min
      end
Severity: Minor
Found in lib/mongoff/validator.rb - About 25 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 insert_or_update_file_stuff has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def insert_or_update_file_stuff(options = {})
        file_data_errors =
          if options[:valid_data]
            []
          else
Severity: Minor
Found in lib/mongoff/grid_fs/file_stuff.rb - About 25 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 property_for_attribute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def property_for_attribute(name)
        if property?(name)
          name
        else
          match = name.to_s.match(/\A(.+)(_id(s)?)\Z/)
Severity: Minor
Found in lib/mongoid/cenit_extension.rb - About 25 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 storage_size has a Cognitive Complexity of 6 (exceeds 5 allowed). 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 - About 25 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 property_for_attribute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def property_for_attribute(name)
      if property?(name)
        name
      else
        match = name.to_s.match(/\A(.+)(_id(s)?)\Z/)
Severity: Minor
Found in lib/mongoff/model.rb - About 25 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 fill_from has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def fill_from(data, options={})
      begin
        data = JSON.parse(data) unless data.is_a?(Hash)
        from_json(data, options)
      rescue
Severity: Minor
Found in lib/edi/filler.rb - About 25 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 sign_out_url has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def sign_out_url(return_to = nil)
      return_to = app_url(return_to) if return_to && URI.parse(return_to).relative?
      return_to ||= app_url(@action.path) if @action.http_method == :get
      sign_out_url = @controller.destroy_user_session_url(return_to: return_to)
      alg = algorithm(:sign_out_url, false)
Severity: Minor
Found in lib/cenit/control.rb - About 25 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 sign_in_url has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def sign_in_url(return_to = nil)
      return_to = app_url(return_to) if return_to && URI.parse(return_to).relative?
      return_to ||= app_url(@action.path) if @action.http_method == :get
      sign_in_url = @controller.new_user_session_url(return_to: return_to)
      alg = algorithm(:sign_in_url, false)
Severity: Minor
Found in lib/cenit/control.rb - About 25 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 stringfy has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def stringfy(obj)
        if obj.is_a?(Hash)
          hash = {}
          obj.each { |key, value| hash[key.to_s] = stringfy(value) }
          hash
Severity: Minor
Found in lib/cenit/utility.rb - About 25 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 hash_encode has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def hash_encode(value)
        {
          value:
            case value
            when Integer
Severity: Minor
Found in lib/cenit/xmlrpc.rb - About 25 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 app_url has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def app_url(path = nil, params = nil)
      query = params.is_a?(Hash) ? params.to_query() : params.to_s
      url = "#{Cenit.homepage}"
      url << "/app/#{@controller.request.params[:id_or_ns]}"
      url << "/#{path.gsub(/^\/+|\/+$/, '')}" unless path.blank?
Severity: Minor
Found in lib/cenit/control.rb - About 25 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 read_from_store has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def read_from_store(file, len)
        unless (store_io = file.instance_variable_get(:@_store_io))
          store_io = object(file) do |obj|
            if obj.exists?
              obj.get.body
Severity: Minor
Found in lib/cenit/file_store/aws_s3_default.rb - About 25 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