serradura/u-case

View on GitHub

Showing 3 of 9 total issues

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

        def __call_use_case(use_case, attributes = nil)
          case use_case
          when Proc
            __call_proc(use_case, 'then(-> {})'.freeze)
          when Method
Severity: Minor
Found in lib/micro/case/result.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 map_use_cases has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def self.map_use_cases(args)
        collection = args.is_a?(Array) && args.size == 1 ? args[0] : args

        Array(collection).each_with_object([]) do |arg, memo|
          if arg.is_a?(Flow)
Severity: Minor
Found in lib/micro/cases/utils.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 symbolize_keys has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def self.symbolize_keys(hash)
      return hash.transform_keys { |key| key.to_sym rescue key } if hash_respond_to?(hash, :transform_keys)

      hash.each_with_object({}) do |(k, v), memo|
        key = k.to_sym rescue k
Severity: Minor
Found in lib/micro/case/utils.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