whitequark/parser

View on GitHub

Showing 94 of 94 total issues

Method def_endless_singleton has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def def_endless_singleton(def_t, definee, dot_t,
                              name_t, args,
                              assignment_t, body)
Severity: Major
Found in lib/parser/builders/default.rb - About 50 mins to fix

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

        def initialize(lexer, str_type, delimiter, str_s, heredoc_e = nil,
                       indent = false, dedent_body = false, label_allowed = false)
          @lexer       = lexer
          @nesting     = 1
    
    
    Severity: Minor
    Found in lib/parser/lexer/literal.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 try has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def try(parser, ruby, file, show_ok: false)
        try_ruby = lambda do |e|
          Process.spawn(%{#{ruby} -c #{Shellwords.escape file}},
                        :err => '/dev/null', :out => '/dev/null')
          _, status = Process.wait2
    Severity: Minor
    Found in lib/gauntlet_parser.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 infer_indent_level has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def infer_indent_level(line)
          return if !@dedent_body
    
          indent_level = 0
          line.each_char do |char|
    Severity: Minor
    Found in lib/parser/lexer/literal.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 rescue_body_map has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def rescue_body_map(keyword_t, exc_list_e, assoc_t,
                            exc_var_e, then_t,
                            compstmt_e)
    Severity: Minor
    Found in lib/parser/builders/default.rb - About 45 mins to fix

      Method case_match has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def case_match(case_t, expr, in_bodies, else_t, else_body, end_t)
      Severity: Minor
      Found in lib/parser/builders/default.rb - About 45 mins to fix

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

            def block(method_call, begin_t, args, body, end_t)
              _receiver, _selector, *call_args = *method_call
        
              if method_call.type == :yield
                diagnostic :error, :block_given_to_yield, nil, method_call.loc.keyword, [loc(begin_t)]
        Severity: Minor
        Found in lib/parser/builders/default.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 initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

              def initialize(keyword_l, operator_l, name_l, end_l, assignment_l, body_l)
        Severity: Minor
        Found in lib/parser/source/map/method_definition.rb - About 45 mins to fix

          Method send_map has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def send_map(receiver_e, dot_t, selector_t, begin_t=nil, args=[], end_t=nil)
          Severity: Minor
          Found in lib/parser/builders/default.rb - About 45 mins to fix

            Method def_class has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def def_class(class_t, name,
                              lt_t, superclass,
                              body, end_t)
            Severity: Minor
            Found in lib/parser/builders/default.rb - About 45 mins to fix

              Method rescue_body has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def rescue_body(rescue_t,
                                  exc_list, assoc_t, exc_var,
                                  then_t, compound_stmt)
              Severity: Minor
              Found in lib/parser/builders/default.rb - About 45 mins to fix

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

                    def check_duplicate_args(args, map={})
                      args.each do |this_arg|
                        case this_arg.type
                        when :arg, :optarg, :restarg, :blockarg,
                             :kwarg, :kwoptarg, :kwrestarg,
                Severity: Minor
                Found in lib/parser/builders/default.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 call_method has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def call_method(receiver, dot_t, selector_t,
                                    lparen_t=nil, args=[], rparen_t=nil)
                Severity: Minor
                Found in lib/parser/builders/default.rb - About 45 mins to fix

                  Method begin_body has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def begin_body(compound_stmt, rescue_bodies=[],
                                     else_t=nil,    else_=nil,
                                     ensure_t=nil,  ensure_=nil)
                  Severity: Minor
                  Found in lib/parser/builders/default.rb - About 45 mins to fix

                    Method loop has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def loop(type, keyword_t, cond, do_t, body, end_t)
                    Severity: Minor
                    Found in lib/parser/builders/default.rb - About 45 mins to fix

                      Method case has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          def case(case_t, expr, when_bodies, else_t, else_body, end_t)
                      Severity: Minor
                      Found in lib/parser/builders/default.rb - About 45 mins to fix

                        Method ternary has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            def ternary(cond, question_t, if_true, colon_t, if_false)
                        Severity: Minor
                        Found in lib/parser/builders/default.rb - About 35 mins to fix

                          Method def_endless_method has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              def def_endless_method(def_t, name_t, args,
                                                     assignment_t, body)
                          Severity: Minor
                          Found in lib/parser/builders/default.rb - About 35 mins to fix

                            Method diagnostic has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                def diagnostic(type, reason, arguments, location, highlights=[])
                            Severity: Minor
                            Found in lib/parser/builders/default.rb - About 35 mins to fix

                              Method def_sclass has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                  def def_sclass(class_t, lshft_t, expr,
                                                 body, end_t)
                              Severity: Minor
                              Found in lib/parser/builders/default.rb - About 35 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language