Method ip_exists
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def ip_exists(ip, subnet, group = "")
raise "subnet cannot be nil" if subnet.nil?
raise "ip cannot be nil" if ip.nil?
response = parse get("/subnet/#{subnet}/#{ip}", query: { group: group })
raise(response['error']) if response.is_a?(Hash) && response['error'].present?
- 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 add_ip_to_subnet
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def add_ip_to_subnet(ip, subnet, group = "")
raise "subnet cannot be nil" if subnet.nil?
raise "ip cannot be nil" if ip.nil?
response = parse post({}, "/subnet/#{subnet}/#{ip}?group=#{CGI.escape(group.to_s)}")
raise(response['error']) if response.is_a?(Hash) && response['error'].present?
- 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_ip_from_subnet
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def delete_ip_from_subnet(ip, subnet, group = "")
raise "subnet cannot be nil" if subnet.nil?
raise "ip cannot be nil" if ip.nil?
response = parse delete("/subnet/#{subnet}/#{ip}?group=#{CGI.escape(group.to_s)}")
raise(response['error']) if response.is_a?(Hash) && response['error'].present?
- 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_subnets_by_group
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_subnets_by_group(group)
raise "group must be provided" if group.blank?
response = parse get("/groups/#{CGI.escape(group)}/subnets")
raise(response['error']) if response.is_a?(Hash) && response['error'].present?
response
- 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"