Cimpress-MCP/zanzibar

View on GitHub
lib/zanzibar/client.rb

Summary

Maintainability
A
35 mins
Test Coverage

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

    def initialize(username, password, domain, wsdl, globals = {})
Severity: Minor
Found in lib/zanzibar/client.rb - About 35 mins to fix

    Avoid rescuing without specifying an error class.
    Open

          rescue => e
    Severity: Minor
    Found in lib/zanzibar/client.rb by rubocop

    This cop checks for rescuing StandardError. There are two supported styles implicit and explicit. This cop will not register an offense if any error other than StandardError is specified.

    Example: EnforcedStyle: implicit

    # `implicit` will enforce using `rescue` instead of
    # `rescue StandardError`.
    
    # bad
    begin
      foo
    rescue StandardError
      bar
    end
    
    # good
    begin
      foo
    rescue
      bar
    end
    
    # good
    begin
      foo
    rescue OtherError
      bar
    end
    
    # good
    begin
      foo
    rescue StandardError, SecurityError
      bar
    end

    Example: EnforcedStyle: explicit (default)

    # `explicit` will enforce using `rescue StandardError`
    # instead of `rescue`.
    
    # bad
    begin
      foo
    rescue
      bar
    end
    
    # good
    begin
      foo
    rescue StandardError
      bar
    end
    
    # good
    begin
      foo
    rescue OtherError
      bar
    end
    
    # good
    begin
      foo
    rescue StandardError, SecurityError
      bar
    end

    Use the double pipe equals operator ||= instead.
    Open

          token = generate_token unless token
    Severity: Minor
    Found in lib/zanzibar/client.rb by rubocop

    This cop checks for potential usage of the ||= operator.

    Example:

    # bad
    name = name ? name : 'Bozhidar'
    
    # bad
    name = if name
             name
           else
             'Bozhidar'
           end
    
    # bad
    unless name
      name = 'Bozhidar'
    end
    
    # bad
    name = 'Bozhidar' unless name
    
    # good - set name to 'Bozhidar', only if it's nil or false
    name ||= 'Bozhidar'

    Extra empty line detected after the rescue.
    Open

    
            raise "Unknown type, #{type}. #{e}"
    Severity: Minor
    Found in lib/zanzibar/client.rb by rubocop

    This cops checks if empty lines exist around the bodies of begin sections. This cop doesn't check empty lines at begin body beginning/end and around method definition body. Style/EmptyLinesAroundBeginBody or Style/EmptyLinesAroundMethodBody can be used for this purpose.

    Example:

    # good
    
    begin
      do_something
    rescue
      do_something2
    else
      do_something3
    ensure
      do_something4
    end
    
    # good
    
    def foo
      do_something
    rescue
      do_something2
    end
    
    # bad
    
    begin
      do_something
    
    rescue
    
      do_something2
    
    else
    
      do_something3
    
    ensure
    
      do_something4
    end
    
    # bad
    
    def foo
      do_something
    
    rescue
    
      do_something2
    end

    There are no issues that match your filters.

    Category
    Status