pboling/gem_bench

View on GitHub

Showing 6 of 6 total issues

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

    def print
      string = ''
      if self.all.empty?
        string << nothing
      elsif self.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 23 (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 self.all.empty?
        string << nothing
      elsif self.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
          #   gems got checked, and which had nothing to check
    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 compare_gemfile has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def compare_gemfile
          self.benchers.each do |player|
            scout.gemfile_lines.each do |line|
              found = (line =~ player.gemfile_regex)
              if found
    Severity: Minor
    Found in lib/gem_bench/team.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 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