theforeman/foreman

View on GitHub

Showing 722 of 1,271 total issues

Class Operatingsystem has 50 methods (exceeds 20 allowed). Consider refactoring.
Open

class Operatingsystem < ApplicationRecord
  audited
  include Authorizable
  include ValidateOsFamily
  include PxeLoaderSupport
Severity: Minor
Found in app/models/operatingsystem.rb - About 7 hrs to fix

    Function ColumnSelector has 170 lines of code (exceeds 25 allowed). Consider refactoring.
    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

      module Foreman
        module Renderer
          module Scope
            module Macros
              module Base
      Severity: Minor
      Found in app/services/foreman/renderer/scope/macros/base.rb - About 6 hrs to fix

        Class Base has 44 methods (exceeds 20 allowed). Consider refactoring.
        Open

          class Base < ApplicationRecord
            audited associated_with: :host
            prepend Foreman::STI
            include Encryptable
            encrypts :password
        Severity: Minor
        Found in app/models/nic/base.rb - About 6 hrs to fix

          Class Openstack has 44 methods (exceeds 20 allowed). Consider refactoring.
          Open

            class Openstack < ComputeResource
              include KeyPairComputeResource
              attr_accessor :scheduler_hint_value
              delegate :flavors, :to => :client
              delegate :security_groups, :to => :client
          Severity: Minor
          Found in app/models/compute_resources/foreman/model/openstack.rb - About 6 hrs to fix

            File index.js has 416 lines of code (exceeds 250 allowed). Consider refactoring.
            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 {
            Severity: Minor
            Found in webpack/assets/javascripts/react_app/components/HostsIndex/index.js - About 6 hrs to fix

              File basic_ruby_methods.rb has 413 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              module Foreman
                module Renderer
                  module DocTemplates
                    module BasicRubyMethods
                      module Object
              Severity: Minor
              Found in app/services/foreman/renderer/doc_templates/basic_ruby_methods.rb - About 5 hrs to fix

                Class Template has 43 methods (exceeds 20 allowed). Consider refactoring.
                Open

                class Template < ApplicationRecord
                  include Exportable
                  attr_accessor :modify_locked, :modify_default
                
                  has_many :template_inputs, :dependent => :destroy, :foreign_key => 'template_id', :autosave => true
                Severity: Minor
                Found in app/models/template.rb - About 5 hrs to fix

                  Function PersonalAccessTokenModal has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const PersonalAccessTokenModal = ({ controller, url }) => {
                    const dispatch = useDispatch();
                    const [isModalOpen, setIsModalOpen] = useState(false);
                    const [endsNever, setEndsNever] = useState(true);
                    const [isDateTimeDisabled, setIsDateTimeDisabled] = useState(true);

                  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

                  module Api
                    module V2
                      class HostsController < V2::BaseController
                        include Api::Version2
                        include Api::V2::BulkHostsExtension
                  Severity: Minor
                  Found in app/controllers/api/v2/hosts_controller.rb - About 5 hrs to fix

                    File application.js has 401 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    //= require bootstrap
                    //= require patternfly
                    //= require jquery.extentions
                    //= require jquery.multi-select
                    //= require hidden_values
                    Severity: Minor
                    Found in app/assets/javascripts/application.js - About 5 hrs to fix

                      File plugin.rb has 399 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      module Foreman #:nodoc:
                        class PluginNotFound < Foreman::Exception; end
                        class PluginRequirementError < Foreman::Exception; end
                      
                        # Base class for Foreman plugins.
                      Severity: Minor
                      Found in app/registries/foreman/plugin.rb - About 5 hrs to fix

                        File hosts_helper.rb has 390 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        module HostsHelper
                          include OperatingsystemsHelper
                          include HostsAndHostgroupsHelper
                          include ComputeResourcesVmsHelper
                          include HostsNicHelper
                        Severity: Minor
                        Found in app/helpers/hosts_helper.rb - About 5 hrs to fix

                          Class ApplicationController has 40 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                          class ApplicationController < ActionController::Base
                            include ApplicationShared
                          
                            include Foreman::Controller::Flash
                            include Foreman::Controller::Authorize
                          Severity: Minor
                          Found in app/controllers/application_controller.rb - About 5 hrs to fix

                            File model_attributes.rb has 387 lines of code (exceeds 250 allowed). Consider refactoring.
                            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')
                            Severity: Minor
                            Found in locale/model_attributes.rb - About 5 hrs to fix

                              File TableIndexPage.js has 376 lines of code (exceeds 250 allowed). Consider refactoring.
                              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';

                                Class Libvirt has 38 methods (exceeds 20 allowed). Consider refactoring.
                                Open

                                  class Libvirt < ComputeResource
                                    include ComputeResourceConsoleCommon
                                
                                    ALLOWED_DISPLAY_TYPES = %w(vnc spice)
                                
                                
                                Severity: Minor
                                Found in app/models/compute_resources/foreman/model/libvirt.rb - About 5 hrs to fix

                                  Function render has 124 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    render() {
                                      const {
                                        changeDiffViewType,
                                        changeSetting,
                                        changeTab,

                                    Class Role has 37 methods (exceeds 20 allowed). Consider refactoring.
                                    Open

                                    class Role < ApplicationRecord
                                      audited
                                      include Authorizable
                                      include ScopedSearchExtensions
                                      extend FriendlyId
                                    Severity: Minor
                                    Found in app/models/role.rb - About 4 hrs to fix

                                      Class PuppetFactParser has 37 methods (exceeds 20 allowed). Consider refactoring.
                                      Open

                                      class PuppetFactParser < FactParser
                                        attr_reader :facts
                                      
                                        def operatingsystem
                                          orel = os_release.dup
                                      Severity: Minor
                                      Found in app/services/puppet_fact_parser.rb - About 4 hrs to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language