Showing 719 of 1,266 total issues
Class Operatingsystem
has 50 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Operatingsystem < ApplicationRecord
audited
include Authorizable
include ValidateOsFamily
include PxeLoaderSupport
Function ColumnSelector
has 170 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const ColumnSelector = props => {
const {
data: { url, controller, categories, hasPreference },
} = props;
File base.rb
has 426 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
module Foreman
module Renderer
module Scope
module Macros
module Base
Class Base
has 44 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Base < ApplicationRecord
audited associated_with: :host
prepend Foreman::STI
include Encryptable
encrypts :password
Class Openstack
has 44 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Openstack < ComputeResource
include KeyPairComputeResource
attr_accessor :scheduler_hint_value
delegate :flavors, :to => :client
File index.js
has 416 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/* eslint-disable max-lines */
import React, { createContext, useState, useEffect } from 'react';
import { useSelector, useDispatch, shallowEqual } from 'react-redux';
import { Tr, Td, ActionsColumn } from '@patternfly/react-table';
import {
File basic_ruby_methods.rb
has 413 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
module Foreman
module Renderer
module DocTemplates
module BasicRubyMethods
module Object
Class Template
has 43 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Template < ApplicationRecord
include Exportable
attr_accessor :modify_locked, :modify_default
has_many :template_inputs, :dependent => :destroy, :foreign_key => 'template_id', :autosave => true
Function PersonalAccessTokenModal
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
Open
const PersonalAccessTokenModal = ({ controller, url }) => {
const dispatch = useDispatch();
const [isModalOpen, setIsModalOpen] = useState(false);
const [endsNever, setEndsNever] = useState(true);
const [isDateTimeDisabled, setIsDateTimeDisabled] = useState(true);
- 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 hosts_controller.rb
has 404 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
module Api
module V2
class HostsController < V2::BaseController
include Api::Version2
include Api::V2::BulkHostsExtension
File plugin.rb
has 399 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
module Foreman #:nodoc:
class PluginNotFound < Foreman::Exception; end
class PluginRequirementError < Foreman::Exception; end
# Base class for Foreman plugins.
File application.js
has 394 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
//= require bootstrap
//= require patternfly
//= require jquery.extentions
//= require jquery.multi-select
//= require hidden_values
File compute_resource.rb
has 392 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
class ComputeResource < ApplicationRecord
audited :except => [:attrs]
include Taxonomix
include Encryptable
include Authorizable
File hosts_helper.rb
has 390 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
module HostsHelper
include OperatingsystemsHelper
include HostsAndHostgroupsHelper
include ComputeResourcesVmsHelper
include HostsNicHelper
Class ApplicationController
has 40 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class ApplicationController < ActionController::Base
include ApplicationShared
include Foreman::Controller::Flash
include Foreman::Controller::Authorize
File model_attributes.rb
has 387 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
_('Architecture')
# TRANSLATORS: "Table name" or "Table name|Column name" for error messages
_('Architecture|Name')
# TRANSLATORS: "Table name" or "Table name|Column name" for error messages
_('Audit')
Class Libvirt
has 39 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Libvirt < ComputeResource
include ComputeResourceConsoleCommon
ALLOWED_DISPLAY_TYPES = %w(vnc spice)
File TableIndexPage.js
has 376 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/* eslint-disable max-lines */
import React, { useMemo } from 'react';
import PropTypes from 'prop-types';
import { QuestionCircleIcon } from '@patternfly/react-icons';
import { useHistory } from 'react-router-dom';
Function render
has 124 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const {
changeDiffViewType,
changeSetting,
changeTab,
Class Role
has 37 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Role < ApplicationRecord
audited
include Authorizable
include ScopedSearchExtensions
extend FriendlyId