ManageIQ/manageiq-providers-kubernetes

View on GitHub

Showing 31 of 31 total issues

Method collector_thread has a Cognitive Complexity of 34 (exceeds 11 allowed). Consider refactoring.
Open

def collector_thread
retry_connection = true
 
while running?
begin

Cyclomatic complexity for collector_thread is too high. [17/11]
Open

def collector_thread
retry_connection = true
 
while running?
begin

Cyclomatic complexity for parse_image_name is too high. [13/11]
Open

def parse_image_name(image, image_ref)
# parsing using same logic as in docker
# https://github.com/docker/docker/blob/348f6529b71502b561aa493e250fd5be248da0d5/reference/reference.go#L174
docker_pullable_re = %r{
\A

Similar blocks of code found in 2 locations. Consider refactoring.
Open

{
:component => "text-field",
:id => "endpoints.prometheus.hostname",
:name => "endpoints.prometheus.hostname",
:label => _("Hostname (or IPv4 or IPv6 address)"),
app/models/manageiq/providers/kubernetes/container_manager.rb on lines 368..399

Similar blocks of code found in 2 locations. Consider refactoring.
Open

{
:component => "text-field",
:id => "endpoints.kubevirt.hostname",
:name => "endpoints.kubevirt.hostname",
:label => _("Hostname (or IPv4 or IPv6 address)"),
app/models/manageiq/providers/kubernetes/container_manager.rb on lines 256..287

Method parse_image_name has a Cognitive Complexity of 14 (exceeds 11 allowed). Consider refactoring.
Open

def parse_image_name(image, image_ref)
# parsing using same logic as in docker
# https://github.com/docker/docker/blob/348f6529b71502b561aa493e250fd5be248da0d5/reference/reference.go#L174
docker_pullable_re = %r{
\A

Similar blocks of code found in 2 locations. Consider refactoring.
Open

{
:component => "select",
:id => "endpoints.default.security_protocol",
:name => "endpoints.default.security_protocol",
:label => _("Security Protocol"),
Severity: Minor
Found in app/models/manageiq/providers/kubernetes/container_manager.rb and 1 other location - About 45 mins to fix
app/models/manageiq/providers/kubernetes/container_manager.rb on lines 345..366

Similar blocks of code found in 2 locations. Consider refactoring.
Open

{
:component => "select",
:id => "endpoints.kubevirt.security_protocol",
:name => "endpoints.kubevirt.security_protocol",
:label => _("Security Protocol"),
Severity: Minor
Found in app/models/manageiq/providers/kubernetes/container_manager.rb and 1 other location - About 45 mins to fix
app/models/manageiq/providers/kubernetes/container_manager.rb on lines 128..149

Method parse_pod has a Cognitive Complexity of 13 (exceeds 11 allowed). Consider refactoring.
Open

def parse_pod(pod)
# pod in kubernetes is container group in manageiq
new_result = parse_base_item(pod)
 
new_result.merge!(

Similar blocks of code found in 3 locations. Consider refactoring.
Open

def lazy_find_persistent_volume_claim(hash)
return nil if hash.nil?
search = {:container_project => lazy_find_project(:name => hash[:namespace]), :name => hash[:name]}
persister.persistent_volume_claims.lazy_find(search, :ref => :by_container_project_and_name)
app/models/manageiq/providers/kubernetes/inventory/parser/container_manager.rb on lines 1108..1111
app/models/manageiq/providers/kubernetes/inventory/parser/container_manager.rb on lines 1114..1117

Similar blocks of code found in 3 locations. Consider refactoring.
Open

def lazy_find_replicator(hash)
return nil if hash.nil?
search = {:container_project => lazy_find_project(:name => hash[:namespace]), :name => hash[:name]}
persister.container_replicators.lazy_find(search, :ref => :by_container_project_and_name)
app/models/manageiq/providers/kubernetes/inventory/parser/container_manager.rb on lines 1114..1117
app/models/manageiq/providers/kubernetes/inventory/parser/container_manager.rb on lines 1136..1139

Similar blocks of code found in 3 locations. Consider refactoring.
Open

def lazy_find_container_group(hash)
return nil if hash.nil?
search = {:container_project => lazy_find_project(:name => hash[:namespace]), :name => hash[:name]}
persister.container_groups.lazy_find(search, :ref => :by_container_project_and_name)
app/models/manageiq/providers/kubernetes/inventory/parser/container_manager.rb on lines 1108..1111
app/models/manageiq/providers/kubernetes/inventory/parser/container_manager.rb on lines 1136..1139

Similar blocks of code found in 3 locations. Consider refactoring.
Open

{
:component => "textarea",
:id => "endpoints.kubevirt.certificate_authority",
:name => "endpoints.kubevirt.certificate_authority",
:label => _("Trusted CA Certificates"),
Severity: Minor
Found in app/models/manageiq/providers/kubernetes/container_manager.rb and 2 other locations - About 15 mins to fix
app/models/manageiq/providers/kubernetes/container_manager.rb on lines 169..179
app/models/manageiq/providers/kubernetes/container_manager.rb on lines 301..311

Similar blocks of code found in 3 locations. Consider refactoring.
Open

{
:component => "textarea",
:id => "endpoints.prometheus.certificate_authority",
:name => "endpoints.prometheus.certificate_authority",
:label => _("Trusted CA Certificates"),
Severity: Minor
Found in app/models/manageiq/providers/kubernetes/container_manager.rb and 2 other locations - About 15 mins to fix
app/models/manageiq/providers/kubernetes/container_manager.rb on lines 169..179
app/models/manageiq/providers/kubernetes/container_manager.rb on lines 413..423

Similar blocks of code found in 3 locations. Consider refactoring.
Open

{
:component => "textarea",
:id => "endpoints.default.certificate_authority",
:name => "endpoints.default.certificate_authority",
:label => _("Trusted CA Certificates"),
Severity: Minor
Found in app/models/manageiq/providers/kubernetes/container_manager.rb and 2 other locations - About 15 mins to fix
app/models/manageiq/providers/kubernetes/container_manager.rb on lines 301..311
app/models/manageiq/providers/kubernetes/container_manager.rb on lines 413..423

Use filter_map instead.
Open

@services.map { |svc| name_and_namespace(svc) }.compact

Use filter_map instead.
Open

return inspector_sa.try(:imagePullSecrets).to_a.collect { |sec| sec.try(:name) }.compact.uniq

Unnecessary symbol conversion; use :"openshift.io/build.name" instead.
Open

:name => pod.metadata.try(:annotations).try("openshift.io/build.name".to_sym)

Avoid immutable Array literals in loops. It is better to extract it into a local variable or a constant.
Open

next if %w[default kubevirt].include?(endpoint['role'])

metadata['rubygems_mfa_required'] must be set to 'true'.
Open

Gem::Specification.new do |spec|
spec.name = "manageiq-providers-kubernetes"
spec.version = ManageIQ::Providers::Kubernetes::VERSION
spec.authors = ["ManageIQ Authors"]
 
 
Severity
Category
Status
Source
Language