Class UnattendedController
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class UnattendedController < ApplicationController
include ::Foreman::Controller::TemplateRendering
layout false
Method failed
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def failed
return unless verify_found_host
return head(:method_not_allowed) unless allowed_to_install?
return if preview? || !@host.build
- 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 host_template
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def host_template
kind = params[:kind]
return head(:not_found) unless kind.present?
return if render_ipxe_template
- 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 render_ipxe_template
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def render_ipxe_template
return false unless ipxe_request?
if @host.nil? && params[:bootstrap]
render_intermediate_template
- 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 built
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def built
return unless verify_found_host
return head(:method_not_allowed) unless allowed_to_install?
logger.info "#{controller_name}: #{@host.name} is built!"
- 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
(handle_realm || return) if kind == 'provision'