deivid-rodriguez/byebug

View on GitHub

Showing 29 of 40 total issues

Avoid too many return statements within this method.
Open

      return errmsg(pr("break.errors.not_changed", expr: @match[2])) unless syntax_valid?(@match[2])
Severity: Major
Found in lib/byebug/commands/condition.rb - About 30 mins to fix

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

        def execute
          file, line = location(@match[1])
          return edit_error("not_exist", file) unless File.exist?(file)
          return edit_error("not_readable", file) unless File.readable?(file)
    
    
    Severity: Minor
    Found in lib/byebug/commands/edit.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 get_int has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def get_int(str, cmd, min = nil, max = nil)
            return nil, pr("parse.errors.int.not_number", cmd: cmd, str: str) unless /\A-?[0-9]+\z/.match?(str)
    
            int = str.to_i
            if min && int < min
    Severity: Minor
    Found in lib/byebug/helpers/parse.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 readline has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def readline(*)
          while (result = input.gets)
            output.puts "+ #{result}" if @verbose
            next if /^\s*#/.match?(result)
    
    
    Severity: Minor
    Found in lib/byebug/interfaces/script_interface.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 repl has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def repl
          until @proceed
            cmd = interface.read_command(prompt)
            return if cmd.nil?
    
    
    Severity: Minor
    Found in lib/byebug/processors/command_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

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

          def enable_disable_display(is_enable, args)
            raise pr("toggle.errors.no_display") if n_displays.zero?
    
            selected_displays = args ? args.split(/ +/) : [1..n_displays + 1]
    
    
    Severity: Minor
    Found in lib/byebug/helpers/toggle.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 location has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def location(matched)
          if matched.nil?
            file = frame.file
            return errmsg(pr("edit.errors.state")) unless file
    
    
    Severity: Minor
    Found in lib/byebug/commands/edit.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 execute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def execute
          b = line_breakpoint(frame.line.to_s) unless @match[1]
    
          b ||= line_breakpoint(@match[1]) || method_breakpoint(@match[1])
          return errmsg(pr("break.errors.location")) unless b
    Severity: Minor
    Found in lib/byebug/commands/break.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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def run
          Byebug.mode = :standalone
    
          option_parser.order!($ARGV)
          return if non_script_option? || error_in_script?
    Severity: Minor
    Found in lib/byebug/runner.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