tlopo-ruby/tfdsl

View on GitHub

Showing 4 of 6 total issues

Method to_json_repr has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    def to_json_repr(depth = 0)
      block = { 'tmp' => {} }

      ref = block['tmp']

Severity: Minor
Found in lib/tfdsl/block.rb - About 2 hrs 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_json_repr has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def to_json_repr(depth = 0)
      block = { 'tmp' => {} }

      ref = block['tmp']

Severity: Minor
Found in lib/tfdsl/block.rb - About 1 hr to fix

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

        def handle_list(input, level, _last, _parent_is_list)
          @sio << "[\n#{@indent * (level + 1)}"
          input.each_with_index do |e, i|
            if i == input.size - 1
              format e, level + 1, true, true
    Severity: Minor
    Found in lib/tfdsl/data_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 handle_hash has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def handle_hash(input, level, last, _parent_is_list)
          @sio << "{\n"
          input.each_with_index do |e, i|
            k, v = e
            @sio << "#{@indent * (level + 1)}#{k} = "
    Severity: Minor
    Found in lib/tfdsl/data_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

    Severity
    Category
    Status
    Source
    Language