lamont-cookbooks/multipackage

View on GitHub

Showing 4 of 4 total issues

Method multipackage_definition_impl has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

  def multipackage_definition_impl(params)
    # @todo make sure package_names and versions have the same # of items
    # (unless verison is omitted)
    package_names = []
    if params[:package_name] || params[:name]
Severity: Minor
Found in definitions/default.rb - About 2 hrs 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 singlepackage_resources has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

def singlepackage_resources(new_resource, action)
  package_name_array = package_name.is_a?(Array) ? package_name : package_name.split(", ")
  version_array = [new_resource.version].flatten if new_resource.version
  package_name_array.each_with_index do |package_name, i|
    version = version_array[i] if version_array
Severity: Minor
Found in resources/internal.rb - About 1 hr 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 multipackage_definition_impl has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def multipackage_definition_impl(params)
    # @todo make sure package_names and versions have the same # of items
    # (unless verison is omitted)
    package_names = []
    if params[:package_name] || params[:name]
Severity: Minor
Found in definitions/default.rb - About 1 hr to fix

    Method multipackage_resource has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def multipackage_resource(new_resource, action)
      package_name_array = package_name.is_a?(Array) ? package_name : package_name.split(", ")
      version_array = [new_resource.version].flatten if new_resource.version
      if new_resource.per_package_timeout
        total_timeout = new_resource.per_package_timeout *
    Severity: Minor
    Found in resources/internal.rb - About 1 hr 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