lib/bos_client/bucket.rb

Summary

Maintainability
A
25 mins
Test Coverage

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

    def list_objects(options = {})
      prefix = options.fetch(:prefix, nil)
      max_keys = options.fetch(:max_keys, 1000)
      marker = options.fetch(:marker, nil)
      delimiter = options.fetch(:delimiter, nil)
Severity: Minor
Found in lib/bos_client/bucket.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

Space inside { missing.
Open

      objs.map { |obj| BosClient::Object.new ({bucket: self}.merge(obj)) }
Severity: Minor
Found in lib/bos_client/bucket.rb by rubocop

Checks that braces used for hash literals have or don't have surrounding space depending on configuration.

Example: EnforcedStyle: space

# The `space` style enforces that hash literals have
# surrounding space.

# bad
h = {a: 1, b: 2}

# good
h = { a: 1, b: 2 }

Example: EnforcedStyle: no_space

# The `no_space` style enforces that hash literals have
# no surrounding space.

# bad
h = { a: 1, b: 2 }

# good
h = {a: 1, b: 2}

Example: EnforcedStyle: compact

# The `compact` style normally requires a space inside
# hash braces, with the exception that successive left
# braces or right braces are collapsed together in nested hashes.

# bad
h = { a: { b: 2 } }

# good
h = { a: { b: 2 }}

Rename is_dir? to dir?.
Open

    def is_dir?(name)
Severity: Minor
Found in lib/bos_client/bucket.rb by rubocop

This cop makes sure that predicates are named properly.

Example:

# bad
def is_even?(value)
end

# good
def even?(value)
end

# bad
def has_value?
end

# good
def value?
end

Method BosClient::Bucket#bucket_host is defined at both lib/bos_client/bucket.rb:4 and lib/bos_client/bucket.rb:4.
Open

    attr_accessor :name, :bucket_host, :creation_date, :bucket_host
Severity: Minor
Found in lib/bos_client/bucket.rb by rubocop

This cop checks for duplicated instance (or singleton) method definitions.

Example:

# bad

def duplicated
  1
end

def duplicated
  2
end

Example:

# bad

def duplicated
  1
end

alias duplicated other_duplicated

Example:

# good

def duplicated
  1
end

def other_duplicated
  2
end

Line is too long. [81/80]
Open

      request = BosClient::Request.new @bucket_host, method: :get, params: params
Severity: Minor
Found in lib/bos_client/bucket.rb by rubocop

Add an empty line after magic comments.
Open

module BosClient
Severity: Minor
Found in lib/bos_client/bucket.rb by rubocop

Checks for a newline after the final magic comment.

Example:

# good
# frozen_string_literal: true

# Some documentation for Person
class Person
  # Some code
end

# bad
# frozen_string_literal: true
# Some documentation for Person
class Person
  # Some code
end

Space inside { missing.
Open

      objs.map { |obj| BosClient::Object.new ({bucket: self}.merge(obj)) }
Severity: Minor
Found in lib/bos_client/bucket.rb by rubocop

Checks that braces used for hash literals have or don't have surrounding space depending on configuration.

Example: EnforcedStyle: space

# The `space` style enforces that hash literals have
# surrounding space.

# bad
h = {a: 1, b: 2}

# good
h = { a: 1, b: 2 }

Example: EnforcedStyle: no_space

# The `no_space` style enforces that hash literals have
# no surrounding space.

# bad
h = { a: 1, b: 2 }

# good
h = {a: 1, b: 2}

Example: EnforcedStyle: compact

# The `compact` style normally requires a space inside
# hash braces, with the exception that successive left
# braces or right braces are collapsed together in nested hashes.

# bad
h = { a: { b: 2 } }

# good
h = { a: { b: 2 }}

Space inside } missing.
Open

      objs.map { |obj| BosClient::Object.new ({bucket: self}.merge(obj)) }
Severity: Minor
Found in lib/bos_client/bucket.rb by rubocop

Checks that braces used for hash literals have or don't have surrounding space depending on configuration.

Example: EnforcedStyle: space

# The `space` style enforces that hash literals have
# surrounding space.

# bad
h = {a: 1, b: 2}

# good
h = { a: 1, b: 2 }

Example: EnforcedStyle: no_space

# The `no_space` style enforces that hash literals have
# no surrounding space.

# bad
h = { a: 1, b: 2 }

# good
h = {a: 1, b: 2}

Example: EnforcedStyle: compact

# The `compact` style normally requires a space inside
# hash braces, with the exception that successive left
# braces or right braces are collapsed together in nested hashes.

# bad
h = { a: { b: 2 } }

# good
h = { a: { b: 2 }}

Don't use parentheses around a method call.
Open

      objs.map { |obj| BosClient::Object.new ({bucket: self}.merge(obj)) }
Severity: Minor
Found in lib/bos_client/bucket.rb by rubocop

This cop checks for redundant parentheses.

Example:

# bad
(x) if ((y.z).nil?)

# good
x if y.z.nil?

Space inside } missing.
Open

      objs.map { |obj| BosClient::Object.new ({bucket: self}.merge(obj)) }
Severity: Minor
Found in lib/bos_client/bucket.rb by rubocop

Checks that braces used for hash literals have or don't have surrounding space depending on configuration.

Example: EnforcedStyle: space

# The `space` style enforces that hash literals have
# surrounding space.

# bad
h = {a: 1, b: 2}

# good
h = { a: 1, b: 2 }

Example: EnforcedStyle: no_space

# The `no_space` style enforces that hash literals have
# no surrounding space.

# bad
h = { a: 1, b: 2 }

# good
h = {a: 1, b: 2}

Example: EnforcedStyle: compact

# The `compact` style normally requires a space inside
# hash braces, with the exception that successive left
# braces or right braces are collapsed together in nested hashes.

# bad
h = { a: { b: 2 } }

# good
h = { a: { b: 2 }}

Missing top-level class documentation comment.
Open

  class Bucket
Severity: Minor
Found in lib/bos_client/bucket.rb by rubocop

This cop checks for missing top-level documentation of classes and modules. Classes with no body are exempt from the check and so are namespace modules - modules that have nothing in their bodies except classes, other modules, or constant definitions.

The documentation requirement is annulled if the class or module has a "#:nodoc:" comment next to it. Likewise, "#:nodoc: all" does the same for all its children.

Example:

# bad
class Person
  # ...
end

# good
# Description/Explanation of Person class
class Person
  # ...
end

Unnecessary utf-8 encoding comment.
Open

# encoding: UTF-8
Severity: Minor
Found in lib/bos_client/bucket.rb by rubocop

Line is too long. [83/80]
Open

      @bucket_host = "#{BosClient.scheme}://#{@name}.#{@location}.#{BosClient.url}"
Severity: Minor
Found in lib/bos_client/bucket.rb by rubocop

Don't use parentheses around a method call.
Open

      objs.map { |obj| BosClient::Object.new ({bucket: self}.merge(obj)) }
Severity: Minor
Found in lib/bos_client/bucket.rb by rubocop

This cop checks for redundant parentheses.

Example:

# bad
(x) if ((y.z).nil?)

# good
x if y.z.nil?

There are no issues that match your filters.

Category
Status