lib/oink/cli.rb

Summary

Maintainability
A
2 hrs
Test Coverage

Assignment Branch Condition size for process is too high. [41.82/20]
Open

    def process
      options = { :format => :short_summary, :type => :memory }

      op = OptionParser.new do |opts|
        opts.banner = "Usage: oink [options] files"
Severity: Minor
Found in lib/oink/cli.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Method process has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def process
      options = { :format => :short_summary, :type => :memory }

      op = OptionParser.new do |opts|
        opts.banner = "Usage: oink [options] files"
Severity: Minor
Found in lib/oink/cli.rb - About 1 hr to fix

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

        def process
          options = { :format => :short_summary, :type => :memory }
    
          op = OptionParser.new do |opts|
            opts.banner = "Usage: oink [options] files"
    Severity: Minor
    Found in lib/oink/cli.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 get_file_listing has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_file_listing(args)
          listing = []
          args.each do |file|
            unless File.exist?(file)
              raise "Could not find \"#{file}\""
    Severity: Minor
    Found in lib/oink/cli.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

    Unused block argument - v. You can omit the argument if you don't care about it.
    Open

            opts.on("-r", "--active-record", "Check for Active Record Threshold") do |v|
    Severity: Minor
    Found in lib/oink/cli.rb by rubocop

    This cop checks for unused block arguments.

    Example:

    # bad
    
    do_something do |used, unused|
      puts used
    end
    
    do_something do |bar|
      puts :foo
    end
    
    define_method(:foo) do |bar|
      puts :baz
    end

    Example:

    #good
    
    do_something do |used, _unused|
      puts used
    end
    
    do_something do
      puts :foo
    end
    
    define_method(:foo) do |_bar|
      puts :baz
    end

    Unused block argument - v. You can omit the argument if you don't care about it.
    Open

            opts.on("-m", "--memory", "Check for Memory Threshold (default)") do |v|
    Severity: Minor
    Found in lib/oink/cli.rb by rubocop

    This cop checks for unused block arguments.

    Example:

    # bad
    
    do_something do |used, unused|
      puts used
    end
    
    do_something do |bar|
      puts :foo
    end
    
    define_method(:foo) do |bar|
      puts :baz
    end

    Example:

    #good
    
    do_something do |used, _unused|
      puts used
    end
    
    do_something do
      puts :foo
    end
    
    define_method(:foo) do |_bar|
      puts :baz
    end

    There are no issues that match your filters.

    Category
    Status