berkshelf/ridley

View on GitHub

Showing 44 of 44 total issues

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

    def find(object)
      chef_id = object.respond_to?(:chef_id) ? object.chef_id : object
      request(:get, "#{self.class.resource_path}/#{chef_id}")
      new(name: chef_id)
    rescue AbortError => ex
Severity: Minor
Found in lib/ridley/resources/data_bag_resource.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 delete has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def delete(object)
      chef_id = object.respond_to?(:chef_id) ? object.chef_id : object
      new(request(:delete, "#{self.class.resource_path}/#{chef_id}"))
    rescue AbortError => ex
      return nil if ex.cause.is_a?(Errors::HTTPNotFound)
Severity: Minor
Found in lib/ridley/resource.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 _pv_respond_to has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def _pv_respond_to(opts, key, method_name_list)
        value = _pv_opts_lookup(opts, key)
        unless value.nil?
          Array(method_name_list).each do |method_name|
            unless value.respond_to?(method_name)
Severity: Minor
Found in lib/ridley/mixin/params_validate.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 cookbook_versions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def cookbook_versions(environment, run_list = [])
      run_list = Array(run_list).flatten
      chef_id  = environment.respond_to?(:chef_id) ? environment.chef_id : environment
      request(:post, "#{self.class.resource_path}/#{chef_id}/cookbook_versions", JSON.fast_generate(run_list: run_list))
    rescue AbortError => ex
Severity: Minor
Found in lib/ridley/resources/environment_resource.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