pboling/gem_bench

View on GitHub

Showing 8 of 8 total issues

Method print has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    def print
      string = ""
      if all.empty?
        string << nothing
      elsif starters.empty?
Severity: Minor
Found in lib/gem_bench/team.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 initialize has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    def initialize(options = {})
      @look_for_regex = options[:look_for_regex]
      # find: Find gems containing specific strings in code
      # bench: Find gems that can probably be benched (require: false) in the Gemfile
      @check_type = @look_for_regex ? :find : :bench
Severity: Minor
Found in lib/gem_bench/team.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

Method print has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def print
      string = ""
      if all.empty?
        string << nothing
      elsif starters.empty?
Severity: Major
Found in lib/gem_bench/team.rb - About 2 hrs to fix

    Method set_starter has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def set_starter(file_path, line_match: nil)
          return false if file_path =~ exclude_file_pattern
    
          # Some gems may have zero files to check, as they may be using gem as a
          #   delivery system for shell scripts!  As such we need to check which
    Severity: Minor
    Found in lib/gem_bench/player.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 initialize has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def initialize(options = {})
          @look_for_regex = options[:look_for_regex]
          # find: Find gems containing specific strings in code
          # bench: Find gems that can probably be benched (require: false) in the Gemfile
          @check_type = @look_for_regex ? :find : :bench
    Severity: Minor
    Found in lib/gem_bench/team.rb - About 1 hr to fix

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

          def compare_gemfile
            benchers.each do |player|
              scout.gemfile_lines.each do |line|
                found = (line =~ player.gemfile_regex)
                next unless found
      Severity: Minor
      Found in lib/gem_bench/team.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 set_starter has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def set_starter(file_path, line_match: nil)
            return false if file_path =~ exclude_file_pattern
      
            # Some gems may have zero files to check, as they may be using gem as a
            #   delivery system for shell scripts!  As such we need to check which
      Severity: Minor
      Found in lib/gem_bench/player.rb - About 1 hr to fix

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

            def initialize(name, version, version_type, valid, relevant_lines, index, tokenized_line = nil)
        Severity: Major
        Found in lib/gem_bench/strict_version_gem.rb - About 50 mins to fix
          Severity
          Category
          Status
          Source
          Language