pboling/gem_bench

View on GitHub

Showing 11 of 11 total issues

Method doff_and_don has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Open

    def doff_and_don(&block)
      return puts "[#{gem_name}] Skipped (not loaded on #{RUBY_VERSION})" unless gem_path

      puts "[#{gem_name}] Doffing #{gem_path}" if verbose
      Dir.mktmpdir do |tmp_dir|
Severity: Minor
Found in lib/gem_bench/jersey.rb - About 5 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 a Cognitive Complexity of 25 (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 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 initialize has a Cognitive Complexity of 21 (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 2 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 54 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 doff_and_don has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def doff_and_don(&block)
          return puts "[#{gem_name}] Skipped (not loaded on #{RUBY_VERSION})" unless gem_path
    
          puts "[#{gem_name}] Doffing #{gem_path}" if verbose
          Dir.mktmpdir do |tmp_dir|
    Severity: Minor
    Found in lib/gem_bench/jersey.rb - About 1 hr to fix

      Method initialize has 31 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 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

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

              def create_tempfile_copy(orig_file_path, tmp_dir, basename, debug_info, &block)
          Severity: Minor
          Found in lib/gem_bench/jersey.rb - About 35 mins to fix

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

                def initialize(all_lines, line, index)
                  @line = line.strip
                  @is_gem = self.line.match(GEM_REGEX)
                  if is_gem
                    @all_lines = all_lines
            Severity: Minor
            Found in lib/gem_bench/gemfile_line_tokenizer.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 set_starter has a Cognitive Complexity of 6 (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 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