DamirSvrtan/fasterer

View on GitHub

Showing 10 of 10 total issues

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 traverse_sexp_tree has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def traverse_sexp_tree(sexp_tree)
      return unless sexp_tree.is_a?(Sexp)

      token = sexp_tree.first

Severity: Minor
Found in lib/fasterer/analyzer.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

Method scan_block_call_offense has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def scan_block_call_offense
      traverse_tree(method_definition.body) do |element|
        next unless element.sexp_type == :call

        method_call = MethodCall.new(element)
Severity: Minor
Found in lib/fasterer/scanners/method_definition_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.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.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 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

            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
              Severity
              Category
              Status
              Source
              Language