theforeman/foreman

View on GitHub

Showing 712 of 1,256 total issues

File host_edit.js has 860 lines of code (exceeds 250 allowed). Consider refactoring.
Open

//= require parameter_override

$(document).ready(function() {
  var searchParams = new URLSearchParams(window.location.search);
  if(searchParams.has('hostgroup_id')) {
Severity: Major
Found in app/assets/javascripts/host_edit.js - About 2 days to fix

    File hosts_controller.rb has 796 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    class HostsController < ApplicationController
      include Foreman::Controller::ActionPermissionDsl
      include ScopesPerAction
      include Foreman::Controller::HostDetails
      include Foreman::Controller::AutoCompleteSearch
    Severity: Major
    Found in app/controllers/hosts_controller.rb - About 1 day to fix

      Class Managed has 97 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class Host::Managed < Host::Base
        # audit the changes to this model
        audited :except => [:last_report, :last_compile, :lookup_value_matcher, :global_status]
        has_associated_audits
        # redefine audits relation because of the type change (by default the relation will look for auditable_type = 'Host::Managed')
      Severity: Major
      Found in app/models/host/managed.rb - About 1 day to fix

        File managed.rb has 774 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        class Host::Managed < Host::Base
          # audit the changes to this model
          audited :except => [:last_report, :last_compile, :lookup_value_matcher, :global_status]
          has_associated_audits
          # redefine audits relation because of the type change (by default the relation will look for auditable_type = 'Host::Managed')
        Severity: Major
        Found in app/models/host/managed.rb - About 1 day to fix

          File vmware.rb has 719 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require 'fog_extensions/vsphere/mini_servers'
          require 'foreman/exception'
          
          begin
            require 'rbvmomi'
          Severity: Major
          Found in app/models/compute_resources/foreman/model/vmware.rb - About 1 day to fix

            Class ComputeResource has 84 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class ComputeResource < ApplicationRecord
              audited :except => [:attrs]
              include Taxonomix
              include Encryptable
              include Authorizable
            Severity: Major
            Found in app/models/compute_resource.rb - About 1 day to fix

              Class HostsController has 83 methods (exceeds 20 allowed). Consider refactoring.
              Open

              class HostsController < ApplicationController
                include Foreman::Controller::ActionPermissionDsl
                include ScopesPerAction
                include Foreman::Controller::HostDetails
                include Foreman::Controller::AutoCompleteSearch
              Severity: Major
              Found in app/controllers/hosts_controller.rb - About 1 day to fix

                Class User has 82 methods (exceeds 20 allowed). Consider refactoring.
                Open

                class User < ApplicationRecord
                  audited :except => [:last_login_on, :password_hash, :password_salt, :password_confirmation],
                          :associations => [:roles, :usergroups]
                  include Authorizable
                  include Foreman::TelemetryHelper
                Severity: Major
                Found in app/models/user.rb - About 1 day to fix

                  Class Ovirt has 79 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                    class Ovirt < ComputeResource
                      ALLOWED_DISPLAY_TYPES = %w(vnc spice)
                  
                      validates :url, :format => { :with => URI::DEFAULT_PARSER.make_regexp }, :presence => true,
                                :url_schema => ['http', 'https']
                  Severity: Major
                  Found in app/models/compute_resources/foreman/model/ovirt.rb - About 1 day to fix

                    Class Plugin has 77 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                      class Plugin
                        DEFAULT_REGISTRIES = {
                          fact_importer: 'Foreman::Plugin::FactImporterRegistry',
                          fact_parser: 'Foreman::Plugin::FactParserRegistry',
                          report_scanner: 'Foreman::Plugin::ReportScannerRegistry',
                    Severity: Major
                    Found in app/registries/foreman/plugin.rb - About 1 day to fix

                      File ovirt.rb has 613 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      require 'foreman/exception'
                      require 'uri'
                      
                      module Foreman::Model
                        class Ovirt < ComputeResource
                      Severity: Major
                      Found in app/models/compute_resources/foreman/model/ovirt.rb - About 1 day to fix

                        File user.rb has 613 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        require 'digest/sha1'
                        
                        class User < ApplicationRecord
                          audited :except => [:last_login_on, :password_hash, :password_salt, :password_confirmation],
                                  :associations => [:roles, :usergroups]
                        Severity: Major
                        Found in app/models/user.rb - About 1 day to fix

                          Function HostsIndex has 267 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          const HostsIndex = () => {
                            const history = useHistory();
                            const { location: { search: historySearch } = {} } = history || {};
                            const urlParams = new URLSearchParams(historySearch);
                            const urlParamsSearch = urlParams.get('search') || '';
                          Severity: Major
                          Found in webpack/assets/javascripts/react_app/components/HostsIndex/index.js - About 1 day to fix

                            Function RegistrationCommandsPage has 264 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            const RegistrationCommandsPage = () => {
                              const dispatch = useDispatch();
                            
                              // Context
                              const currentOrganization = useForemanOrganization();

                              Class Vmware has 71 methods (exceeds 20 allowed). Consider refactoring.
                              Open

                                class Vmware < ComputeResource
                                  include ComputeResourceConsoleCommon
                                  include ComputeResourceCaching
                              
                                  validates :user, :password, :server, :datacenter, :presence => true
                              Severity: Major
                              Found in app/models/compute_resources/foreman/model/vmware.rb - About 1 day to fix

                                File access_permissions.rb has 602 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                require_dependency 'foreman/access_control'
                                
                                # Permissions
                                Foreman::AccessControl.map do |permission_set|
                                  permission_set.security_block :public do |map|
                                Severity: Major
                                Found in app/registries/foreman/access_permissions.rb - About 1 day to fix

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

                                    class Base < ApplicationRecord
                                      KERNEL_RELEASE_FACTS = ['kernelrelease', 'ansible_kernel', 'kernel::release', 'uname::release']
                                  
                                      prepend Foreman::STI
                                      include Authorizable
                                  Severity: Major
                                  Found in app/models/host/base.rb - About 1 day to fix

                                    File base.rb has 511 lines of code (exceeds 250 allowed). Consider refactoring.
                                    Open

                                    module Host
                                      class Base < ApplicationRecord
                                        KERNEL_RELEASE_FACTS = ['kernelrelease', 'ansible_kernel', 'kernel::release', 'uname::release']
                                    
                                        prepend Foreman::STI
                                    Severity: Major
                                    Found in app/models/host/base.rb - About 1 day to fix

                                      Method guest_types_descriptions has 197 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          def guest_types_descriptions
                                            {
                                              "almalinux_64Guest" => "AlmaLinux (64-bit)",
                                              "amazonlinux2_64Guest" => "Amazon Linux 2 (64 bit)",
                                              "amazonlinux3_64Guest" => "Amazon Linux 3 (64 bit)",
                                      Severity: Major
                                      Found in app/models/compute_resources/foreman/model/vmware.rb - About 7 hrs to fix

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

                                          render() {
                                            const {
                                              data: {
                                                name,
                                                isSafemodeEnabled,
                                        Severity: Major
                                        Found in webpack/assets/javascripts/react_app/components/Editor/Editor.js - About 7 hrs to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language