crowbar/crowbar-core

View on GitHub
chef/cookbooks/utils/libraries/search.rb

Summary

Maintainability
A
1 hr
Test Coverage

Method crowbar_filter_env has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def crowbar_filter_env(node, query, cookbook_name = nil, bc_instance = nil)
      # All cookbooks encode the barclamp name as the role name prefix, thus we can
      # simply grab it from the query (e.g. BC 'keystone' for role 'keystone-server'):
      return nil unless query =~ /^(roles|recipes):(\w*).*$/
      barclamp = $2
Severity: Minor
Found in chef/cookbooks/utils/libraries/search.rb - About 55 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 search_env_filtered has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def search_env_filtered(type, query="*:*", sort="X_CHEF_id_CHEF_X asc",
                            start=0, rows=100, &block)
Severity: Minor
Found in chef/cookbooks/utils/libraries/search.rb - About 45 mins to fix

There are no issues that match your filters.

Category
Status