Showing 722 of 1,271 total issues
Function render
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { time, toggleTimeTable } = this.props;
const minutes = time.getMinutes();
const hours = time.getHours() % 12 || 12;
File index.js
has 278 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* eslint-disable camelcase */
import PropTypes from 'prop-types';
import React, { useEffect } from 'react';
import { useSelector, shallowEqual } from 'react-redux';
import { Link } from 'react-router-dom';
Class Hostgroup
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class Hostgroup < ApplicationRecord
audited
include Authorizable
extend FriendlyId
friendly_id :title
Class Taxonomy
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class Taxonomy < ApplicationRecord
validates_lengths_from_database
include Authorizable
include NestedAncestryCommon
Method create_vm
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def create_vm(args = {})
boot_from_volume(args) if Foreman::Cast.to_bool(args[:boot_from_volume])
network = args.delete(:network)
# fix internal network format for fog.
args[:nics].delete_if(&:blank?)
- 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 setup_search_options
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def setup_search_options
@original_search_parameter = params[:search]
params[:search] ||= ""
params.each do |param, value|
case param
- 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 update_multiple_parameters
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def update_multiple_parameters
if params[:name].empty?
warning _("No parameters were allocated to the selected hosts, can't mass assign")
redirect_to hosts_path
return
- 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 operatingsystem
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def operatingsystem
orel = os_release.dup
if orel.present?
if os_name =~ /ubuntu/i
- 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
Function render
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const {
locale,
weekStartsOn,
inputProps,
File puppet_fact_parser.rb
has 271 lines of code (exceeds 250 allowed). Consider refactoring. Open
class PuppetFactParser < FactParser
attr_reader :facts
def operatingsystem
orel = os_release.dup
File role.rb
has 268 lines of code (exceeds 250 allowed). Consider refactoring. Open
class Role < ApplicationRecord
audited
include Authorizable
include ScopedSearchExtensions
extend FriendlyId
Method select_f
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def select_f(f, attr, array, id, method, select_options = {}, html_options = {})
array = array.to_a.dup
disable_button = select_options.delete(:disable_button)
include_blank = select_options.delete(:include_blank)
disable_button_enabled = select_options.delete(:disable_button_enabled)
- 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 field
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def field(f, attr, options = {}, &block)
table_field = options.delete(:table_field)
error = options.delete(:error) || get_attr_error(f, attr)
help_inline = help_inline(options.delete(:help_inline), error)
help_inline += options[:help_inline_permanent] unless options[:help_inline_permanent].nil?
- 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 freeip
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def freeip
unless (s = params[:subnet_id].to_i) > 0
invalid_request
return
end
- 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 process_error
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def process_error(hash = {})
hash[:object] ||= instance_variable_get("@#{controller_name.singularize}")
if hash[:render].blank? && hash[:redirect].blank?
case action_name
when "create" then hash[:render] = "new"
- 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
File libvirt.rb
has 267 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Foreman::Model
class Libvirt < ComputeResource
include ComputeResourceConsoleCommon
ALLOWED_DISPLAY_TYPES = %w(vnc spice)
File EditorNavbar.js
has 265 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, { useState } from 'react';
import PropTypes from 'prop-types';
import { Nav, Spinner, Alert, Button } from 'patternfly-react';
import { translate as __ } from '../../../common/I18n';
import EditorRadioButton from './EditorRadioButton';
File SettingRecords.fixtures.js
has 264 lines of code (exceeds 250 allowed). Consider refactoring. Open
export const settings = [
{
description: 'The default administrator email address',
category: 'General',
settingsType: 'string',
Class SettingRegistry
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class SettingRegistry
include Singleton
include Enumerable
extend ScopedSearch::ClassMethods