DamirSvrtan/fasterer

View on GitHub
lib/fasterer/scanners/method_call_scanner.rb

Summary

Maintainability
B
5 hrs
Test Coverage

Method check_symbol_to_proc has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def check_symbol_to_proc
      return unless method_call.block_argument_names.count == 1
      return if method_call.block_body.nil?
      return unless method_call.block_body.sexp_type == :call
      return if method_call.arguments.count > 0
Severity: Minor
Found in lib/fasterer/scanners/method_call_scanner.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 check_first_offense has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def check_first_offense
      return method_call unless method_call.receiver.is_a?(MethodCall)

      case method_call.receiver.name
      when :shuffle
Severity: Minor
Found in lib/fasterer/scanners/method_call_scanner.rb - About 45 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

Avoid too many return statements within this method.
Open

      return unless body_method_call.arguments.count.zero?
Severity: Major
Found in lib/fasterer/scanners/method_call_scanner.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

          return if body_method_call.receiver.name != method_call.block_argument_names.first
    Severity: Major
    Found in lib/fasterer/scanners/method_call_scanner.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

            return if body_method_call.has_block?
      Severity: Major
      Found in lib/fasterer/scanners/method_call_scanner.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

              return if body_method_call.receiver.is_a?(Fasterer::Primitive)
        Severity: Major
        Found in lib/fasterer/scanners/method_call_scanner.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                return if method_call.lambda_literal?
          Severity: Major
          Found in lib/fasterer/scanners/method_call_scanner.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                  return if body_method_call.receiver.nil?
            Severity: Major
            Found in lib/fasterer/scanners/method_call_scanner.rb - About 30 mins to fix

              There are no issues that match your filters.

              Category
              Status