theforeman/foreman

View on GitHub

Showing 1,111 of 1,111 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

describe('ShortDateTime', () => {
  const date = new Date('2017-10-13 00:54:55 -1100');
  const now = new Date('2017-10-28 00:00:00 -1100');
  const IntlDate = i18nProviderWrapperFactory(now, 'UTC')(ShortDateTime);

webpack/assets/javascripts/react_app/components/common/dates/LongDateTime.test.js on lines 9..61

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 433.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

describe('LongDateTime', () => {
  const date = new Date('2017-10-13 00:54:55 -1100');
  const now = new Date('2017-10-28 00:00:00 -1100');
  const IntlDate = i18nProviderWrapperFactory(now, 'UTC')(LongDateTime);

webpack/assets/javascripts/react_app/components/common/dates/ShortDateTime.test.js on lines 9..61

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 433.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

//= require parameter_override

$(document).on('ContentLoad', function() {
  onHostEditLoad();
});
Severity: Major
Found in app/assets/javascripts/host_edit.js - About 2 days to fix

    File managed.rb has 843 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 2 days to fix

      Class Managed has 104 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 2 days to fix

        File websocket.py has 785 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        #!/usr/bin/env python
        
        '''
        Python WebSocket library with support for "wss://" encryption.
        Copyright 2011 Joel Martin
        Severity: Major
        Found in extras/noVNC/websockify/websocket.py - About 1 day to fix

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          const mockStoryData = {
            config: {
              donut: {
                width: 15,
                label: {
          webpack/stories/data/charts/donutChartMockData.js on lines 1..82

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 324.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          const WithDataProps = {
            config: {
              donut: {
                width: 15,
                label: {
          Severity: Major
          Found in webpack/stories/data/charts/donutChartMockData.js and 1 other location - About 1 day to fix
          webpack/assets/javascripts/react_app/components/ChartBox/ChartBox.fixtures.js on lines 1..82

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 324.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          File hosts_controller.rb has 728 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 User has 83 methods (exceeds 20 allowed). Consider refactoring.
            Open

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

              Class ComputeResource has 83 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 82 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

                  File vmware.rb has 678 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

                    File access_permissions.rb has 672 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 Ovirt has 80 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

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                          it('Should return a selectionController allRowsSelected:false', () => {
                            const allRowsSelected = false;
                            const selectCtrl = getSelectionController({
                              allRowsSelected,
                              rows,
                        webpack/assets/javascripts/react_app/components/common/table/schemaHelpers/selection.test.js on lines 50..72

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 264.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                          it('Should return a selectionController allRowsSelected:true', () => {
                            const allRowsSelected = true;
                            const selectCtrl = getSelectionController({
                              allRowsSelected,
                              rows,
                        webpack/assets/javascripts/react_app/components/common/table/schemaHelpers/selection.test.js on lines 26..48

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 264.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

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

                          class Plugin
                            @registered_plugins = {}
                            @tests_to_skip = {}
                            @fact_importer_registry = Plugin::FactImporterRegistry.new
                            @report_scanner_registry = Plugin::ReportScannerRegistry.new
                        Severity: Major
                        Found in app/registries/foreman/plugin.rb - About 1 day to fix

                          File user.rb has 622 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
                          Severity: Major
                          Found in app/models/user.rb - About 1 day to fix

                            File ovirt.rb has 619 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
                              Severity
                              Category
                              Status
                              Source
                              Language