Showing 712 of 1,256 total issues
Class Subnet
has 50 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Subnet < ApplicationRecord
audited
IP_FIELDS = [:network, :mask, :gateway, :dns_primary, :dns_secondary, :from, :to]
REQUIRED_IP_FIELDS = [:network, :mask]
SUBNET_TYPES = {:'Subnet::Ipv4' => N_('IPv4'), :'Subnet::Ipv6' => N_('IPv6')}
Class Operatingsystem
has 49 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Operatingsystem < ApplicationRecord
audited
include Authorizable
include ValidateOsFamily
include PxeLoaderSupport
File application.js
has 451 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
//= require bootstrap
//= require patternfly
//= require jquery.extentions
//= require jquery.multi-select
//= require hidden_values
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 423 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
module Foreman
module Renderer
module Scope
module Macros
module Base
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
delegate :security_groups, :to => :client
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
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 plugin.rb
has 405 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
require_dependency 'foreman/plugin/logging'
require_dependency 'foreman/plugin/report_scanner_registry'
require_dependency 'foreman/plugin/report_origin_registry'
require_dependency 'foreman/plugin/medium_providers_registry'
require_dependency 'foreman/plugin/fact_importer_registry'
File hosts_controller.rb
has 405 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 hosts_helper.rb
has 389 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 38 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Libvirt < ComputeResource
include ComputeResourceConsoleCommon
ALLOWED_DISPLAY_TYPES = %w(vnc spice)
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
File form_helper.rb
has 366 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
module FormHelper
def text_f(f, attr, options = {})
field(f, attr, options) do
addClass options, "form-control"
options[:focus_on_load] = true if options[:focus_on_load].nil? && attr.to_s == 'name'
File Layout.fixtures.js
has 365 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
const mockOnClick = jest.fn();
const subItemsA = [
{
title: 'Aa',