onddo/boxbilling-cookbook

View on GitHub

Showing 4 of 4 total issues

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

def boxbilling_api_request_read_list(args = {})
  page = 1
  loop do
    request_args = args.merge(data: { page: page })
    get_list = boxbilling_api_request(:get_list, request_args)
Severity: Minor
Found in providers/api.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 from_install_dir has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def self.from_install_dir(dir)
      version_file = ::File.join(dir, 'bb-library', 'Box', 'Version.php')
      return nil unless ::File.exist?(version_file) # not installed
      version =
        ::File.open(version_file) do |f|
Severity: Minor
Found in libraries/version.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 path_with_action has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def path_with_action(path, action)
  path = filter_path(path)
  return path if action.nil?
  path_ary = path.split('/')
  if (path_ary[-1] == 'params')
Severity: Minor
Found in providers/api.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 create_http has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def self.create_http(uri, opts)
      Net::HTTP.new(uri.host, uri.port).tap do |http|
        http.set_debug_output Chef::Log if opts[:debug]
        next unless opts[:proto] == 'https'
        require 'net/https'
Severity: Minor
Found in libraries/api.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