Showing 5 of 5 total issues
Class ZestKnife
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class ZestKnife < Chef::Knife
attr_accessor :base_domain
attr_accessor :internal_domain
def msg_pair(label, value, color=:cyan)
Method run
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def run
$stdout.sync = true
setup_config
@environment = config[:environment]
Method new_with_defaults
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def self.new_with_defaults environment, region, color, base_domain, opts
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def initialize(validation_key_file, validation_client_name, chef_server_url, encrypted_databag_secret_file, attr = {})
Method zone
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def zone
unless @zone
self.class.in_all_aws_regions do |zest_aws|
@zone ||= zest_aws.dns.zones.detect { |z| z.domain.downcase == domain }
end
- 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"