app/models/operatingsystem.rb
Class Operatingsystem
has 49 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Operatingsystem < ApplicationRecord
audited
include Authorizable
include ValidateOsFamily
include PxeLoaderSupport
File operatingsystem.rb
has 315 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
require 'ostruct'
require 'uri'
class Operatingsystem < ApplicationRecord
audited
Method boot_filename
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
def boot_filename(host = nil)
return default_boot_filename if host.nil? || host.pxe_loader.nil?
return host.foreman_url('iPXE') if host.pxe_loader == 'iPXE Embedded'
architecture = host.arch.nil? ? '' : host.arch.bootfilename_efi
if host.subnet&.httpboot? && host.pxe_loader =~ /UEFI HTTP/
- 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 find_by_to_label
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def self.find_by_to_label(str)
os = find_by_description(str.to_s)
return os if os
a = str.split(" ")
b = a[1].split('.') if a[1]
- 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"