cvut/kosapi_client.rb

View on GitHub

Showing 5 of 7 total issues

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

        def set_mapped_attribute(instance, name, source_hash, mapping_options)
          namespace = mapping_options[:namespace]
          src_element = mapping_options[:element] || name
          if namespace
            key = "#{namespace}_#{src_element}".to_sym
Severity: Minor
Found in lib/kosapi_client/entity/data_mappings.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 deep_transform_hash_keys has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def self.deep_transform_hash_keys(item, &block)
      return item unless item.is_a?(Hash)
      copy = {}
      item.each do |key, value|
        new_value = deep_transform_hash_keys(value, &block) if value.is_a? Hash
Severity: Minor
Found in lib/kosapi_client/hash_utils.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 delegate_to_builder has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def delegate_to_builder(method, *args, &block)
        if @request_builder.respond_to?(method)
          res = @request_builder.send(method, *args, &block)
          if res.equal?(@request_builder)
            self
Severity: Minor
Found in lib/kosapi_client/request_builder_delegator.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 delegate_to_builder has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def delegate_to_builder(method, *args, **kwargs, &block)
        if @request_builder.respond_to?(method)
          res = @request_builder.send(method, *args, **kwargs, &block)
          if res.equal?(@request_builder)
            self
Severity: Minor
Found in lib/kosapi_client/request_builder_delegator.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 merge_contents has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def merge_contents(hash)
      entries = if hash[:atom_feed]
        hash[:atom_feed][:atom_entry]
      else
        [hash[:atom_entry]]
Severity: Minor
Found in lib/kosapi_client/response_preprocessor.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