deivid-rodriguez/byebug

View on GitHub

Showing 40 of 40 total issues

Method enable_disable_breakpoints has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def enable_disable_breakpoints(is_enable, args)
        raise pr("toggle.errors.no_breakpoints") if Breakpoint.none?

        select_breakpoints(is_enable, args).each do |b|
          enabled = (is_enable == "enable")
Severity: Minor
Found in lib/byebug/helpers/toggle.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 find has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def find(shortcut)
        abbr = /^no/.match?(shortcut) ? shortcut[2..-1] : shortcut
        matches = settings.select do |key, value|
          key =~ (value.boolean? ? /#{abbr}/ : /#{shortcut}/)
        end
Severity: Minor
Found in lib/byebug/setting.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

Similar blocks of code found in 4 locations. Consider refactoring.
Open

module Byebug
  #
  # Reopens the +enable+ command to define the +display+ subcommand
  #
  class EnableCommand < Command
Severity: Major
Found in lib/byebug/commands/enable/display.rb and 3 other locations - About 30 mins to fix
lib/byebug/commands/disable/breakpoints.rb on lines 5..38
lib/byebug/commands/disable/display.rb on lines 5..39
lib/byebug/commands/enable/breakpoints.rb on lines 5..38

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 33.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

module Byebug
  #
  # Reopens the +disable+ command to define the +display+ subcommand
  #
  class DisableCommand < Command
Severity: Major
Found in lib/byebug/commands/disable/display.rb and 3 other locations - About 30 mins to fix
lib/byebug/commands/disable/breakpoints.rb on lines 5..38
lib/byebug/commands/enable/breakpoints.rb on lines 5..38
lib/byebug/commands/enable/display.rb on lines 5..39

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 33.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

module Byebug
  #
  # Reopens the +enable+ command to define the +breakpoints+ subcommand
  #
  class EnableCommand < Command
Severity: Major
Found in lib/byebug/commands/enable/breakpoints.rb and 3 other locations - About 30 mins to fix
lib/byebug/commands/disable/breakpoints.rb on lines 5..38
lib/byebug/commands/disable/display.rb on lines 5..39
lib/byebug/commands/enable/display.rb on lines 5..39

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 33.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

module Byebug
  #
  # Reopens the +disable+ command to define the +breakpoints+ subcommand
  #
  class DisableCommand < Command
Severity: Major
Found in lib/byebug/commands/disable/breakpoints.rb and 3 other locations - About 30 mins to fix
lib/byebug/commands/disable/display.rb on lines 5..39
lib/byebug/commands/enable/breakpoints.rb on lines 5..38
lib/byebug/commands/enable/display.rb on lines 5..39

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 33.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    module Byebug
      #
      # Reopens the +var+ command to define the +args+ subcommand
      #
      class VarCommand < Command
    Severity: Minor
    Found in lib/byebug/commands/var/args.rb and 1 other location - About 25 mins to fix
    lib/byebug/commands/var/local.rb on lines 5..35

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 29.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    module Byebug
      #
      # Reopens the +var+ command to define the +local+ subcommand
      #
      class VarCommand < Command
    Severity: Minor
    Found in lib/byebug/commands/var/local.rb and 1 other location - About 25 mins to fix
    lib/byebug/commands/var/args.rb on lines 5..35

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 29.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

    module Byebug
      #
      # Setting for automatically invoking Pry on every stop.
      #
      class AutoprySetting < Setting
    Severity: Minor
    Found in lib/byebug/settings/autopry.rb and 2 other locations - About 20 mins to fix
    lib/byebug/settings/autoirb.rb on lines 6..26
    lib/byebug/settings/autolist.rb on lines 6..26

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 27.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

    module Byebug
      #
      # Setting for automatically invoking IRB on every stop.
      #
      class AutoirbSetting < Setting
    Severity: Minor
    Found in lib/byebug/settings/autoirb.rb and 2 other locations - About 20 mins to fix
    lib/byebug/settings/autolist.rb on lines 6..26
    lib/byebug/settings/autopry.rb on lines 6..26

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 27.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

    module Byebug
      #
      # Setting for automatically listing source code on every stop.
      #
      class AutolistSetting < Setting
    Severity: Minor
    Found in lib/byebug/settings/autolist.rb and 2 other locations - About 20 mins to fix
    lib/byebug/settings/autoirb.rb on lines 6..26
    lib/byebug/settings/autopry.rb on lines 6..26

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 27.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Severity
    Category
    Status
    Source
    Language