Class DSLocalNode
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
class DSLocalNode
require 'find'
SANDBOX_FILE = '/System/Library/Sandbox/Profiles/com.apple.opendirectoryd.sb'
Method active?
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def active?
if needs_sandbox?
return false unless sandbox_active?
end
load_configuration_file
- 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 validate_directory_structure
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def validate_directory_structure
return false unless File.exists? @root
Find.find(@root) do |path|
stat = File::Stat.new path
return false unless stat.uid == OWNER and stat.gid == GROUP
- 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 load_configuration_file
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def load_configuration_file
3.times do
@file = get_configuration_file
if File.exists? @file
break
- 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
Avoid too many return
statements within this method. Open
return false unless searchpolicy_is_custom?
Method create_directories
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create_directories
begin
FileUtils.mkdir_p @root unless File.exist? @root
FileUtils.chmod(0700, @root)
CHILD_DIRS.each do |child|
- 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"