Method auth_smart_proxy
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def auth_smart_proxy(proxies = SmartProxy.unscoped.all)
request_hosts = nil
if request.ssl?
# If we have the client certficate in the request environment we can extract the dn and sans from there
# if not we use the dn in the request environment
- 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 detect_matching_host
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def detect_matching_host(allowed_hosts, request_hosts)
allowed_hosts.product(request_hosts).each do |allowed, request|
if request.starts_with?('*')
# certificate wildcard name
rex = /\A#{Regexp.escape(request).sub('\\*', '.*')}\Z/
- 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 require_smart_proxy_or_login
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def require_smart_proxy_or_login(features = nil)
features = features.call if features.respond_to?(:call)
allowed_smart_proxies = if features.blank?
SmartProxy.unscoped.all
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 auth_smart_proxy
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def auth_smart_proxy(proxies = SmartProxy.unscoped.all)
request_hosts = nil
if request.ssl?
# If we have the client certficate in the request environment we can extract the dn and sans from there
# if not we use the dn in the request environment