Showing 14 of 14 total issues
Class Config
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class Config
include ::Chef::Mixin::ParamsValidate
# Returns configuration options list.
#
Class EncryptedAttribute
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class EncryptedAttribute
# Search Helpers to do normal or partial searches.
module SearchHelper
extend self
Method included
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.included(includer)
includer.class_eval do
# Helper method to set the encrypted attributes configuration.
def self.encrypted_attributes_option_set(key, value)
Chef::Config[:knife][:encrypted_attributes][key] = value
Method parse_partial_search_response
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def parse_partial_search_response(resp, name, keys)
filter_partial_search_response(resp['rows'], name).map do |row|
if row.is_a?(Hash) && row['data'].is_a?(Hash)
row['data'].tap { |r| r.delete('name') unless keys.key?('name') }
else
- Read upRead up
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
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def search(type, query, keys, rows = 1000, partial_search = true)
Method normal_search
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def normal_search(type, name, query, keys, rows = 1000)
Method partial_search
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def partial_search(type, name, query, keys, rows = 1000)
Method search_by_name
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def search_by_name(type, name, keys, rows = 1000, partial_search = true)
Method edit_data_string_to_obj
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def edit_data_string_to_obj(data, format)
case format
when 'JSON', 'json'
if data.nil?
{}
- Read upRead up
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 get_public_key
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.get_public_key(node)
return node['public_key'] unless node['public_key'].nil?
RemoteClients.get_public_key(node['name'])
rescue Net::HTTPServerException => e
raise e unless e.response.code == '403'
- Read upRead up
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_attribute
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def delete_attribute(attr_ary)
assert_attribute_array(attr_ary)
cache_key = cache_key(name, attr_ary)
node = Chef::Node.load(name)
- Read upRead up
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 get_public_keys
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.get_public_keys(users = [])
if users == '*' # users are [a-z0-9\-_]+, cannot be *
cache.key?('*') ? cache['*'] : cache['*'] = all_public_keys
elsif users.is_a?(Array)
get_users_public_keys(users)
- Read upRead up
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 run
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def run
parse_args
return unless
Chef::EncryptedAttribute.exist_on_node?(@node_name, @attr_ary)
- Read upRead up
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 parse_normal_search_row_attribute
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def parse_normal_search_row_attribute(row, attr_ary)
attr_ary.reduce(row) do |r, attr|
if r.respond_to?(attr)
r.send(attr)
elsif r.respond_to?(:key?)
- Read upRead up
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"