jaredbeck/sexp2ruby

View on GitHub

Showing 21 of 21 total issues

Method to_s has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

      def to_s(exp)
        expand = ASSIGN_NODES.include? exp.first.first
        c = process exp.shift
        t = process exp.shift
        f = process exp.shift
Severity: Minor
Found in lib/sexp2ruby/node/if.rb - About 4 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_s has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

      def to_s(exp)
        receiver_node_type = exp.first.nil? ? nil : exp.first.first
        receiver = process exp.shift
        receiver = "(#{receiver})" if ASSIGN_NODES.include? receiver_node_type

Severity: Minor
Found in lib/sexp2ruby/node/call.rb - About 3 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

File processor.rb has 287 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'sexp_processor'

module Sexp2Ruby

  # Generate ruby code from a sexp.
Severity: Minor
Found in lib/sexp2ruby/processor.rb - About 2 hrs to fix

    Method to_s has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

          def to_s(exp)
            type1 = exp[1].first
            type2 = exp[2].first rescue nil
            expect = [:ivar, :iasgn, :attrset]
    
    
    Severity: Minor
    Found in lib/sexp2ruby/node/defn.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_s has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

          def to_s(exp)
            case exp.first
            when Sexp then
              lhs = exp.shift
              rhs = exp.empty? ? nil : exp.shift
    Severity: Minor
    Found in lib/sexp2ruby/node/masgn.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_s has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def to_s(exp)
            type1 = exp[1].first
            type2 = exp[2].first rescue nil
            expect = [:ivar, :iasgn, :attrset]
    
    
    Severity: Minor
    Found in lib/sexp2ruby/node/defn.rb - About 1 hr to fix

      Method to_s has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def to_s(exp)
              receiver_node_type = exp.first.nil? ? nil : exp.first.first
              receiver = process exp.shift
              receiver = "(#{receiver})" if ASSIGN_NODES.include? receiver_node_type
      
      
      Severity: Minor
      Found in lib/sexp2ruby/node/call.rb - About 1 hr to fix

        Method to_s has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

              def to_s(exp)
                result = []
        
                until exp.empty?
                  s = exp.shift
        Severity: Minor
        Found in lib/sexp2ruby/node/hash.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 to_s has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

              def to_s(exp)
                body = process(exp.shift) unless exp.first.first == :resbody
                els  = process(exp.pop)   unless exp.last.first  == :resbody
        
                body ||= "# do nothing"
        Severity: Minor
        Found in lib/sexp2ruby/node/rescue.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 to_s has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def to_s(exp)
                call_sexp = exp.shift
        
                # Process the `Call`. The Sexp is not consumed here (it is cloned)
                # because we will need to refer to it later, when determining which
        Severity: Minor
        Found in lib/sexp2ruby/node/iter.rb - About 1 hr to fix

          Method to_s has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def to_s(exp)
                  case exp.first
                  when Sexp then
                    lhs = exp.shift
                    rhs = exp.empty? ? nil : exp.shift
          Severity: Minor
          Found in lib/sexp2ruby/node/masgn.rb - About 1 hr to fix

            Method util_module_or_class has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                def util_module_or_class(exp, is_class=false)
                  result = []
            
                  name = exp.shift
                  name = process name if Sexp === name
            Severity: Minor
            Found in lib/sexp2ruby/processor.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 to_s has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def to_s(exp)
                    expand = ASSIGN_NODES.include? exp.first.first
                    c = process exp.shift
                    t = process exp.shift
                    f = process exp.shift
            Severity: Minor
            Found in lib/sexp2ruby/node/if.rb - About 1 hr to fix

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

                    def to_s(exp)
                      result = []
                      expr = process exp.shift
                      if expr
                        result << "case #{expr}"
              Severity: Minor
              Found in lib/sexp2ruby/node/case.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 to_s has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                    def to_s(exp)
                      call_sexp = exp.shift
              
                      # Process the `Call`. The Sexp is not consumed here (it is cloned)
                      # because we will need to refer to it later, when determining which
              Severity: Minor
              Found in lib/sexp2ruby/node/iter.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 to_s has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                    def to_s(exp)
                      result = []
              
                      exp << nil if exp.empty?
                      until exp.empty? do
              Severity: Minor
              Found in lib/sexp2ruby/node/block.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 to_s has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                    def to_s(exp)
                      receiver = process exp.shift
                      name = exp.shift
                      rhs  = exp.pop
                      args = s(:array, *exp)
              Severity: Minor
              Found in lib/sexp2ruby/node/attrasgn.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 rewrite_rescue has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def rewrite_rescue exp
                    complex = false
                    complex ||= exp.size > 3
                    complex ||= exp.resbody.block
                    complex ||= exp.resbody.size > 3
              Severity: Minor
              Found in lib/sexp2ruby/processor.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 cond_loop has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def cond_loop(exp, name)
                    cond = process(exp.shift)
                    body = process(exp.shift)
                    head_controlled = exp.shift
              
              
              Severity: Minor
              Found in lib/sexp2ruby/processor.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 util_dthing has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def util_dthing(type, exp)
                    s = []
              
                    # first item in sexp is a string literal
                    s << dthing_escape(type, exp.shift)
              Severity: Minor
              Found in lib/sexp2ruby/processor.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