theforeman/foreman

View on GitHub

Showing 1,266 of 1,266 total issues

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

const initialState = Immutable({
  [EDITOR_HOST_ARR]: [],
  [EDITOR_HOST_FILTERED_ARR]: [],
  diffViewType: 'split',
  editorName: 'editor',
webpack/assets/javascripts/react_app/common/testHelpers.js on lines 194..225

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 150.

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

  editor: {
    hosts: [],
    filteredHosts: [],
    diffViewType: 'split',
    editorName: 'editor',
Severity: Major
Found in webpack/assets/javascripts/react_app/common/testHelpers.js and 1 other location - About 5 hrs to fix
webpack/assets/javascripts/react_app/components/Editor/EditorReducer.js on lines 30..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 150.

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 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

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

      it('should render toolbar buttons', () => {
        const toolbarButtons = <button>test Button</button>;
        const { getByText } = render(
          <Provider store={store}>
            <Router>
    webpack/assets/javascripts/react_app/routes/common/PageLayout/PageLayout.test.js on lines 59..76

    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 147.

    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 render custom breadcrumbs', () => {
        const customBreadcrumbs = <div>test Breadcrumbs</div>;
        const { getByText } = render(
          <Provider store={store}>
            <Router>
    webpack/assets/javascripts/react_app/routes/common/PageLayout/PageLayout.test.js on lines 78..95

    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 147.

    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 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 application.js has 394 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 compute_resource.rb has 392 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        class ComputeResource < ApplicationRecord
          audited :except => [:attrs]
          include Taxonomix
          include Encryptable
          include Authorizable
        Severity: Minor
        Found in app/models/compute_resource.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

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

            test('PickTimeTable is working properly for Hour', () => {
              const time = new Date('2019-01-04   14:22:31');
              const setSelected = jest.fn();
              const component = shallow(
                <PickTimeTable time={time} type={HOUR} setSelected={setSelected} />
            webpack/assets/javascripts/react_app/components/common/DateTimePicker/TimeComponents/PickTimeTable.test.js on lines 6..18

            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 142.

            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

            test('PickTimeTable is working properly for Minute', () => {
              const time = new Date('2019-01-04   14:22:31');
              const setSelected = jest.fn();
              const component = shallow(
                <PickTimeTable time={time} type={MINUTE} setSelected={setSelected} />
            webpack/assets/javascripts/react_app/components/common/DateTimePicker/TimeComponents/PickTimeTable.test.js on lines 20..32

            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 142.

            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 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

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

                const UpdatePackages = ({
                  updatePackages,
                  handleUpdatePackages,
                  isLoading,
                }) => (
                webpack/assets/javascripts/react_app/routes/RegistrationCommands/RegistrationCommandsPage/components/fields/Insecure.js on lines 9..29

                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 139.

                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 Insecure = ({ insecure, handleInsecure, isLoading }) => (
                  <FormGroup fieldId="reg_insecure">
                    <Checkbox
                      ouiaId="reg_insecure"
                      label={
                webpack/assets/javascripts/react_app/routes/RegistrationCommands/RegistrationCommandsPage/components/fields/UpdatePackages.js on lines 9..29

                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 139.

                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 Libvirt has 39 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

                  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';

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

                      <FormGroup label={__('Host group')} fieldId="reg_host_group">
                        <FormSelect
                          ouiaId="reg_host_group"
                          value={hostGroupId}
                          onChange={v => handleHostGroup(v)}
                    webpack/assets/javascripts/react_app/routes/RegistrationCommands/RegistrationCommandsPage/components/fields/SmartProxy.js on lines 29..54

                    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 135.

                    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

                    test('Edit year DecadeView', () => {
                      const date = new Date('2/21/2019 , 2:22:31 PM');
                      const setSelected = jest.fn();
                      const component = mount(<DecadeView date={date} setSelected={setSelected} />);
                      expect(component.render()).toMatchSnapshot();
                    webpack/assets/javascripts/react_app/components/common/DateTimePicker/DateComponents/YearView.test.js on lines 12..22

                    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 135.

                    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

                    test('Edit month YearView', () => {
                      const date = new Date('2/21/2019 , 2:22:31 PM');
                      const setSelected = jest.fn();
                      const component = shallow(<YearView date={date} setSelected={setSelected} />);
                      expect(component.render()).toMatchSnapshot();
                    webpack/assets/javascripts/react_app/components/common/DateTimePicker/DateComponents/DecadeView.test.js on lines 12..22

                    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 135.

                    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

                    Severity
                    Category
                    Status
                    Source
                    Language